mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 01:41:25 -06:00
chore: update filtered schema parameters for Gemini API.
PiperOrigin-RevId: 762209590
This commit is contained in:
parent
d3910e7b8c
commit
0026edc1c9
@ -41,6 +41,16 @@ from .openapi_spec_parser import ParsedOperation
|
|||||||
from .operation_parser import OperationParser
|
from .operation_parser import OperationParser
|
||||||
from .tool_auth_handler import ToolAuthHandler
|
from .tool_auth_handler import ToolAuthHandler
|
||||||
|
|
||||||
|
# Not supported by the Gemini API
|
||||||
|
_OPENAPI_SCHEMA_IGNORE_FIELDS = (
|
||||||
|
"title",
|
||||||
|
"default",
|
||||||
|
"format",
|
||||||
|
"additional_properties",
|
||||||
|
"ref",
|
||||||
|
"def"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def snake_to_lower_camel(snake_case_string: str):
|
def snake_to_lower_camel(snake_case_string: str):
|
||||||
"""Converts a snake_case string to a lower_camel_case string.
|
"""Converts a snake_case string to a lower_camel_case string.
|
||||||
@ -121,7 +131,7 @@ def to_gemini_schema(openapi_schema: Optional[Dict[str, Any]] = None) -> Schema:
|
|||||||
snake_case_key = to_snake_case(key)
|
snake_case_key = to_snake_case(key)
|
||||||
# Check if the snake_case_key exists in the Schema model's fields.
|
# Check if the snake_case_key exists in the Schema model's fields.
|
||||||
if snake_case_key in Schema.model_fields:
|
if snake_case_key in Schema.model_fields:
|
||||||
if snake_case_key in ["title", "default", "format"]:
|
if snake_case_key in _OPENAPI_SCHEMA_IGNORE_FIELDS:
|
||||||
# Ignore these fields as Gemini backend doesn't recognize them, and will
|
# Ignore these fields as Gemini backend doesn't recognize them, and will
|
||||||
# throw exception if they appear in the schema.
|
# throw exception if they appear in the schema.
|
||||||
# Format: properties[expiration].format: only 'enum' and 'date-time' are
|
# Format: properties[expiration].format: only 'enum' and 'date-time' are
|
||||||
|
Loading…
Reference in New Issue
Block a user