feat: 在OpenAI chat服务中,适配googleSearch内置工具调用支持

This commit is contained in:
Nalvick
2025-05-23 23:45:03 +08:00
parent b3a4306332
commit e37e11bf57

View File

@@ -83,8 +83,13 @@ def _build_tools(
names, functions = set(), []
for fc in function_declarations:
if fc.get("name") not in names:
names.add(fc.get("name"))
functions.append(fc)
if fc.get("name")=="googleSearch":
# cherry开启内置搜索时添加googleSearch工具
tool["googleSearch"] = {}
else:
# 其他函数添加到functionDeclarations中
names.add(fc.get("name"))
functions.append(fc)
tool["functionDeclarations"] = functions