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
val result = RunAnywhere.llm.generate(
"How do I reverse a string?",
LlmOptions(systemPrompt = "You are a Kotlin expert. Answer with code, then one sentence.")
)
ChatRole.System message becomes options.systemPrompt automatically:
val messages = listOf(
ChatMessage(ChatRole.System, "You are a Kotlin expert."),
ChatMessage(ChatRole.User, "How do I reverse a string?"),
)
val result = RunAnywhere.llm.generate(messages)
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.1f
)
object Prompts {
val summarizer = LlmOptions(
systemPrompt = "Summarize in three bullet points. No introduction.",
maxOutputTokens = 150,
temperature = 0.3f
)
val coder = LlmOptions(
systemPrompt = "You are a Kotlin expert. Answer with code first.",
temperature = 0.2f
)
}
val summary = RunAnywhere.llm.generate(article, Prompts.summarizer)