( userDescriptionSection: string, orgInfo: Pick<Organization, "name" | "description" | "chatbot_instructions">, numberedActions: string, language: string | null, includeIdUrlLine: boolean, )
| 287 | } |
| 288 | |
| 289 | function systemPromptWithActions( |
| 290 | userDescriptionSection: string, |
| 291 | orgInfo: Pick<Organization, "name" | "description" | "chatbot_instructions">, |
| 292 | numberedActions: string, |
| 293 | language: string | null, |
| 294 | includeIdUrlLine: boolean, |
| 295 | ): ChatGPTMessage { |
| 296 | return { |
| 297 | role: "system", |
| 298 | content: `${getIntroText(orgInfo)} Your purpose is to assist users ${ |
| 299 | orgInfo.name ? `in ${orgInfo.name} ` : "" |
| 300 | }via function calls |
| 301 | ${ |
| 302 | orgInfo.chatbot_instructions ? `\n${orgInfo.chatbot_instructions}\n` : "" |
| 303 | }${userDescriptionSection} |
| 304 | Today's date is ${new Date().toISOString().split("T")[0]} |
| 305 | |
| 306 | You MUST exclusively use the functions listed below in the "Commands" output. THIS IS VERY IMPORTANT! DO NOT FORGET THIS! |
| 307 | These are formatted with {{NAME}}: {{DESCRIPTION}}. PARAMETERS: {{PARAMETERS}}. Each parameter is formatted like: "- {{NAME}} ({{DATATYPE}}: [{{POSSIBLE_VALUES}}]): {{DESCRIPTION}}. {{"REQUIRED" if parameter required}}" |
| 308 | \`\`\` |
| 309 | ${numberedActions}\`\`\` |
| 310 | ${ |
| 311 | includeIdUrlLine |
| 312 | ? "\nIDs and URLs from function calls have been replaced by variables IDX or URLY (where X and Y are numbers). Use IDX or URLY as you would use the URLs and IDs they represent\n" |
| 313 | : "" |
| 314 | } |
| 315 | RULES: |
| 316 | 1. Seek user assistance when necessary or more information is required |
| 317 | 2. Avoid directing users, instead complete tasks by outputting "Commands" |
| 318 | 3. To use the output from a previous command in a later command, stop outputting commands - don't output the later command. If you output a command, you will be prompted again once it returns |
| 319 | 4. Aim to complete the task in the smallest number of steps possible. Be extremely concise in your responses |
| 320 | 5. Don't copy the function outputs in full when explaining to the user, instead summarise it as concisely as you can - the user can ask follow-ups if they need more information |
| 321 | 6. Think and talk to the user in ${ |
| 322 | language ?? "the same language they write in" |
| 323 | }${ |
| 324 | language !== "English" |
| 325 | ? ". This should ONLY affect the 'Tell user' output. NOT the reasoning or commands. And DO NOT translate the keywords: Reasoning, Tell user or Commands." |
| 326 | : "" |
| 327 | } |
| 328 | 7. Respond in the format below. Start with your reasoning (a numbered list), anything to tell the user, then any commands (you can call multiple, separate with a newline). Each section is optional - only output it if you need to. THIS IS VERY IMPORTANT! DO NOT FORGET THIS! |
| 329 | \`\`\` |
| 330 | Reasoning: |
| 331 | 1. Think step-by-step about how to achieve the user's request |
| 332 | 2. Does this require plotting, calculations or looping through data? If so, use ${dataAnalysisActionName} |
| 333 | 3. This is only for your benefit - it is hidden from the user |
| 334 | |
| 335 | Tell user: tell the user something. If you need to ask the user a question, do so here. |
| 336 | |
| 337 | Commands: |
| 338 | FUNCTION_1(PARAM_1=VALUE_1, PARAM_2=VALUE_2, ...) |
| 339 | FUNCTION_2(PARAM_3=VALUE_3 ...) |
| 340 | \`\`\``, |
| 341 | }; |
| 342 | } |
no test coverage detected