Skip to content

Commit

Permalink
Refresh active tools on every iteration, since it can change
Browse files Browse the repository at this point in the history
  • Loading branch information
aomarks committed Jan 15, 2025
1 parent 87a05ff commit 892eaf4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/bbrt/src/llm/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ export class Conversation {
);

const done = (async (): Promise<void> => {
const activeTools = await this.#getActiveTools();
let remainingModelCalls = 1 + Math.max(0, MAX_TOOL_ITERATIONS);
let functionCalls: ReactiveFunctionCallState[];
do {
// Note that tools can change between iterations, since "activate_tool"
// could be called.
const activeTools = await this.#getActiveTools();
const allowFunctionCalls = remainingModelCalls > 1;
functionCalls = (
await this.#callModel(
Expand Down

0 comments on commit 892eaf4

Please sign in to comment.