Through options
Through a message
Asystem 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
const result = await RunAnywhere.llm.generate('How do I reverse a string?', {
systemPrompt: 'You are a TypeScript expert. Answer with code, then one sentence.',
})
system message becomes options.systemPrompt automatically:
const result = await RunAnywhere.llm.generate([
{ role: 'system', content: 'You are a TypeScript expert.' },
{ role: '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…'
await RunAnywhere.llm.generate(review, {
systemPrompt:
'You are a classifier. Reply with exactly one word: positive, negative, or neutral.',
temperature: 0.1,
})
import type { LlmOptions } from '@runanywhere/core'
export const prompts = {
summarizer: {
systemPrompt: 'Summarize in three bullet points. No introduction.',
maxOutputTokens: 150,
temperature: 0.3,
},
coder: {
systemPrompt: 'You are a TypeScript expert. Answer with code first.',
temperature: 0.2,
},
} satisfies Record<string, LlmOptions>
const summary = await RunAnywhere.llm.generate(article, prompts.summarizer)