I have a chatbot developed using langchain and streamlit. When I run it, it loads perfectly but as soon as I enter the first input it generates an error saying ** "ValueError: One input key expected got ['input', 'agent_scratchpad']" ** All I want to do is add the response into the memory. Can anyone suggest what I'm doing wrong in here.
My code looks as below. It's using langchain and steamlit
prompt = ZeroShotAgent.create_prompt(
tools,
prefix=template,
suffix=suffix,
input_variables=["input", "chat_history", "agent_scratchpad"]
)
memory = ConversationBufferMemory(memory_key="chat_history")
llm_chain = LLMChain(llm=OpenAI(temperature=0), prompt=prompt,memory=memory)
agent = ZeroShotAgent(llm_chain=llm_chain, tools=tools, verbose=True,return_intermediate_steps=True)
with textcontainer:
query = st.text_input("Query: ", key="input")
if query:
with st.spinner("typing..."):
conversation_string = get_conversation_string()
agent_executor = AgentExecutor.from_agent_and_tools(agent=agent, tools=tools, memory=memory)
response = agent_executor.run(input=query)
agent_executor.verbose = True
st.session_state.requests.append(query)
st.session_state.responses.append(str(response))