langcorn
langcorn copied to clipboard
langchain Agents
Thanks for the great repository. Does langcorn support langchain agents?
I tried to use an Agent. Initially I got an error due to input_key
missing. But I then modified the api file with input_keys. It worked, but I don't know how memory is handled, because the API has a memory input as well
Thx for the feedback @zlapp ! I just added and tested an example agent https://github.com/msoedov/langcorn/blob/main/examples/ex7_agent.py. It works
I tried to use an Agent. Initially I got an error due to
input_key
missing. But I then modified the api file with input_keys. It worked, but I don't know how memory is handled, because the API has a memory input as well
what modifications have you made in api file?
I tried to use an Agent. Initially I got an error due to
input_key
missing. But I then modified the api file with input_keys. It worked, but I don't know how memory is handled, because the API has a memory input as wellwhat modifications have you made in api file?
It was a while ago and just a quick workaround, but this is what I had changed (in api.py
of the package).
how did you handle memory ?
You can store memory on the client side and pass it every time with the request. The updated memory state will be returned from the response.
Just as an FYI, it is possible to add chat history memory in the chain that will store in a DB itself, without passing the burden to client https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db
You need to pass the session id to the xyzChatMessageHistory
class instantiation.
message_history = RedisChatMessageHistory(
url="redis://localhost:6379/0", ttl=600, session_id="my-session"
)
memory = ConversationBufferMemory(
memory_key="chat_history", chat_memory=message_history
)