ExAgent. Models. Test
(ExAgent v2.0.0)
View Source
A deterministic, in-process model for development and tests.
Drop-in replacement for a real provider: it never hits the network and returns
scripted (or default) Message.Responses. This is the workhorse that lets the
agent loop be developed and unit-tested offline.
Configuration:
%Test{}— always replies with a generic text response.%Test{label: "x"}— replies with the fixed string"x"as text.%Test{script: [...]}— returns each item in order; an item may be aMessage.Response, a string (wrapped as a text part), a{:tool_calls, [ToolCall]}tuple, or a functionfn messages, params -> item.
An initially empty script uses the label or generic response. A nonempty script must cover every expected model request, including requests after tools and corrective output. Exhausting it fails the request; it does not silently supply a generic response. Two-argument functions receive the message list and parameters.
Summary
Types
@type script_item() :: ExAgent.Message.Response.t() | String.t() | {:tool_calls, [ExAgent.Message.Part.ToolCall.t()]} | ([ExAgent.Message.t()], ExAgent.ModelRequestParameters.t() -> script_item())
@type t() :: %ExAgent.Models.Test{ index: non_neg_integer(), label: String.t() | nil, received: [term()], script: [script_item()] }