-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds pydantic v2 support to LangServe. With pydantic v2 all endpoints will work, but openapi docs will not be generated for these endpoints. (At least at the moment.) --------- Co-authored-by: jakerachleff <[email protected]>
- Loading branch information
1 parent
2f8d046
commit 0dd55c8
Showing
7 changed files
with
272 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import pydantic | ||
|
||
|
||
def _get_pydantic_version() -> int: | ||
"""Get the pydantic major version.""" | ||
return int(pydantic.__version__.split(".")[0]) | ||
|
||
|
||
# Code is written to support both version 1 and 2 | ||
PYDANTIC_MAJOR_VERSION = _get_pydantic_version() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.