Open antti-ngp opened 1 month ago
any updates on this issue ? I am facing similar issue
add a type in the Field works for me:
class MyOutput(BaseModel):
my_field: MyEnum = Field(...,description="This is my field", type="string")
add a type in the Field works for me:
class MyOutput(BaseModel): my_field: MyEnum = Field(...,description="This is my field", type="string")
Did you actually try this? At least with
langchain==0.2.1
langchain-core==0.2.2
langchain-google-vertexai==1.0.5
this
class MyOutput(BaseModel):
my_field: MyEnum = Field(...,description="This is my field", type="string")
results in the exact same error.
The problem seems to be the Field()
definition as it results in the allOf
key being added to the json schema. With just:
class MyOutput(BaseModel):
my_field: MyEnum
it works, but then I need some other way to instruct the LLM what to do with this field.
add a type in the Field works for me:
class MyOutput(BaseModel): my_field: MyEnum = Field(...,description="This is my field", type="string")
Did you actually try this? At least with
langchain==0.2.1 langchain-core==0.2.2 langchain-google-vertexai==1.0.5
this
class MyOutput(BaseModel): my_field: MyEnum = Field(...,description="This is my field", type="string")
results in the exact same error.
The problem seems to be the
Field()
definition as it results in theallOf
key being added to the json schema. With just:class MyOutput(BaseModel): my_field: MyEnum
it works, but then I need some other way to instruct the LLM what to do with this field.
Oh, I see. Currently I am having the same issue.
There's something wrong with the json schema parsing when trying to extract structured output with
ChatVertexAI
.Steps to reproduce:
Expected result: the tool definitions should parse
allOf
properly Actual result:allOf
is ignored and the result is a broken schema that fails to be invoked.With
ChatOpenAI
this works as expected: