Skip to content

Commit 457f93b

Browse files
committed
fix
1 parent 25795a5 commit 457f93b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/lib/model-result.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
extractToolDeltas,
2929
} from './stream-transformers.js';
3030
import { executeTool } from './tool-executor.js';
31+
import { executeNextTurnParamsFunctions, applyNextTurnParamsToRequest } from './next-turn-params.js';
3132
import { hasExecuteFunction } from './tool-types.js';
3233

3334
/**
@@ -353,6 +354,23 @@ export class ModelResult {
353354
});
354355
}
355356

357+
// Execute nextTurnParams functions for tools that were called
358+
if (this.options.tools && currentToolCalls.length > 0) {
359+
const computedParams = await executeNextTurnParamsFunctions(
360+
currentToolCalls,
361+
this.options.tools,
362+
this.options.request as models.OpenResponsesRequest
363+
);
364+
365+
// Apply computed parameters to the request for next turn
366+
if (Object.keys(computedParams).length > 0) {
367+
this.options.request = applyNextTurnParamsToRequest(
368+
this.options.request as models.OpenResponsesRequest,
369+
computedParams
370+
);
371+
}
372+
}
373+
356374
// Build new input with tool results
357375
// For the Responses API, we need to include the tool results in the input
358376
const newInput: models.OpenResponsesInput = [

0 commit comments

Comments
 (0)