langchain
bbd7015b - core[patch]: Add `TypeError` handler into `get_graph` of `Runnable` (#19856)

Commit
1 year ago
core[patch]: Add `TypeError` handler into `get_graph` of `Runnable` (#19856) # 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-except` syntax to handle `TypeError` to the codes which get `input_node` and `output_node`. # Issue - #19801 # Twitter Handle - [hmdev3](https://twitter.com/hmdev3) --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
Author
Parents
Loading