@@ -18,6 +18,7 @@ import { IToolCallingLoopOptions, ToolCallingLoop, ToolCallingLoopFetchOptions }
18
18
import { AgentPrompt } from '../../prompts/node/agent/agentPrompt' ;
19
19
import { PromptRenderer } from '../../prompts/node/base/promptRenderer' ;
20
20
import { ToolName } from '../../tools/common/toolNames' ;
21
+ import { ChatVariablesCollection } from '../common/chatVariablesCollection' ;
21
22
import { IBuildPromptContext } from '../common/intents' ;
22
23
import { IBuildPromptResult } from './intents' ;
23
24
@@ -43,14 +44,18 @@ export class ExecutePromptToolCallingLoop extends ToolCallingLoop<IExecutePrompt
43
44
super ( options , instantiationService , endpointProvider , logService , requestLogger , authenticationChatUpgradeService , telemetryService ) ;
44
45
}
45
46
46
- protected override createPromptContext ( availableTools : LanguageModelToolInformation [ ] , outputStream : ChatResponseStream | undefined ) {
47
+ protected override createPromptContext ( availableTools : LanguageModelToolInformation [ ] , outputStream : ChatResponseStream | undefined ) : IBuildPromptContext {
47
48
const context = super . createPromptContext ( availableTools , outputStream ) ;
48
49
if ( context . tools ) {
49
50
context . tools = {
50
51
...context . tools ,
52
+ toolReferences : [ ] ,
51
53
inSubAgent : true
52
54
} ;
53
55
}
56
+ context . query = this . options . promptText ;
57
+ context . chatVariables = new ChatVariablesCollection ( ) ;
58
+ context . conversation = undefined ;
54
59
return context ;
55
60
}
56
61
@@ -62,20 +67,15 @@ export class ExecutePromptToolCallingLoop extends ToolCallingLoop<IExecutePrompt
62
67
return endpoint ;
63
68
}
64
69
65
- protected async buildPrompt ( buildPromptContext : IBuildPromptContext , progress : Progress < ChatResponseReferencePart | ChatResponseProgressPart > , token : CancellationToken ) : Promise < IBuildPromptResult > {
70
+ protected async buildPrompt ( promptContext : IBuildPromptContext , progress : Progress < ChatResponseReferencePart | ChatResponseProgressPart > , token : CancellationToken ) : Promise < IBuildPromptResult > {
66
71
const endpoint = await this . getEndpoint ( this . options . request ) ;
67
- const promptContext : IBuildPromptContext = {
68
- ...buildPromptContext ,
69
- query : this . options . promptText ,
70
- conversation : undefined
71
- } ;
72
72
const renderer = PromptRenderer . create (
73
73
this . instantiationService ,
74
74
endpoint ,
75
75
AgentPrompt ,
76
76
{
77
77
endpoint,
78
- promptContext,
78
+ promptContext : promptContext ,
79
79
location : this . options . location ,
80
80
enableCacheBreakpoints : false ,
81
81
}
0 commit comments