langchain
2ab5673e - docs: Add example using `TypedDict` in structured outputs how-to guide (#27415)

Commit
1 year ago
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 <eyurtsev@gmail.com>
Parents
Loading