-
Notifications
You must be signed in to change notification settings - Fork 16k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add example using
TypedDict
in structured outputs how-to guide (
#27415) For me, the [Pydantic example](https://python.langchain.com/docs/how_to/structured_output/#choosing-between-multiple-schemas) does not work (tested on various Python versions from 3.10 to 3.12, and `Pydantic` versions from 2.7 to 2.9). The `TypedDict` example (added in this PR) does. ---- Additionally, fixed an error in [Using PydanticOutputParser example](https://python.langchain.com/docs/how_to/structured_output/#using-pydanticoutputparser). Was: ```python query = "Anna is 23 years old and she is 6 feet tall" print(prompt.invoke(query).to_string()) ``` Corrected to: ```python query = "Anna is 23 years old and she is 6 feet tall" print(prompt.invoke({"query": query}).to_string()) ``` --------- Co-authored-by: Eugene Yurtsev <[email protected]>
- Loading branch information
1 parent
3e972fa
commit 2ab5673
Showing
1 changed file
with
114 additions
and
29 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