prompt
fun prompt(id: String, params: LLMParams = LLMParams(), clock: Clock = Clock.System, build: PromptBuilder.() -> Unit): Prompt(source)
Creates a new prompt using the Prompt DSL.
This function allows creating a prompt with a specific ID and parameters.
Example:
val prompt = prompt("example-prompt") {
system("You are a helpful assistant.")
user("What is the capital of France?")
}
Content copied to clipboard
Return
A new Prompt object
Parameters
id
The identifier for the prompt
params
The parameters for the language model
clock
The clock to use for generating timestamps, defaults to Clock.System
build
The initialization block for the PromptBuilder
fun prompt(existing: Prompt, clock: Clock = Clock.System, build: PromptBuilder.() -> Unit): Prompt(source)
Extends an existing prompt using the Prompt DSL.
This function allows adding more messages to an existing prompt.
Example:
val basePrompt = prompt("base-prompt") {
system("You are a helpful assistant.")
}
val extendedPrompt = prompt(basePrompt) {
user("What is the capital of France?")
}
Content copied to clipboard
Return
A new Prompt object based on the existing one
Parameters
existing
The existing prompt to extend
clock
The clock to use for generating timestamps, defaults to Clock.System
build
The initialization block for the PromptBuilder