Drop-in RecallIO Memory for LangChain
Project description
Recallio Memory for LangChain
This repository provides an implementation of RecallioMemory, a drop‑in replacement for BaseMemory from LangChain. It stores conversation history in the Recallio cloud service using the official recallio client (version 1.2.4).
Features
- Scoped writes – memories can be associated with a specific
session_idoruser_id. - TTL support – pass a time‑to‑live in seconds and it will be converted to an expiration timestamp stored alongside each memory.
- Vector recall – previous messages are retrieved from Recallio using semantic search. Memories can also be filtered by custom tags.
Installation
pip install recallio==1.2.4 langchain
Usage
from langchain_recallio.memory import RecallioMemory
from langchain.chains import ConversationChain
from langchain.llms import OpenAI
memory = RecallioMemory(
api_key="YOUR_RECALLIO_API_KEY",
project_id="my-project",
user_id="alice",
session_id="chat-session-1",
ttl_seconds=3600, # expire after one hour
)
llm = OpenAI()
chain = ConversationChain(llm=llm, memory=memory)
response = chain.run("Who won the World Cup in 2022?")
print(response)
# Store an interaction
memory.save_context({"input": "Hello"}, {"output": "Hi there!"})
# Load recent conversation history to inject into a prompt
history = memory.load_memory_variables({"input": "What's up?"})
print(history)
Running the tests
pytest
The tests use mocks and do not require a valid Recallio API key.
License
This project is distributed under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_recallio-0.1.0.tar.gz.
File metadata
- Download URL: langchain_recallio-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a6fdc09fbb475d4e393d95759675648ce60bed5bc7fefcde30d0720f0275349
|
|
| MD5 |
f7042942d22d9e84921d62f2b47a50d9
|
|
| BLAKE2b-256 |
b65da5068826c4a60f0c7347791495e8e3fc72252ad4466f2a1f7b0554864506
|
File details
Details for the file langchain_recallio-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_recallio-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b70cf81ebbe3f8d2f3700e4695bec57345d2557b73d49af219fe0b57657a2e4b
|
|
| MD5 |
37a9956c69f1d91ac07f820f611a6426
|
|
| BLAKE2b-256 |
f1f0acbd1826ed0590dd5851f5ce9a332583ccc2d30506091845404302688897
|