LLMResponse

a parsed response from an LLM provider.

  • content: the text content of the response (may be empty if the model called tools instead)
  • stop-reason: provider-specific reason the generation ended
  • input-tokens: tokens consumed by the prompt
  • output-tokens: tokens generated
  • tool-calls: tool calls the model wants to make (empty if none)

content

instantiate

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

gets the content property of a LLMResponse.

copy

instantiate

(Fn [(Ref LLMResponse a)] LLMResponse)

copies a LLMResponse.

delete

instantiate

(Fn [LLMResponse] ())

deletes a LLMResponse. Should usually not be called manually.

init

instantiate

(Fn [String, String, Int, Int, (Array ToolCall)] LLMResponse)

creates a LLMResponse.

input-tokens

instantiate

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

gets the input-tokens property of a LLMResponse.

output-tokens

instantiate

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

gets the output-tokens property of a LLMResponse.

prn

instantiate

(Fn [(Ref LLMResponse a)] String)

converts a LLMResponse to a string.

set-content

instantiate

(Fn [LLMResponse, String] LLMResponse)

sets the content property of a LLMResponse.

set-content!

instantiate

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

sets the content property of a LLMResponse in place.

set-input-tokens

instantiate

(Fn [LLMResponse, Int] LLMResponse)

sets the input-tokens property of a LLMResponse.

set-input-tokens!

instantiate

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

sets the input-tokens property of a LLMResponse in place.

set-output-tokens

instantiate

(Fn [LLMResponse, Int] LLMResponse)

sets the output-tokens property of a LLMResponse.

set-output-tokens!

instantiate

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

sets the output-tokens property of a LLMResponse in place.

set-stop-reason

instantiate

(Fn [LLMResponse, String] LLMResponse)

sets the stop-reason property of a LLMResponse.

set-stop-reason!

instantiate

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

sets the stop-reason property of a LLMResponse in place.

set-tool-calls

instantiate

(Fn [LLMResponse, (Array ToolCall)] LLMResponse)

sets the tool-calls property of a LLMResponse.

set-tool-calls!

instantiate

(Fn [(Ref LLMResponse a), (Array ToolCall)] ())

sets the tool-calls property of a LLMResponse in place.

stop-reason

instantiate

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

gets the stop-reason property of a LLMResponse.

str

instantiate

(Fn [(Ref LLMResponse a)] String)

converts a LLMResponse to a string.

tool-calls

instantiate

(Fn [(Ref LLMResponse a)] (Ref (Array ToolCall) a))

gets the tool-calls property of a LLMResponse.

update-content

instantiate

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

updates the content property of a LLMResponse using a function f.

update-input-tokens

instantiate

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

updates the input-tokens property of a LLMResponse using a function f.

update-output-tokens

instantiate

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

updates the output-tokens property of a LLMResponse using a function f.

update-stop-reason

instantiate

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

updates the stop-reason property of a LLMResponse using a function f.

update-tool-calls

instantiate

(Fn [LLMResponse, (Ref (Fn [(Array ToolCall)] (Array ToolCall) a) b)] LLMResponse)

updates the tool-calls property of a LLMResponse using a function f.