forked from phoenix/litellm-mirror
fix gemini test
This commit is contained in:
parent
3dc578555c
commit
4707c4fccd
1 changed files with 8 additions and 1 deletions
|
@ -183,10 +183,17 @@ class GoogleAIStudioGeminiConfig: # key diff from VertexAI - 'frequency_penalty
|
||||||
if param == "tools" and isinstance(value, list):
|
if param == "tools" and isinstance(value, list):
|
||||||
gtool_func_declarations = []
|
gtool_func_declarations = []
|
||||||
for tool in value:
|
for tool in value:
|
||||||
|
_parameters = tool.get("function", {}).get("parameters", {})
|
||||||
|
_properties = _parameters.get("properties", {})
|
||||||
|
if isinstance(_properties, dict):
|
||||||
|
for _, _property in _properties.items():
|
||||||
|
if "enum" in _property and "format" not in _property:
|
||||||
|
_property["format"] = "enum"
|
||||||
|
|
||||||
gtool_func_declaration = FunctionDeclaration(
|
gtool_func_declaration = FunctionDeclaration(
|
||||||
name=tool["function"]["name"],
|
name=tool["function"]["name"],
|
||||||
description=tool["function"].get("description", ""),
|
description=tool["function"].get("description", ""),
|
||||||
parameters=tool["function"].get("parameters", {}),
|
parameters=_parameters,
|
||||||
)
|
)
|
||||||
gtool_func_declarations.append(gtool_func_declaration)
|
gtool_func_declarations.append(gtool_func_declaration)
|
||||||
optional_params["tools"] = [
|
optional_params["tools"] = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue