ReqLLM.Router.Request (ReqLLM v1.26.0)

View Source

The normalized input for an application model router.

The request has two fields:

  • context is the normalized conversation and tools.
  • routing_context is opaque application data for model selection.

ReqLLM passes routing_context unchanged and does not add derived values such as the generation operation, streaming state, output schema, provider credentials, generation options, or transport options. Applications that need one of these values for routing must include it explicitly in routing_context.

Summary

Types

Opaque application data used to select a model.

t()

Functions

Builds a normalized router request.

Returns the Zoi schema for a normalized router request.

Types

routing_context()

@type routing_context() :: map()

Opaque application data used to select a model.

t()

@type t() :: %ReqLLM.Router.Request{
  context: ReqLLM.Context.t(),
  routing_context: routing_context()
}

Functions

new(input, opts \\ [])

@spec new(ReqLLM.Context.prompt(), keyword()) :: {:ok, t()} | {:error, term()}

Builds a normalized router request.

schema()

@spec schema() :: Zoi.schema()

Returns the Zoi schema for a normalized router request.