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

Copy Markdown View Source

Execution mode that loops until a successful result.

Calls the LLM, executes tool calls, and repeats until:

  • The last message is an assistant response (success)
  • The last message is a tool result with no errors (success)
  • Max retry count is exceeded (error)

Options

  • :force_recurse — When true, forces recursion even after a successful result. Used internally by UntilToolUsed mode. Default: false.

Usage

LLMChain.run(chain, mode: :until_success)