-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Open
Labels
Description
Checked other resources
- This is a bug, not a usage question.
- I added a clear and descriptive title that summarizes this issue.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
- This is not related to the langchain-community package.
- I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.
Package (Required)
- langchain
Related Issues / PRs
Reproduction Steps / Example Code (Python)
from langchain.chains import LLMChain
from langchain_core.prompts import PromptTemplate
from langchain_community.llms.fake import FakeListLLM
llm = FakeListLLM(responses=["hello"])
prompt = PromptTemplate(input_variables=["input"], template="{input}")
chain = LLMChain(llm=llm, prompt=prompt)
chain.save("/tmp/test_chain.yaml") # Works on 0.3.27, fails on 0.3.28Error Message and Stack Trace
Traceback (most recent call last):
File "<string>", line 9, in <module>
File "langchain/chains/base.py", line 785, in save
raise NotImplementedError(msg)
NotImplementedError: Chain verbose=False prompt=PromptTemplate(input_variables=['input'], input_types={}, partial_variables={}, template='{input}') llm=FakeListLLM(responses=['hello']) output_parser=StrOutputParser() llm_kwargs={} does not support saving.
Description
- fix: update method calls from dict to
model_dumpinChain#33035 changedChain.save()fromself.dict()toself.model_dump(). dict()injects_typevia_chain_type;model_dump()inherits from Pydantic BaseModel and never includes it.save()now always hits"_type" not in chain_dictand raisesNotImplementedError.- This is a regression from 0.3.27 -> 0.3.28.
System Info
> langchain_core: 0.3.83
> langchain: 0.3.28
> langchain_community: 0.3.31
> Python Version: 3.10.17
> OS: Darwin
Reactions are currently unavailable