python - `ConversationSummaryBufferMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryBu

I am attempting to use LangChain's ConversationSummaryBufferMemory and running into this error:py

I am attempting to use LangChain's ConversationSummaryBufferMemory and running into this error:

pydantic.errors.PydanticUserError: `ConversationSummaryBufferMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryBufferMemory.model_rebuild()`.

This is what my code looks like:

memory = ConversationSummaryBufferMemory(
    llm=llm,
    input_key="input",
    output_key="output",
    max_token_limit=args.get("max_tokens", DEFAULT_MAX_TOKENS),
    memory_key="chat_history",
)

I am using langchain==0.3.7.

Has anyone else encountered this?

I am attempting to use LangChain's ConversationSummaryBufferMemory and running into this error:

pydantic.errors.PydanticUserError: `ConversationSummaryBufferMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryBufferMemory.model_rebuild()`.

This is what my code looks like:

memory = ConversationSummaryBufferMemory(
    llm=llm,
    input_key="input",
    output_key="output",
    max_token_limit=args.get("max_tokens", DEFAULT_MAX_TOKENS),
    memory_key="chat_history",
)

I am using langchain==0.3.7.

Has anyone else encountered this?

Share Improve this question asked Nov 21, 2024 at 5:29 Minura PunchihewaMinura Punchihewa 2,0413 gold badges26 silver badges67 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

pydantic library has been updated. pip install pydantic==2.9.2 should help

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742312353a4420150.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信