Skip to content

Commit c61708f

Browse files
committed
add prompting tips to sampling
1 parent 9863fdb commit c61708f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

exercises/03.sampling/README.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@ Here's a simple example of a sampling request and response using MCP:
8787
}
8888
```
8989

90+
## Your Sampling Request is a Prompt
91+
92+
When you make a sampling request, you're essentially crafting a prompt for the language model. The `systemPrompt` and `messages` you send become the instructions that guide the model's generation. This means that the quality and effectiveness of your sampling requests depend heavily on how well you structure your prompts.
93+
94+
Here are some key prompting tips for effective sampling:
95+
96+
- **Be specific and clear**: Instead of "generate tags," try "generate 3-5 relevant tags for a journal entry about [topic], using lowercase words separated by commas"
97+
- **Provide examples**: Show the model what you want by including sample inputs and outputs in your prompt
98+
- **Provide context**: Include relevant information in your messages to help the model understand what you're asking for
99+
- **Set expectations**: Use the system prompt to establish the model's role and the format you expect
100+
- **Test and iterate**: Start with simple prompts and refine them based on the results you get
101+
- **Consider safety**: Structure your prompts to avoid generating harmful or inappropriate content
102+
103+
For more advanced prompting techniques and research-backed strategies, see [The Prompt Report](https://arxiv.org/abs/2406.06608), a comprehensive survey of 58 LLM prompting techniques and best practices for modern AI systems.
104+
90105
MCP standardizes how servers and clients can request these generations. Instead
91106
of requiring every server to manage its own API keys and model integrations, MCP
92107
lets servers request completions through a client, which handles model

0 commit comments

Comments
 (0)