Prompt

@Serializable
data class Prompt(val messages: List<Message>, val id: String, val params: LLMParams = LLMParams())(source)

Represents a structured prompt for an LLM containing a list of messages, an identifier, and optional language model parameters.

Constructors

Link copied to clipboard
constructor(messages: List<Message>, id: String, params: LLMParams = LLMParams())

Types

Link copied to clipboard
object Companion

Companion object for the Prompt class, providing utilities and constants for creating instances of Prompt.

Link copied to clipboard

Represents a mutable context for updating the parameters of an LLM (Language Learning Model). The class is used internally to facilitate changes to various configurations, such as temperature, speculation, schema, and tool choice, before converting back to an immutable LLMParams instance.

Properties

Link copied to clipboard
val id: String

A unique identifier for the prompt, which can be used for tracking or categorization.

Link copied to clipboard

A list of Message objects representing the conversation or content encapsulated by this prompt.

Link copied to clipboard

Configuration parameters (LLMParams) that control the behavior of the language model when processing this prompt. Defaults to an instance of LLMParams with default settings.

Functions

Link copied to clipboard
fun withMessages(newMessages: List<Message>): Prompt

Creates a copy of the current Prompt instance with updated messages.

Link copied to clipboard
fun withParams(newParams: LLMParams): Prompt

Returns a new instance of the Prompt class with updated language model parameters.

Link copied to clipboard

Creates a copy of the Prompt with updated messages, allowing modifications to the current messages.

Link copied to clipboard

Creates a new instance of Prompt with updated parameters based on the modifications provided in the given update lambda. The update is applied to a mutable context representing the current LLM parameters, allowing selective modifications, which are then returned as a new set of parameters.