@@ -426,34 +426,35 @@ const getToolEnvs = (tools?: Tool[]): EnvVar[] => {
426
426
const getSystemPromptEnv = (
427
427
tools ?: Tool [ ] ,
428
428
dataSources ?: TemplateDataSource [ ] ,
429
- framework ?: TemplateFramework ,
429
+ template ?: TemplateType ,
430
430
) : EnvVar [ ] => {
431
431
const defaultSystemPrompt =
432
432
"You are a helpful assistant who helps users with their questions." ;
433
433
434
+ const systemPromptEnv : EnvVar [ ] = [ ] ;
434
435
// build tool system prompt by merging all tool system prompts
435
- let toolSystemPrompt = "" ;
436
- tools ?. forEach ( ( tool ) => {
437
- const toolSystemPromptEnv = tool . envVars ?. find (
438
- ( env ) => env . name === TOOL_SYSTEM_PROMPT_ENV_VAR ,
439
- ) ;
440
- if ( toolSystemPromptEnv ) {
441
- toolSystemPrompt += toolSystemPromptEnv . value + "\n" ;
442
- }
443
- } ) ;
436
+ // multiagent template doesn't need system prompt
437
+ if ( template !== "multiagent" ) {
438
+ let toolSystemPrompt = "" ;
439
+ tools ?. forEach ( ( tool ) => {
440
+ const toolSystemPromptEnv = tool . envVars ?. find (
441
+ ( env ) => env . name === TOOL_SYSTEM_PROMPT_ENV_VAR ,
442
+ ) ;
443
+ if ( toolSystemPromptEnv ) {
444
+ toolSystemPrompt += toolSystemPromptEnv . value + "\n" ;
445
+ }
446
+ } ) ;
444
447
445
- const systemPrompt = toolSystemPrompt
446
- ? `\"${ toolSystemPrompt } \"`
447
- : defaultSystemPrompt ;
448
+ const systemPrompt = toolSystemPrompt
449
+ ? `\"${ toolSystemPrompt } \"`
450
+ : defaultSystemPrompt ;
448
451
449
- const systemPromptEnv = [
450
- {
452
+ systemPromptEnv . push ( {
451
453
name : "SYSTEM_PROMPT" ,
452
454
description : "The system prompt for the AI model." ,
453
455
value : systemPrompt ,
454
- } ,
455
- ] ;
456
-
456
+ } ) ;
457
+ }
457
458
if ( tools ?. length == 0 && ( dataSources ?. length ?? 0 > 0 ) ) {
458
459
const citationPrompt = `'You have provided information from a knowledge base that has been passed to you in nodes of information.
459
460
Each node has useful metadata such as node ID, file name, page, etc.
@@ -559,7 +560,7 @@ export const createBackendEnvFile = async (
559
560
...getToolEnvs ( opts . tools ) ,
560
561
...getTemplateEnvs ( opts . template ) ,
561
562
...getObservabilityEnvs ( opts . observability ) ,
562
- ...getSystemPromptEnv ( opts . tools , opts . dataSources , opts . framework ) ,
563
+ ...getSystemPromptEnv ( opts . tools , opts . dataSources , opts . template ) ,
563
564
] ;
564
565
// Render and write env file
565
566
const content = renderEnvVar ( envVars ) ;
0 commit comments