LangChain.Chains.LLMChain.Modes.UntilToolUsed (LangChain v0.6.0)

Copy Markdown View Source

Execution mode that loops until a specific tool is called.

Repeatedly calls the LLM and executes tools until a tool result matching one of the target tool names is found.

Options

  • :tool_names — (required) List of tool name strings to watch for.
  • :max_runs — Maximum LLM calls before error. Default: 25.

Usage

LLMChain.run(chain,
  mode: LangChain.Chains.LLMChain.Modes.UntilToolUsed,
  tool_names: ["submit"],
  max_runs: 25
)
# => {:ok, chain, %ToolResult{name: "submit", ...}}