langchain-ai/langchain-google
在 GitHub 查看Attempting to use pydantic models as tool args causes `ParseError` in `ChatVertexAI`
Open
#1,076 建立於 2025年8月5日
help wantedvertexai
倉庫指標
- Star
- (392 star)
- PR 合併指標
- (PR 指標待抓取)
描述
Example Pydantic schema:
class IntOrFloat(BaseModel):
"""A type that can be either an int or a float."""
number: int | float
and tool:
@tool
def add(a: IntOrFloat, b: IntOrFloat) -> IntOrFloat:
"""Adds a and b."""
return IntOrFloat(number=a.number + b.number)
Attempting to use this tool in a tool-calling agent with ChatVertexAI causes the following error:
ParseError: Failed to parse properties field: Failed to parse properties field: Failed to parse anyOf field: Failed to parse type field: Invalid enum value integer for enum type google.cloud.aiplatform.v1beta1.Type at Schema.properties[a].properties[number].anyOf[0].type....