@@ -21,6 +21,7 @@ import { ToolName } from '../../tools/common/toolNames';
21
21
import { ChatVariablesCollection } from '../common/chatVariablesCollection' ;
22
22
import { IBuildPromptContext } from '../common/intents' ;
23
23
import { IBuildPromptResult } from './intents' ;
24
+ import { normalizeToolSchema } from '../../tools/common/toolSchemaNormalizer' ;
24
25
25
26
export interface IExecutePromptToolCallingLoopOptions extends IToolCallingLoopOptions {
26
27
request : ChatRequest ;
@@ -93,23 +94,28 @@ export class ExecutePromptToolCallingLoop extends ToolCallingLoop<IExecutePrompt
93
94
94
95
protected async fetch ( { messages, finishedCb, requestOptions } : ToolCallingLoopFetchOptions , token : CancellationToken ) : Promise < ChatResponse > {
95
96
const endpoint = await this . getEndpoint ( this . options . request ) ;
96
- return endpoint . makeChatRequest (
97
- ExecutePromptToolCallingLoop . ID ,
97
+ return endpoint . makeChatRequest2 ( {
98
+ debugName : ExecutePromptToolCallingLoop . ID ,
98
99
messages,
99
100
finishedCb,
100
- token ,
101
- this . options . location ,
102
- undefined ,
103
- {
104
- ...requestOptions ,
105
- temperature : 0
101
+ location : this . options . location ,
102
+ requestOptions : {
103
+ ...( requestOptions ?? { } ) ,
104
+ temperature : 0 ,
105
+ tools : normalizeToolSchema (
106
+ endpoint . family ,
107
+ requestOptions ?. tools ,
108
+ ( tool , rule ) => {
109
+ this . _logService . warn ( `Tool ${ tool } failed validation: ${ rule } ` ) ;
110
+ } ,
111
+ ) ,
106
112
} ,
107
113
// This loop is inside a tool called from another request, so never user initiated
108
- false ,
109
- {
114
+ userInitiatedRequest : false ,
115
+ telemetryProperties : {
110
116
messageId : randomUUID ( ) ,
111
117
messageSource : ExecutePromptToolCallingLoop . ID
112
118
} ,
113
- ) ;
119
+ } , token ) ;
114
120
}
115
121
}
0 commit comments