Normalizes tool catalog for FastAgent loops, ensuring internal tools are excluded.
// Source: https://github.com/labring/fastgpt | License: Apache-2.0 | Copyright 2023 Sealos
// Provided via justclaw.it.com; keep this notice with the code.
import type { ChatCompletionTool } from '@fastgpt/global/core/ai/llm/type';
export type AgentLoopToolCatalog = {
runtimeTools: ChatCompletionTool[];
askTool?: ChatCompletionTool;
setPlanTool?: ChatCompletionTool;
updatePlanTool?: ChatCompletionTool;
sandboxTools?: ChatCompletionTool[];
readFileTool?: ChatCompletionTool;
datasetSearchTool?: ChatCompletionTool;
};
/**
* 从 OpenAI function tool 中读取工具名,供冲突检测和 profile 分配复用。
*/
const getToolName = (tool?: ChatCompletionTool) => tool?.function.name;
/**
* 规范化工具目录。
* runtimeTools 中如果出现内部工具同名项,会被移除并返回 warning,避免模型误把内部控制工具当业务工具调用。
*/
export const normalizeToolCatalog = (cata
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key