View Source Agens.Router.Output (agens v0.2.0)

Declares a single structured output field that a Router expects from a Serving.

An Agens.Router.Output describes both the schema of a structured output key (used to build the LM-facing JSON Schema via to_json_schema/1) and, at runtime, the resolved value supplied by the Serving (:value).

Fields

  • :key - The output key name. Must match a property in the Serving's structured response.
  • :type - One of "int", "enum", "bool", or "string".
  • :description - Human-readable description rendered into the JSON Schema.
  • :meta - Optional per-type constraint map. For "int", supports :min and :max. For "enum", supports :choices (the allowed string values).
  • :value - The resolved value at runtime; nil until populated from the Serving response.

Summary

Functions

Converts a list of Agens.Router.Output declarations into a JSON Schema properties map.

Types

@type t() :: %Agens.Router.Output{
  description: String.t(),
  key: String.t(),
  meta: map() | nil,
  type: String.t(),
  value: any()
}

Functions

@spec to_json_schema([t()]) :: map()

Converts a list of Agens.Router.Output declarations into a JSON Schema properties map.

Each output is mapped to a typed JSON Schema fragment. Per-type constraints are read from :meta: "int" honors :min/:max; "enum" honors :choices. The returned map is suitable for use as the outputs property in a Serving's structured response schema.