Writing effective prompts is key to getting the best results from AI models. Here are some best practices and examples specific to working within the Latitude platform.Documentation Index
Fetch the complete documentation index at: https://docs-v1.latitude.so/llms.txt
Use this file to discover all available pages before exploring further.
General Best Practices
-
Be Specific and Clear: Avoid ambiguity. Clearly state the task, desired format, context, and constraints.
- Bad: “Write about Latitude.”
- Good: “Write a 3-paragraph introduction to Latitude for a non-technical audience, highlighting its key benefits for prompt management and evaluation.”
-
Provide Context: Give the model relevant background information it might need.
- Example: If asking for a summary of a meeting, provide the meeting transcript or key discussion points.
-
Define the Persona/Role: Tell the model who it should be.
- Example:
<system>You are a helpful and friendly customer support agent for a SaaS company.</system> - Note: It can be helpful to use made up tags to organize information for the model.
- Example:
<rules> You must never produce more than 5 lines. </rules>
- Example:
- Example:
-
Specify the Output Format: Use instructions or JSON Schema to guide the format.
- Example: “Provide the answer as a JSON object with keys ‘pros’ and ‘cons’, each containing a list of strings.”
- Example: Use the
schemaconfiguration for reliable JSON.
-
Use Examples (Few-Shot Prompting): Provide examples of desired input/output pairs within the prompt.
- Iterate and Test: Use the Playground extensively. Start simple and gradually add complexity. Test with various inputs.
- Break Down Complex Tasks: Use Chains or Agents for multi-step processes rather than trying to do everything in one giant prompt.
Latitude-Specific Tips
- Leverage PromptL: Use variables (
{{ }}), conditionals ({{ if … }}), loops ({{ for … }}), and snippets (<prompt path="...">) for dynamic and reusable prompts. See the PromptL documentation. - Use Configuration Wisely: Tune
temperature,maxTokens, etc., in the configuration block for desired output style and length. - Utilize Tools: Don’t make the model guess information it can look up. Provide Tools for accessing external data or functions (e.g.,
latitude/searchfor web searches). - Employ Agents for Autonomy: For tasks requiring planning and dynamic tool use, define your prompt as an Agent.
- Manage Versions: Use Version Control to track changes and collaborate safely.
- Evaluate Systematically: Use Evaluations to measure prompt quality and identify areas for improvement.
Example: Customer Support Email Generator
- Role setting (
<system>). - Using variables (
{{ customer_email }},{{ customer_query }}). - Defining and enabling a custom tool (
get_customer_details). - Enforcing structured output (
schema). - Clear instructions within the system message.