LangChain needs to improve its type system #32801
AndreuCodina
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've created this LLM call to show the big problem LangChain has: https://github.com/AndreuCodina/langchain-type-checking/blob/main/main.py
Using LangChain I'd expected not to receive errors from Pyright or Ruff, or not to have to annotate myself the variable types, but it's not the case. Instead, I have to:
# type: ignore[reportUnknownVariableType]
twice.if TYPE_CHECKING
.I really love LangChain, but basic usage feels very complicated.
Regarding the documentation, it's plenty of examples (e.g., passing a list of messages) that don't pass the type checker.
About the types like temperature, I think they should be
StrictFloat
instead offloat
.Note: I'm using Pydantic models instead of hardcoding the keys. It's another thing LangChain should improve.
Beta Was this translation helpful? Give feedback.
All reactions