Normandy.LLM.Response (normandy v2.2.0)

View Source

A model's answer to one Normandy.LLM.Request.

  • :content - the request's response_model filled in, or the answer text when the request's response_model was nil
  • :stop_reason - why the model stopped (:end_turn, :tool_use, :max_tokens, :stop_sequence, :pause_turn, :refusal, :model_context_window_exceeded, :compaction); an unrecognized provider reason is passed through as a string; nil when the client doesn't report one
  • :usage - the provider's token usage map, or nil
  • :meta - per-call facts that are not usage: :served_by, :fallback_model, :input_transformations, :response_id, :finish_reason (the stop reason as a string, for telemetry)

Summary

Types

stop_reason()

@type stop_reason() ::
  :end_turn
  | :tool_use
  | :max_tokens
  | :stop_sequence
  | :pause_turn
  | :refusal
  | :model_context_window_exceeded
  | :compaction
  | atom()
  | String.t()

t()

@type t() :: %Normandy.LLM.Response{
  content: struct() | String.t(),
  meta: map(),
  stop_reason: stop_reason() | nil,
  usage: map() | nil
}