Prompt

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

Represents a data structure for a prompt, consisting of a list of messages, a unique identifier, and optional parameters for language model settings.

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

The unique identifier for the prompt.

Link copied to clipboard

Represents the total token usage of the most recent response message in the current prompt.

Link copied to clipboard

The list of Message objects associated with the prompt.

Link copied to clipboard

The language model pa rameters associated with the prompt. Defaults to LLMParams.

Link copied to clipboard

Represents the total time spent across all messages within the prompt (measured in milliseconds)

Functions

Link copied to clipboard

Creates a copy of the Prompt with updated messages, allowing to modify the existing list of messages or provide a new one.

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 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.