LangMem (version 0.0.30) is a Python library providing prebuilt utilities for memory management and retrieval, specifically designed for AI agents and LLM applications. It offers abstractions for integrating with various embedding models and vector stores, facilitating the creation of intelligent systems with long-term memory. The library is under active development with frequent minor updates.
pip install langmemVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up `MemoryManager` with `OpenAIEmbeddings` and `Chroma` to add and recall memories. It assumes `openai` and `chromadb` are installed (e.g., via `pip install langmem[openai,chromadb]`) and `OPENAI_API_KEY` is configured in your environment. Note the use of `embedding_function` when initializing `Chroma`.
Refer to the GitHub repository and commit history for recent changes. Pin your dependency versions to specific patch releases (e.g., `langmem==0.0.30`) to mitigate unexpected breaks.
Consult the `pyproject.toml` or `setup.py` on GitHub for available `extras_require` groups, or manually install individual packages as needed for your chosen components.
Use `vectorstore = Chroma(embedding_function=embeddings_instance)` to correctly configure your vector store with an embedding model.
Set the API key as an environment variable (e.g., `export OPENAI_API_KEY='your_key'`) or pass it directly to the constructor (e.g., `OpenAIEmbeddings(openai_api_key='your_key')`).