GenAI.ToolChain
(GenAI Core v0.3.4)
Copy Markdown
Explicit, bounded model/tool loop.
This runner is opt-in: GenAI.run/1-3 retains its existing single-inference
semantics. A chain advertises registered tools, runs inference, executes any
returned calls, appends normalized tool responses, and repeats until the model
stops requesting tools or a bound is reached.
The configurable limits are themselves capped (64 iterations and 256
calls) so untrusted options cannot create an unbounded agent loop.
Summary
Functions
Runs a thread through a bounded sequence of inference and tool calls.
Types
@type result() :: {:ok, {GenAI.ChatCompletion.t(), term(), GenAI.ToolChain.Summary.t()}} | {:error, term()}
Functions
@spec run(term(), GenAI.Tool.Registry.t(), term(), keyword()) :: result()
Runs a thread through a bounded sequence of inference and tool calls.