docs: correct onBeforeIteration contract for the fallback re-entry

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-08-07 18:07:33 +02:00
parent d037244aed
commit c371c62d66
@@ -70,10 +70,10 @@ export interface ChatLoopConfig {
* lets the caller recover partial output if the loop throws or is aborted.
*/
addedMessages?: ChatCompletionMessageParam[]
/** Called before each iteration (e.g. to refresh tool schemas, or to record
* which model it is about to use). `webSearch` is this iteration's effective
* value, and the system message is read after this returns, so a caller whose
* prompt advertises web search can resync it in time for this request. */
/** Called before each request (e.g. to refresh tool schemas, or to record which
* model it is about to use), including again mid-iteration when a fallback
* changes `webSearch`. That argument is the effective value, and the system
* message is read after this returns, so a caller can resync its prompt in time. */
onBeforeIteration?: (
tools: Tool<any>[],
helpers: any,