Teaching LLMs memory management for unbounded context
Project description
MemGPT
Try out our MemGPT chatbot on Discord!
⭐ NEW: You can now run MemGPT with open/local LLMs and AutoGen! ⭐
🤖 Create perpetual chatbots with self-editing memory!
🗃️ Chat with your data - talk to your local files or SQL database!
Quick setup
Join Discord and message the MemGPT bot (in the #memgpt
channel). Then run the following commands (messaged to "MemGPT Bot"):
/profile
(to create your profile)/key
(to enter your OpenAI key)/create
(to create a MemGPT chatbot)
Make sure your privacy settings on this server are open so that MemGPT Bot can DM you:
MemGPT → Privacy Settings → Direct Messages set to ON
You can see the full list of available commands when you enter /
into the message box.
What is MemGPT?
Memory-GPT (or MemGPT in short) is a system that intelligently manages different memory tiers in LLMs in order to effectively provide extended context within the LLM's limited context window. For example, MemGPT knows when to push critical information to a vector database and when to retrieve it later in the chat, enabling perpetual conversations. Learn more about MemGPT in our paper.
Running MemGPT locally
Install MemGPT:
pip install pymemgpt
Add your OpenAI API key to your environment:
export OPENAI_API_KEY=YOUR_API_KEY # on Linux/Mac
set OPENAI_API_KEY=YOUR_API_KEY # on Windows
$Env:OPENAI_API_KEY = "YOUR_API_KEY" # on Windows (PowerShell)
Configure default setting for MemGPT by running:
memgpt configure
Now, you can run MemGPT with:
memgpt run
You can run the following commands in the MemGPT CLI prompt:
/exit
: Exit the CLI/attach
: Attach a loaded data source to the agent/save
: Save a checkpoint of the current agent/conversation state/dump
: View the current message log (see the contents of main context)/dump <count>
: View the last messages (all if is omitted)/memory
: Print the current contents of agent memory/pop
: Undo the last message in the conversation/pop <count>
: Undo the last messages in the conversation. It defaults to 3, which usually is one turn around in the conversation/retry
: Pops the last answer and tries to get another one/rethink <text>
: Will replace the inner dialog of the last assistant message with the to help shaping the conversation/rewrite
: Will replace the last assistant answer with the given text to correct or force the answer/heartbeat
: Send a heartbeat system message to the agent/memorywarning
: Send a memory warning system message to the agent
Once you exit the CLI with /exit
, you can resume chatting with the same agent by specifying the agent name in memgpt run --agent <NAME>
.
Documentation
See full documentation at: https://memgpt.readthedocs.io/
Installing from source
To install MemGPT from source, start by cloning the repo:
git clone git@github.com:cpacker/MemGPT.git
Then navigate to the main MemGPT
directory, and do:
pip install -e .
Now, you should be able to run memgpt
from the command-line using the downloaded source code.
If you are having dependency issues using pip install -e .
, we recommend you install the package using Poetry (see below). Installing MemGPT from source using Poetry will ensure that you are using exact package versions that have been tested for the production build.
Installing from source (using Poetry)
First, install Poetry using the official instructions here.
Then, you can install MemGPT from source with:
git clone git@github.com:cpacker/MemGPT.git
poetry shell
poetry install
Support
For issues and feature requests, please open a GitHub issue or message us on our #support
channel on Discord
Datasets
Datasets used in our paper can be downloaded at Hugging Face.
🚀 Project Roadmap
- Release MemGPT Discord bot demo (perpetual chatbot)
- Add additional workflows (load SQL/text into MemGPT external context)
- Integration tests
- Integrate with AutoGen (discussion)
- Add official gpt-3.5-turbo support (discussion)
- CLI UI improvements (issue)
- Add support for other LLM backends (issue, discussion)
- Release MemGPT family of open models (eg finetuned Mistral) (discussion)
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
File details
Details for the file pymemgpt_nightly-0.2.7.dev20231212103955.tar.gz
.
File metadata
- Download URL: pymemgpt_nightly-0.2.7.dev20231212103955.tar.gz
- Upload date:
- Size: 102.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f332506042e46b57cc7eb0c5792c44ed77c0eb68520225c0198a4080d21bcea |
|
MD5 | d4a594bfa4d9f01ba77ab24c944bcf00 |
|
BLAKE2b-256 | 25f8df46533cef75af1c36b75b410616b1914291aea2eefbfabe2946d5f1a149 |
File details
Details for the file pymemgpt_nightly-0.2.7.dev20231212103955-py3-none-any.whl
.
File metadata
- Download URL: pymemgpt_nightly-0.2.7.dev20231212103955-py3-none-any.whl
- Upload date:
- Size: 148.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56bffe87b7eaffa7abdcb6d09b04b4ed0886c02ef661e02b47ba7e2f37d5d16b |
|
MD5 | 220a3319fae032c5a5ad81bff7b9dc10 |
|
BLAKE2b-256 | 96309e43065fa15c1bee361786522c5eca1173fc39cbc5fcba22ceb43c8a5ae9 |