bobbai00 commented on code in PR #9603:
URL: https://github.com/apache/texera/pull/9603#discussion_r4688127580
##########
agent-service/src/agent/texera-agent.spec.ts:
##########
@@ -906,6 +906,35 @@ describe("sendMessage", () => {
expect(agent.getAllSteps().map(s => s.stepId)).toEqual([0, 1, 2, 3]);
});
+ test("stops a looping model at the default step limit", async () => {
+ // Nothing sets maxSteps here, so the default is all that bounds a model
that never stops
+ // calling tools.
+ let n = 0;
+ const model = new MockLanguageModelV4({
+ doGenerate: async () => {
+ n++;
+ if (n > 200) throw new Error("runaway");
+ return {
+ content: [
+ {
+ type: "tool-call",
+ toolCallId: "c" + n,
+ toolName: "deleteOperator",
+ input: JSON.stringify({ operatorId: "ghost" }),
+ },
+ ],
+ finishReason: finish("tool-calls"),
+ usage: usage(1, 1),
+ warnings: [],
+ } as any;
+ },
+ });
+ const agent = makeAgentWith(model);
+ expect(agent.getSettings().maxSteps).toBe(25);
+ await agent.sendMessage("go");
+ expect(n).toBe(25);
+ });
Review Comment:
Thanks! Done in 46fc2e9a2: the test now uses `toolCallingModel`, with its
runaway guard raised to 50, and also checks the notice the user sees.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]