File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828 extractToolDeltas ,
2929} from './stream-transformers.js' ;
3030import { executeTool } from './tool-executor.js' ;
31+ import { executeNextTurnParamsFunctions , applyNextTurnParamsToRequest } from './next-turn-params.js' ;
3132import { 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 = [
You can’t perform that action at this time.
0 commit comments