0

I did follow the instructions for solving this based on How to add conversational memory to pandas toolkit agent?

llm_code = ChatOpenAI(temperature=0, model_name="gpt-4-0613")
llm_context = ChatOpenAI(temperature=0.5, model_name="gpt-4")

chat_history_buffer = ConversationBufferWindowMemory(
    k=5,
    memory_key="chat_history_buffer",
    input_key="input"
    )

chat_history_summary = ConversationSummaryMemory(
    llm=llm_context, 
    memory_key="chat_history_summary",
    input_key="input"
    )

chat_history_KG = ConversationKGMemory(
    llm=llm_context, 
    memory_key="chat_history_KG",
    input_key="input",
    )

memory = CombinedMemory(memories=[chat_history_buffer, chat_history_summary, chat_history_KG])

pd_agent = create_pandas_dataframe_agent(
    llm_code, 
    df, 
    verbose=True, 
    agent_executor_kwargs={"memory": memory},
    input_variables=['df_head', 'input', 'agent_scratchpad', 'chat_history_buffer', 'chat_history_summary', 'chat_history_KG']
    )

I did make changes in the prompt.py file in \Anaconda\envs\Chatbot\Lib\site-packages\langchain\agents\agent_toolkits path as well.

However I'm getting error like

ValidationError: 1 validation error for PromptTemplate root Invalid prompt schema; check for mismatched or missing input parameters. {'chat_history_summary', 'chat_history_KG', 'chat_history_buffer'} (type=value_error)

I tried instructions from https://stackoverflow.com/questions/76500981/how-to-add-conversational-memory-to-pandas-toolkit-agent/76562847#76562847?newreg=642b517976bc489a8bb63e968bb7ca6a

0 Answers0