LlmOptions

data class LlmOptions constructor(var modelSelectionCriteria: ModelSelectionCriteria? = null, var model: String? = null, var role: String? = null, var temperature: Double? = null, var frequencyPenalty: Double? = null, var maxTokens: Int? = null, var presencePenalty: Double? = null, var topK: Int? = null, var topP: Double? = null, var thinking: Thinking? = null, var timeout: Duration? = null, extensions: Map<String, Any> = emptyMap()) : LlmHyperparameters

Portable LLM options.

Parameters

modelSelectionCriteria

explicit model selection criteria. If provided, overrides model and role.

model

Optional model name to use. If provided, specifies an LLM by name. Takes precedence over role.

role

Optional role to use for model selection. If provided, and model is not specified, used to find an LLM by role

timeout

Optional timeout for this LLM call. If provided, overrides the default client timeout.

Constructors

Link copied to clipboard
constructor(modelSelectionCriteria: ModelSelectionCriteria? = null, model: String? = null, role: String? = null, temperature: Double? = null, frequencyPenalty: Double? = null, maxTokens: Int? = null, presencePenalty: Double? = null, topK: Int? = null, topP: Double? = null, thinking: Thinking? = null, timeout: Duration? = null, extensions: Map<String, Any> = emptyMap())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
open override var frequencyPenalty: Double?
Link copied to clipboard
open override var maxTokens: Int?
Link copied to clipboard
Link copied to clipboard

The model these options name, however they name it.

Link copied to clipboard
open override var presencePenalty: Double?
Link copied to clipboard
var role: String?
Link copied to clipboard
open override var temperature: Double?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var topK: Int?
Link copied to clipboard
open override var topP: Double?

Functions

Link copied to clipboard
fun <T> getExtension(key: String): T?

Get a provider-specific extension value by key. Returns null if the extension is not present or cannot be cast to type T.

Link copied to clipboard

Read the native structured-output mode from LlmOptions.

Link copied to clipboard
open fun infoString(verbose: Boolean?, indent: Int): String
Link copied to clipboard

Fill in anything this instance leaves unset from defaults, keeping every value set here.

Link copied to clipboard
fun withExtension(key: String, value: Any): LlmOptions

Add or update a provider-specific extension. Returns a new LlmOptions with the extension added/updated.

Link copied to clipboard
fun withFrequencyPenalty(frequencyPenalty: Double): LlmOptions
Link copied to clipboard
fun withMaxTokens(maxTokens: Int): LlmOptions
Link copied to clipboard

Attach a native structured-output mode to LlmOptions.

Link copied to clipboard
Link copied to clipboard
fun withPresencePenalty(presencePenalty: Double): LlmOptions
Link copied to clipboard
fun withTemperature(temperature: Double?): LlmOptions

Create a copy with a default temperature for the LLM. If null, uses the default temperature for the model.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun withTopK(topK: Int): LlmOptions
Link copied to clipboard