function untilFinishReason(stopReasons): AgentLoopStrategy;
function untilFinishReason(stopReasons): AgentLoopStrategy;
Defined in: utilities/agent-loop-strategies.ts:41
Creates a strategy that continues until a specific finish reason is encountered
string[]
Finish reasons that should stop the loop
AgentLoopStrategy that stops on specific finish reasons
const stream = chat({
adapter: openai(),
model: "gpt-4o",
messages: [...],
tools: [weatherTool],
agentLoopStrategy: untilFinishReason(["stop", "length"]),
});
const stream = chat({
adapter: openai(),
model: "gpt-4o",
messages: [...],
tools: [weatherTool],
agentLoopStrategy: untilFinishReason(["stop", "length"]),
});
