(args: {
userRequest: string;
actionDescriptions: string[];
orgName: string;
})
| 3 | import { snakeToCamel } from "../../utils"; |
| 4 | |
| 5 | export function actionFilteringPrompt(args: { |
| 6 | userRequest: string; |
| 7 | actionDescriptions: string[]; |
| 8 | orgName: string; |
| 9 | }): ChatGPTMessage[] { |
| 10 | const containsDocs = args.actionDescriptions.some((a) => |
| 11 | a.includes(snakeToCamel(searchDocsActionName)), |
| 12 | ); |
| 13 | return [ |
| 14 | { |
| 15 | role: "system", |
| 16 | content: `You are ${ |
| 17 | args.orgName || "a" |
| 18 | } chatbot AI. Your task is to select functions that can be used to answer a user's request. A developer will use these to write code to answer the user's request${ |
| 19 | !containsDocs ? "" : " or write the answer based on the relevant docs" |
| 20 | } |
| 21 | |
| 22 | Below are all ${ |
| 23 | args.actionDescriptions.length |
| 24 | } functions. You MUST ONLY select from these |
| 25 | \`\`\` |
| 26 | ${args.actionDescriptions.map((a, idx) => `${idx + 1}. ${a}`).join("\n")} |
| 27 | \`\`\` |
| 28 | |
| 29 | RULES: |
| 30 | 1. Select the functions needed to fulfill the user's request by writing them as a list under 'Selected functions'. Leave it empty if none are relevant or the user's request isn't possible. If the user's request is unclear, also leave it empty. |
| 31 | 2. NEVER write code or pseudocode |
| 32 | 3. STOP WRITING after the selected functions list |
| 33 | 4. ${ |
| 34 | containsDocs |
| 35 | ? "" |
| 36 | : `CONSIDER whether ${searchDocsActionName} is relevant\n5. ` |
| 37 | }Respond in the following format (Thoughts as numbered list): |
| 38 | \`\`\` |
| 39 | Thoughts: |
| 40 | 1. Think step-by-step how to use the functions to answer the user's request |
| 41 | 2. break down the user's request into steps in extreme detail |
| 42 | 3. specifically name EVERY SINGLE function and variable you will use |
| 43 | 4. specify where you'll get every variable from - you may need to call another function first. THIS IS VERY IMPORTANT. DO NOT FORGET THIS |
| 44 | |
| 45 | Selected functions: |
| 46 | selected_function_1 |
| 47 | selected_function_2 |
| 48 | \`\`\` |
| 49 | |
| 50 | User's request: ${args.userRequest}`, |
| 51 | }, |
| 52 | ]; |
| 53 | } |
| 54 | |
| 55 | export interface ActionFilteringOutput { |
| 56 | thoughts: string; |
no test coverage detected