Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

refactor(OpenAPIPlugin): add plugin prompt inspired by ChatGPT Invocator (#1023)

Danny Avilad61e44742dd8
diff --git a/api/app/clients/tools/dynamic/OpenAPIPlugin.js b/api/app/clients/tools/dynamic/OpenAPIPlugin.js
index dcb60bbed7..be2798179c 100644
--- a/api/app/clients/tools/dynamic/OpenAPIPlugin.js
+++ b/api/app/clients/tools/dynamic/OpenAPIPlugin.js
@@ -20,8 +20,8 @@ function createPrompt(name, functions) {
.map((func) => `// - ${func.name}: ${func.description}`)
.join('\n');
return `${prefix}\n${functionDescriptions}
-// The user's message will be passed as the function's query.
-// Always provide the function name as such: {{"func": "function_name"}}`;
+// You are an expert manager and scrum master. You must provide a detailed intent to better execute the function.
+// Always format as such: {{"func": "function_name", "intent": "intent and expected result"}}`;
}
const AuthBearer = z
@@ -162,12 +162,16 @@ async function createOpenAPIPlugin({ data, llm, user, message, memory, signal, v
.map((func) => func.name)
.join(', ')}`,
),
+ intent: z
+ .string()
+ .describe('Describe your intent with the function and your expected result'),
}),
- func: async ({ func = '' }) => {
+ func: async ({ func = '', intent = '' }) => {
const filteredFunctions = functions.filter((f) => f.name === func);
chain.chains[0].lc_kwargs.llmKwargs.functions = filteredFunctions;
+ const query = `${message}${func?.length > 0 ? `\n// Intent: ${intent}` : ''}`;
const result = await chain.call({
- query: `${message}${func?.length > 0 ? `\nUse ${func}` : ''}`,
+ query,
signal,
});
return result.response;
diff --git a/bun.lockb b/bun.lockb
index 25e95fde8b..1e71e31ce8 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index bcefff41da..3a9578c8eb 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
"lint": "eslint \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
"format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
"b:api": "NODE_ENV=production bun run api/server/index.js",
- "b:api:dev": "NODE_ENV=development bun run --watch api/server/index.js",
+ "b:api:dev": "NODE_ENV=production bun run --watch api/server/index.js",
"b:data-provider": "cd packages/data-provider && bun run b:build",
"b:client": "bun --bun run b:data-provider && cd client && bun --bun run b:build",
"b:client:dev": "cd client && bun run b:dev",