Through options
Through a message
AChatRole.system message becomes options.systemPrompt automatically:
options.systemPrompt wins.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Control model behaviour with a system prompt
final result = await RunAnywhere.llm.generate(
'How do I reverse a string?',
options: LlmOptions(
systemPrompt: 'You are a Dart expert. Answer with code, then one sentence.',
),
);
ChatRole.system message becomes options.systemPrompt automatically:
final result = await RunAnywhere.llm.generateChat([
ChatMessage(role: ChatRole.system, content: 'You are a Dart expert.'),
ChatMessage(role: ChatRole.user, content: 'How do I reverse a string?'),
]);
options.systemPrompt wins.
// Works
'You are a terse assistant. Answer in one sentence. No preamble.'
// Works less well on a 0.6B model
'You are an extremely helpful, knowledgeable, and friendly AI assistant who always strives '
'to provide the most comprehensive and detailed responses possible…'
LlmOptions(
systemPrompt: 'You are a classifier. Reply with exactly one word: positive, negative, or neutral.',
temperature: 0.1,
)
abstract final class Prompts {
static const summarizer = LlmOptions(
systemPrompt: 'Summarize in three bullet points. No introduction.',
maxOutputTokens: 150,
temperature: 0.3,
);
static const coder = LlmOptions(
systemPrompt: 'You are a Dart expert. Answer with code first.',
temperature: 0.2,
);
}
final summary = await RunAnywhere.llm.generate(article, options: Prompts.summarizer);