langchain icon indicating copy to clipboard operation
langchain copied to clipboard

"Error in on_chain_start callback: 'name'" warning for tutorial "How to add Memory to an LLMChain"

Open labdmitriy opened this issue 1 year ago • 8 comments

System Info

LangChain version: 0.0.198 Platform: Ubuntu 20.04 LTS Python version: 3.10.4

Who can help?

No response

Information

  • [X] The official example notebooks/scripts
  • [ ] My own modified scripts

Related Components

  • [ ] LLMs/Chat Models
  • [ ] Embedding Models
  • [ ] Prompts / Prompt Templates / Prompt Selectors
  • [ ] Output Parsers
  • [ ] Document Loaders
  • [ ] Vector Stores / Retrievers
  • [ ] Memory
  • [ ] Agents / Agent Executors
  • [ ] Tools / Toolkits
  • [X] Chains
  • [ ] Callbacks/Tracing
  • [ ] Async

Reproduction

  1. Reproduce tutorial How to add Memory to an LLMChain
  2. Get the same warning for each invocation of llm_chain.predict(): Error in on_chain_start callback: 'name'
  3. The same warning will be for the following different configurations (only difference from original code is specified): 3.1.llm = ChatOpenAI(temperature=0) 3.2 chain = ConversationChain( memory=memory, verbose=True, prompt=prompt_template, llm=llm, input_key='human_input' ) 3.3 memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True)

Expected behavior

There will be no such warnings (or the actions which resolved it must be specified in warning and/or in documentation).

labdmitriy avatar Jun 13 '23 09:06 labdmitriy

Same problem. Hope not to see any red warning messages either.

tiratano avatar Jun 13 '23 09:06 tiratano

I found that the first version that has this warning is the latest one (0.0.198), before that there were no such warnings.

labdmitriy avatar Jun 13 '23 09:06 labdmitriy

same issue

zzz2016 avatar Jun 13 '23 10:06 zzz2016

This occurs only when verbose is set to True

PierreSylvain avatar Jun 13 '23 10:06 PierreSylvain

Same problem when use AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION

Felliks avatar Jun 13 '23 10:06 Felliks

I use verbose=True and AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION simply because it is demoed in the doc and in fact, I don't know what is happening behind.

lidh15 avatar Jun 14 '23 08:06 lidh15

same issue here as well

rajaniesh avatar Jun 14 '23 23:06 rajaniesh

Since updating to 0.0.200, I have not had any warnings.

tiratano avatar Jun 15 '23 00:06 tiratano

This was an issue with the stdout callback handler that was fixed in v0.0.200

vowelparrot avatar Jun 15 '23 20:06 vowelparrot

It still occurs with verbose=True

langchain version 0.0.207

AndreuCodina avatar Jun 20 '23 20:06 AndreuCodina

add langchain.debug = True when you want to use verbose=True. It can temporally solve the problem, that replace the StdOutCallbackHandler to ConsoleCallbackHandler.

dyllanwli avatar Jun 23 '23 00:06 dyllanwli

I could review a PR fixing StdOutCallbackHandler if that is still broken

vowelparrot avatar Jun 23 '23 09:06 vowelparrot

How should I update? This seems to be the latest. My pip cannot be updated anymore. Can you provide guidance? thanks

CloudDragonGong avatar Jun 29 '23 15:06 CloudDragonGong

I am trying to run the main.py code given for langchain app in the vocode github but the agent is not working well with outbound number.

apoorv-nag avatar Feb 01 '24 10:02 apoorv-nag