mirror of
https://github.com/langchain-ai/langserve.git
synced 2026-07-21 00:55:22 -04:00
batch endpoint triggers PydanticUserError due to List[config] in dynamic model creation #248
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @k1dav on GitHub (May 19, 2025).
I'm encountering an error when enabling the batch endpoint using the add_routes function with a dynamically created batch request model.
Here is a minimal reproducible example:
When the batch endpoint is included, I get the following error:
I traced it to the following code in langserve/validation.py:
Temporary workaround:
If I remove the List[config] from the Union in the config field and just use config, everything works fine. So it seems the dynamic create_model doesn’t correctly handle List[config] in this context.
Thanks in advance!
Requirements
@DhavalThkkar commented on GitHub (May 21, 2025):
All of a sudden this popped up
@rsradulescu commented on GitHub (May 21, 2025):
We found similar error trying to show openapi docs and was fixed when we downgrade to pydantic==2.10.6
@officialgoat commented on GitHub (Jul 7, 2025):
"LangServe>=0.3 fully supports Pydantic 2."
This issue is open for a while now, and no reaction.