Skip to content

If schema doesn't support examples it loops forever (e.g. gemini2) #43

@KadekM

Description

@KadekM

If model doesn't support examples in schema it dies

Image


APIError('litellm.BadRequestError: VertexAIException BadRequestError - b\'{\\n  "error": {\\n    "code": 400,\\n    "message": 
"Invalid JSON payload received. Unknown name \\\\"examples\\\\" at 
\\\'tools[0].function_declarations[0].parameters.properties[2].value.items\\\': Cannot find field.",\\n    "status": 
"INVALID_ARGUMENT",\\n    "details": [\\n      {\\n        "@type": "type.googleapis.com/google.rpc.BadRequest",\\n        
"fieldViolations": [\\n          {\\n            "field": "tools[0].function_declarations[0].parameters.properties[2].value.items",\\n          
  "description": "Invalid JSON payload received. Unknown name \\\\"examples\\\\" at 
\\\'tools[0].function_declarations[0].parameters.properties[2].value.items\\\': Cannot find field."\\n          }\\n        ]\\n      }\\n    ]\\n  
}\\n}\\n\'')Traceback (most recent call last):

same code works with

ChatOpenAI(model="gpt-4o"

but doesnt work with gemini2.

class Profile(BaseModel):
    name: Optional[str] = Field(description="The name of the person", default=None)

profile_extractor = create_extractor(
    llm=llm,
    tools=[Profile],
    tool_choice="Profile"
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions