RALLMGenerationOptions, not as a history entry, so trimming the
conversation cannot drop it.
Basic usage
RALLMGenerationOptions is a generated protobuf message with no memberwise initializer. Start from
.defaults() and assign the fields you need.
How system prompts work
Commons renders{systemPrompt, history, prompt} through the model’s chat template:
Examples
Customer Support Bot
Code Assistant
Creative Writer
JSON Output
Language Tutor
Best Practices
Be Specific
Set Boundaries
Control Output Format
Maintain Persona
Reusable System Prompts
Create a library of system prompts for different use cases:Tips
Keep it concise
Keep it concise
Long system prompts consume context window tokens. Be specific but brief.
Test variations
Test variations
Small changes in wording can significantly affect output. Test different phrasings.
Lower temperature for following instructions
Lower temperature for following instructions
Use
temperature: 0.3-0.5 when you need the model to strictly follow format instructions.Combine with stop sequences
Combine with stop sequences
Use
stopSequences to prevent the model from generating beyond your desired format.generate()
Learn more about generation options →