langchain
langchain copied to clipboard
core: Add `TypeError` handler into `get_graph` of `Runnable`
Description
Problem
Runnable.get_graph fails when InputType or OutputType property raises TypeError.
- https://github.com/langchain-ai/langchain/tree/003c98e5b440a420d8dbd5f9fdea08888a4a5a33/libs/core/langchain_core/runnables/base.py#L250-L274
- https://github.com/langchain-ai/langchain/tree/003c98e5b440a420d8dbd5f9fdea08888a4a5a33/libs/core/langchain_core/runnables/base.py#L394-L396
This problem prevents getting a graph of Runnable objects whose InputType or OutputType property raises TypeError but whose invoke works well, such as langchain.output_parsers.RegexParser, which I have already pointed out in #19792 that a TypeError would occur.
Solution
- Add
try-exceptsyntax to handleTypeErrorto the codes which getinput_nodeandoutput_node.
Issue
- #19801
Twitter Handle
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| langchain | ⬜️ Ignored (Inspect) | Visit Preview | May 27, 2024 9:30pm |
cc @nfcampos
@baskaryan @efriis @eyurtsev @ccurme @vbarda @hwchase17 Could anyone review this PR?