--- 更新时间: "2026-11-19" 版本: "2026.11.19.1" --- # 基础平台工具定义(8 个) 这些是**被创建智能体的配置数据**,不是 CocoBuddy 可调用工具。只选老师明确要求的子集,不改写必需参数结构。 平台名称对应:图片生成 → `get_dalle_image`;语音生成 → `get_tts_voice`;Bing 搜索 → `get_bing_search`;B站视频搜索 → `get_bilibili_video`;网页爬取 → `scrape_with_playwright`;图片搜索 → `get_image_search`;获取时间 → `get_current_time`;天气查询 → `get_weather`。 选 GPT 系模型,或要出题、解题、口语评分、Google/YouTube 搜索时,本清单不够用,改用 `cocoflow-agent-create/references/tools.md` 的 13 个工具清单重算。 ```json [ { "type": "function", "function": { "name": "get_dalle_image", "description": "根据传入的prompt生成图片.", "parameters": { "type": "object", "properties": { "prompt": { "type": "string", "description": "Prompt of DALL-E 3." } }, "required": [ "prompt" ] } } }, { "type": "function", "function": { "name": "get_tts_voice", "description": "根据传入的prompt生成语音.", "parameters": { "type": "object", "properties": { "prompt": { "type": "string", "description": "Prompt of Text-to-speech 1 HD." } }, "required": [ "prompt" ] } } }, { "type": "function", "function": { "name": "get_bing_search", "description": "这是一个Bing搜索搜索工具,当我需要查询或者搜索时可以用到它", "parameters": { "type": "object", "properties": { "prompt": { "type": "string", "description": "这是搜索的参数" } }, "required": [ "prompt" ] } } }, { "type": "function", "function": { "name": "get_bilibili_video", "description": "这是一个bilibili视频搜索工具,当我需要查询或者搜索时可以用到它", "parameters": { "type": "object", "properties": { "prompt": { "type": "string", "description": "这是搜索的参数" } }, "required": [ "prompt" ] } } }, { "type": "function", "function": { "name": "scrape_with_playwright", "description": "这是一个网页爬取工具,当我需要网页爬取时可以用到它", "parameters": { "type": "object", "properties": { "url": { "type": "string", "description": "url of Crawl web page." } }, "required": [ "url" ] } } }, { "type": "function", "function": { "name": "get_image_search", "description": "这是一个图片搜索工具,当我需要查询或者搜索时可以用到它,每次调用,只允许触发一次", "parameters": { "type": "object", "properties": { "prompt": { "type": "string", "description": "这是搜索的参数" } }, "required": [ "prompt" ] } } }, { "type": "function", "function": { "name": "get_current_time", "description": "这是一个获取当前时间的工具,可以获取当前的日期和时间", "parameters": { "type": "object", "properties": {}, "required": [] } } }, { "type": "function", "function": { "name": "get_weather", "description": "这是一个天气查询工具,可以查询指定城市的天气情况", "parameters": { "type": "object", "properties": { "city": { "type": "string", "description": "要查询天气的城市名称" } }, "required": [ "city" ] } } } ] ``` ## 组装 PUT 的三个字段 设选中的完整定义数组为 `F`,用同一数组生成三个字段;`functionNames` 非空时保留末尾逗号: ```js const functionNames = F.length ? F.map(x => x.function.name).join(",") + "," : ""; const functionContents = JSON.stringify(F); // 基座随模型族:GPT 系 = file_search + code_interpreter;含 own = pdf_extracter + code_interpreter;其余 = file_search const base = /gpt/i.test(modelType) ? [{ type: "file_search" }, { type: "code_interpreter" }] : modelType.includes("own") ? [{ type: "pdf_extracter" }, { type: "code_interpreter" }] : [{ type: "file_search" }]; const tools = [...base, ...F]; ``` 按结果替换 PUT 的对应字段,只发送最终方案,不先全选再取消。 ## 回读时怎么核对 服务器会规范化工具描述,并可能补充 `language`、`timezone` 等可选参数。解析返回的 `functionContents`,检查: - 工具名称集合与 `functionNames` 一致; - 必需参数及类型仍存在; - 没有多出未选择的工具。 不要因描述或可选参数有兼容差异而循环 PUT。配置保存不证明图片、语音、搜索等实际调用成功,也不证明其他模型支持这些工具。