LLMRequest

a chat request to an LLM provider.

Build with LLM.chat-request, LLM.chat-request-with-tools, LLM.chat-request-json, or LLM.chat-request-with-schema rather than constructing directly. Use the auto-generated LLMRequest.set-* functions to set optional sampling parameters (e.g. (LLMRequest.set-top-p req 0.9)).

  • model: provider-specific model identifier
  • messages: the conversation history
  • max-tokens: maximum output tokens
  • temperature: sampling temperature (0.0 to 2.0)
  • tools: tool definitions (empty array if none)
  • format-mode: format-text, format-json, or format-json-schema
  • format-schema: JSON schema for structured output (used when mode is format-json-schema)
  • top-p: nucleus sampling threshold (0.0 to 1.0); negative means unset. Supported by all providers.
  • top-k: top-k sampling (positive integer); negative means unset. Supported by Anthropic, Ollama, and Gemini (ignored by OpenAI).
  • frequency-penalty: penalise repeated tokens (-2.0 to 2.0); values below -3.0 mean unset. Supported by OpenAI and Ollama.
  • presence-penalty: penalise tokens already present (-2.0 to 2.0); values below -3.0 mean unset. Supported by OpenAI and Ollama.
  • seed: deterministic sampling seed (non-negative integer); negative means unset. Supported by OpenAI and Ollama.

copy

instantiate

(Fn [(Ref LLMRequest a)] LLMRequest)

copies a LLMRequest.

delete

instantiate

(Fn [LLMRequest] ())

deletes a LLMRequest. Should usually not be called manually.

format-mode

instantiate

(Fn [(Ref LLMRequest a)] (Ref Int a))

gets the format-mode property of a LLMRequest.

format-schema

instantiate

(Fn [(Ref LLMRequest a)] (Ref JSON a))

gets the format-schema property of a LLMRequest.

frequency-penalty

instantiate

(Fn [(Ref LLMRequest a)] (Ref Double a))

gets the frequency-penalty property of a LLMRequest.

init

instantiate

(Fn [String, (Array Message), Int, Double, (Array ToolDef), Int, JSON, Double, Int, Double, Double, Int] LLMRequest)

creates a LLMRequest.

max-tokens

instantiate

(Fn [(Ref LLMRequest a)] (Ref Int a))

gets the max-tokens property of a LLMRequest.

messages

instantiate

(Fn [(Ref LLMRequest a)] (Ref (Array Message) a))

gets the messages property of a LLMRequest.

model

instantiate

(Fn [(Ref LLMRequest a)] (Ref String a))

gets the model property of a LLMRequest.

presence-penalty

instantiate

(Fn [(Ref LLMRequest a)] (Ref Double a))

gets the presence-penalty property of a LLMRequest.

prn

instantiate

(Fn [(Ref LLMRequest a)] String)

converts a LLMRequest to a string.

seed

instantiate

(Fn [(Ref LLMRequest a)] (Ref Int a))

gets the seed property of a LLMRequest.

set-format-mode

instantiate

(Fn [LLMRequest, Int] LLMRequest)

sets the format-mode property of a LLMRequest.

set-format-mode!

instantiate

(Fn [(Ref LLMRequest a), Int] ())

sets the format-mode property of a LLMRequest in place.

set-format-schema

instantiate

(Fn [LLMRequest, JSON] LLMRequest)

sets the format-schema property of a LLMRequest.

set-format-schema!

instantiate

(Fn [(Ref LLMRequest a), JSON] ())

sets the format-schema property of a LLMRequest in place.

set-frequency-penalty

instantiate

(Fn [LLMRequest, Double] LLMRequest)

sets the frequency-penalty property of a LLMRequest.

set-frequency-penalty!

instantiate

(Fn [(Ref LLMRequest a), Double] ())

sets the frequency-penalty property of a LLMRequest in place.

set-max-tokens

instantiate

(Fn [LLMRequest, Int] LLMRequest)

sets the max-tokens property of a LLMRequest.

set-max-tokens!

instantiate

(Fn [(Ref LLMRequest a), Int] ())

sets the max-tokens property of a LLMRequest in place.

set-messages

instantiate

(Fn [LLMRequest, (Array Message)] LLMRequest)

sets the messages property of a LLMRequest.

set-messages!

instantiate

(Fn [(Ref LLMRequest a), (Array Message)] ())

sets the messages property of a LLMRequest in place.

set-model

instantiate

(Fn [LLMRequest, String] LLMRequest)

sets the model property of a LLMRequest.

set-model!

instantiate

(Fn [(Ref LLMRequest a), String] ())

sets the model property of a LLMRequest in place.

set-presence-penalty

instantiate

(Fn [LLMRequest, Double] LLMRequest)

sets the presence-penalty property of a LLMRequest.

set-presence-penalty!

instantiate

(Fn [(Ref LLMRequest a), Double] ())

sets the presence-penalty property of a LLMRequest in place.

set-seed

instantiate

(Fn [LLMRequest, Int] LLMRequest)

sets the seed property of a LLMRequest.

set-seed!

instantiate

(Fn [(Ref LLMRequest a), Int] ())

sets the seed property of a LLMRequest in place.

set-temperature

instantiate

(Fn [LLMRequest, Double] LLMRequest)

sets the temperature property of a LLMRequest.

set-temperature!

instantiate

(Fn [(Ref LLMRequest a), Double] ())

sets the temperature property of a LLMRequest in place.

set-tools

instantiate

(Fn [LLMRequest, (Array ToolDef)] LLMRequest)

sets the tools property of a LLMRequest.

set-tools!

instantiate

(Fn [(Ref LLMRequest a), (Array ToolDef)] ())

sets the tools property of a LLMRequest in place.

set-top-k

instantiate

(Fn [LLMRequest, Int] LLMRequest)

sets the top-k property of a LLMRequest.

set-top-k!

instantiate

(Fn [(Ref LLMRequest a), Int] ())

sets the top-k property of a LLMRequest in place.

set-top-p

instantiate

(Fn [LLMRequest, Double] LLMRequest)

sets the top-p property of a LLMRequest.

set-top-p!

instantiate

(Fn [(Ref LLMRequest a), Double] ())

sets the top-p property of a LLMRequest in place.

str

instantiate

(Fn [(Ref LLMRequest a)] String)

converts a LLMRequest to a string.

temperature

instantiate

(Fn [(Ref LLMRequest a)] (Ref Double a))

gets the temperature property of a LLMRequest.

tools

instantiate

(Fn [(Ref LLMRequest a)] (Ref (Array ToolDef) a))

gets the tools property of a LLMRequest.

top-k

instantiate

(Fn [(Ref LLMRequest a)] (Ref Int a))

gets the top-k property of a LLMRequest.

top-p

instantiate

(Fn [(Ref LLMRequest a)] (Ref Double a))

gets the top-p property of a LLMRequest.

update-format-mode

instantiate

(Fn [LLMRequest, (Ref (Fn [Int] Int a) b)] LLMRequest)

updates the format-mode property of a LLMRequest using a function f.

update-format-schema

instantiate

(Fn [LLMRequest, (Ref (Fn [JSON] JSON a) b)] LLMRequest)

updates the format-schema property of a LLMRequest using a function f.

update-frequency-penalty

instantiate

(Fn [LLMRequest, (Ref (Fn [Double] Double a) b)] LLMRequest)

updates the frequency-penalty property of a LLMRequest using a function f.

update-max-tokens

instantiate

(Fn [LLMRequest, (Ref (Fn [Int] Int a) b)] LLMRequest)

updates the max-tokens property of a LLMRequest using a function f.

update-messages

instantiate

(Fn [LLMRequest, (Ref (Fn [(Array Message)] (Array Message) a) b)] LLMRequest)

updates the messages property of a LLMRequest using a function f.

update-model

instantiate

(Fn [LLMRequest, (Ref (Fn [String] String a) b)] LLMRequest)

updates the model property of a LLMRequest using a function f.

update-presence-penalty

instantiate

(Fn [LLMRequest, (Ref (Fn [Double] Double a) b)] LLMRequest)

updates the presence-penalty property of a LLMRequest using a function f.

update-seed

instantiate

(Fn [LLMRequest, (Ref (Fn [Int] Int a) b)] LLMRequest)

updates the seed property of a LLMRequest using a function f.

update-temperature

instantiate

(Fn [LLMRequest, (Ref (Fn [Double] Double a) b)] LLMRequest)

updates the temperature property of a LLMRequest using a function f.

update-tools

instantiate

(Fn [LLMRequest, (Ref (Fn [(Array ToolDef)] (Array ToolDef) a) b)] LLMRequest)

updates the tools property of a LLMRequest using a function f.

update-top-k

instantiate

(Fn [LLMRequest, (Ref (Fn [Int] Int a) b)] LLMRequest)

updates the top-k property of a LLMRequest using a function f.

update-top-p

instantiate

(Fn [LLMRequest, (Ref (Fn [Double] Double a) b)] LLMRequest)

updates the top-p property of a LLMRequest using a function f.