Normandy.LLM.Request
(normandy v2.2.0)
View Source
One call to a model: what Normandy.Agents.Model.converse/3 and
Normandy.Agents.Model.stream/3 receive.
:model- the model id:system- the system prompt, ornil.:messagesnever holds a"system"message.:output_schema_prompt- the# OUTPUT SCHEMAsection that tells the model the answer's JSON Schema, ornil. It is not in:system: an adapter sends it after:systemon every call whose output it does not constrain to that schema, and may leave it out of one it does (ClaudioAdapterwith structured outputs, AX-19).:context_prompt- the context providers'# Contextsection, ornil: the part of the system prompt that can change from call to call, sent last (ClaudioAdapterputs it after the cached system block, AX-20).
A Normandy.Agents.Model implementation sends system_prompt/1 as its system prompt.
:messages- the conversation, oldest first, asNormandy.Components.Messagestructs:response_model- an empty struct of the shape the caller expects back (see "Response content" inNormandy.Agents.Model), ornilfor the answer as text:output_format- on a tool-loop call (response_model: %ToolCallResponse{}) or a stream, the output-schema struct the final answer's text must match, ornil. An adapter that supports constrained decoding sends it (ClaudioAdapter, asoutput_config.format); others ignore it. Never set for the chat schema.:temperature-nilleaves it unset (Opus 4.7+ reject sampling parameters):max_tokens- required by the Messages API:tools- tool schemas,%{name:, description:, input_schema:}maps; a tool with a provider-defined type also has:native(Normandy.Tool.native_definition/1), which an adapter that supports it sends instead; any other adapter sends the three keys:mcp_servers- MCP server configs for server-side MCP, ornil:task_budget_remaining- the remaining task budget after in-turn compaction, ornil:tool_choice-nil(the provider's default) or:none: tools stay listed, but the model may not call one. BaseAgent sets:noneon the call after the last tool round (max_tool_iterations); a client without tool choice may ignore it
Summary
Functions
The system prompt for a call whose output the adapter does not constrain: :system,
:output_schema_prompt and :context_prompt, the ones that are set, a blank line
apart. nil when none is. Takes a request, or a map with those three keys.
Types
@type t() :: %Normandy.LLM.Request{ context_prompt: String.t() | nil, max_tokens: pos_integer(), mcp_servers: [struct() | map()] | nil, messages: [Normandy.Components.Message.t()], model: String.t(), output_format: struct() | nil, output_schema_prompt: String.t() | nil, response_model: struct() | nil, system: String.t() | nil, task_budget_remaining: non_neg_integer() | nil, temperature: float() | nil, tool_choice: :none | nil, tools: [map()] }
Functions
@spec system_prompt(t() | %{system: s, output_schema_prompt: s, context_prompt: s}) :: String.t() | nil when s: String.t() | nil
The system prompt for a call whose output the adapter does not constrain: :system,
:output_schema_prompt and :context_prompt, the ones that are set, a blank line
apart. nil when none is. Takes a request, or a map with those three keys.