You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am a LangChain maintainer, or was asked directly by a LangChain maintainer to create an issue here.
Issue Content
Run time validation with pydantic schema does not work with output schema.
fromlanggraph.graphimportStateGraph, START, ENDfromtyping_extensionsimportTypedDictfrompydanticimportBaseModel# The overall state of the graph (this is the public state shared across nodes)classOverallState(BaseModel):
a: floatdefnode_1(state: OverallState) ->OverallState:
return {
"a": "foo"
}
# Build the state graphbuilder=StateGraph(OverallState, output=OverallState)
builder.add_node(node_1) # node_1 is the first nodebuilder.add_edge(START, "node_1") # Start the graph with node_1builder.add_edge("node_1", END) # End the graph after node_1graph=builder.compile()
graph.invoke(
{
"a": 2.3
}
)
Result
{'a': 'foo'}
This result does not match the output schema!
Expected
Expected a validation error
The text was updated successfully, but these errors were encountered:
eyurtsev
changed the title
Surprising results when using pydantic for state
Surprising results when using pydantic for output state
Oct 2, 2024
eyurtsev
changed the title
Surprising results when using pydantic for output state
Surprising results when using pydantic for state (output is not a pydantic instance)
Oct 2, 2024
eyurtsev
changed the title
Surprising results when using pydantic for state (output is not a pydantic instance)
Surprising results when using pydantic for state schema
Oct 2, 2024
Privileged issue
Issue Content
Run time validation with pydantic schema does not work with output schema.
Result
This result does not match the output schema!
Expected
Expected a validation error
The text was updated successfully, but these errors were encountered: