langchain: chain.run doesn't necessarily return a `str`
when I have this:
chain = create_structured_output_chain(Categorization, llm, prompt, verbose=True)
response = chain.run(trx_description)
my response
object is a dict not a str, but I got misled by the type assistance making me think it was a str.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (8 by maintainers)
Commits related to this issue
- Update base chain type hints Addresses #7578. `run()` can return dictionaries, Pydantic objects or strings, so the type hints should reflect that. See the chain from `create_structured_output_chain` ... — committed to stakodiak/langchain by stakodiak a year ago
- Update base chain type hints (#7680) Addresses #7578. `run()` can return dictionaries, Pydantic objects or strings, so the type hints should reflect that. See the chain from `create_structured_outp... — committed to langchain-ai/langchain by stakodiak a year ago
I am a bit too fresh with python I think, I will defer, though I’d normally contribute