MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / actionFilteringPrompt

Function actionFilteringPrompt

lib/v2/prompts/actionFiltering.ts:5–53  ·  view source on GitHub ↗
(args: {
  userRequest: string;
  actionDescriptions: string[];
  orgName: string;
})

Source from the content-addressed store, hash-verified

3import { snakeToCamel } from "../../utils";
4
5export 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
22Below 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
29RULES:
301. 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.
312. NEVER write code or pseudocode
323. STOP WRITING after the selected functions list
334. ${
34 containsDocs
35 ? ""
36 : `CONSIDER whether ${searchDocsActionName} is relevant\n5. `
37 }Respond in the following format (Thoughts as numbered list):
38\`\`\`
39Thoughts:
401. Think step-by-step how to use the functions to answer the user's request
412. break down the user's request into steps in extreme detail
423. specifically name EVERY SINGLE function and variable you will use
434. 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
45Selected functions:
46selected_function_1
47selected_function_2
48\`\`\`
49
50User's request: ${args.userRequest}`,
51 },
52 ];
53}
54
55export interface ActionFilteringOutput {
56 thoughts: string;

Callers 1

filterActionsFunction · 0.90

Calls 1

snakeToCamelFunction · 0.90

Tested by

no test coverage detected