Reputation: 2132
I want to create an Agent that will have 2 tools and a combined memory.
python_reply_tool
and my custom tool
search_documents
.initialize_agent()
functionI have successfully created an example of combined memory: llm_code = ChatOpenAI(temperature=0, model_name="gpt-4-0613") #gpt-3.5-turbo-16k-0613 llm_context = ChatOpenAI(temperature=0.5, model_name="gpt-4") #gpt-3.5-turbo
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])
How do I now pass this memory to the agent?
I tried via the memory = memory
but without success.
Do I need to change the template somehow?
Upvotes: 1
Views: 629
Reputation: 1
Implement the code in below given url and you will be good to go.
BUT, do tell in reply by testing it that if it works for your chatgpt llm ? , because I am using google's flan-t5-large llm and I am getting some weird loop when I enter my text prompt.
https://python.langchain.com/docs/modules/agents/how_to/sharedmemory_for_tools
Upvotes: 0