mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-04 23:19:17 +08:00
feat: 在OpenAI chat服务中,适配googleSearch内置工具调用支持
This commit is contained in:
@@ -83,8 +83,13 @@ def _build_tools(
|
|||||||
names, functions = set(), []
|
names, functions = set(), []
|
||||||
for fc in function_declarations:
|
for fc in function_declarations:
|
||||||
if fc.get("name") not in names:
|
if fc.get("name") not in names:
|
||||||
names.add(fc.get("name"))
|
if fc.get("name")=="googleSearch":
|
||||||
functions.append(fc)
|
# cherry开启内置搜索时,添加googleSearch工具
|
||||||
|
tool["googleSearch"] = {}
|
||||||
|
else:
|
||||||
|
# 其他函数,添加到functionDeclarations中
|
||||||
|
names.add(fc.get("name"))
|
||||||
|
functions.append(fc)
|
||||||
|
|
||||||
tool["functionDeclarations"] = functions
|
tool["functionDeclarations"] = functions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user