Learn how to get better results from LLM Gateway by using prompting techniques to optimize your prompts. This page walks you through the parts of a prompt and gives you tips on how to use them to improve your interactions with various LLM models.Documentation Index
Fetch the complete documentation index at: https://assemblyai.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Large language modelsIf you want to learn about LLMs first, see our blog post Introduction to
Large Language
Models.
Anatomy of a prompt
Through a learning process called instruction fine-tuning, modern LLMs are now capable of performing specific tasks based on explicit instructions, also called prompts. A prompt is a piece of text that guides the LLM to generate a response. It can be as simple as a single sentence:- Instruction: The instruction, or question, that you want the LLM to help you with.
- Context: Additional information that help the LLM understand the instruction.
- Format: The format of the response that you want the LLM to generate.
<YOUR_INSTRUCTION>, <YOUR_CONTEXT>, and <YOUR_FORMAT> with your own text.
In the following sections, you’ll learn about each part in more detail.
Instruction
A good instruction is clear and concise. It should tell the LLM exactly what you want it to generate. It should also be short enough that the LLM can understand it.Prefer instructions over questions
Questions can often be ambiguous and may lead to unexpected results. Instead, use instructions starting with an imperative verb to tell the LLM what you want.- Recommended:
List the key features of the product. - Not recommended:
What are the features of the product?
Avoid compound instructions
Focus on one task at a time. Including multiple instructions in a single prompt may confuse the LLM and lead to less accurate results.- Recommended:
Identify action items from the meeting. - Not recommended:
Identify action items from the meeting and list highlights from each speaker.
Context
Add aContext: section to your prompt to provide additional information to the LLM. This can help the LLM generate more accurate results.
Transcription textWith LLM Gateway, you’ll include the transcription text directly in your chat
message. This gives you full control over how the transcript context is
provided to the model.
Provide definitions
You can use context to define any terms that the LLM may not understand.Provide examples
Rather than telling the LLM what to generate, you can show it examples of the output you want to generate.Format
You can tell the LLM how the format should look like by adding anAnswer Format: section to your prompt.
Use tags to define placeholders
Use tags to insert dynamic content into your prompt. A tag is a description of a piece of information, surrounded by angle brackets,<...>.
In the format section of your prompt, place the tag where you want to insert the value.
Remove the preamble
Sometimes the LLM generates a response that includes an introduction to the result, also known as a preamble. For example:Learn more
- LLM Gateway Overview - Learn about available models and capabilities
- Apply LLM Gateway to Audio Transcripts - Complete guide to using LLM Gateway