Execution mode that loops while the chain needs a response.
After each LLM call, if the response contains tool calls, this mode:
- Executes the pending tool calls
- Calls the LLM again with the tool results
- Repeats until
needs_responseis false (no more tool calls)
The LLM always gets the last word after tool execution.
Usage
LLMChain.run(chain, mode: :while_needs_response)
# or
LLMChain.run(chain, mode: LangChain.Chains.LLMChain.Modes.WhileNeedsResponse)