Create LLM agents with long-term memory and custom tools ππ¦
APACHE-2.0 License
Bot releases are hidden (Show)
gpt-4o
and gpt-4o-mini
Improved compatibility with gpt-4o
and gpt-4o-mini
models: We updated the prompt format for weaker models so that the inner thoughts of the agents are properly generated (previously, these models could only generate None
for inner thoughts).
Fixed issues with creating, listing and deleting humans and personas.
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.19...0.3.20
Published by sarahwooders 3 months ago
MemGPT now supports customizeable memory classes by extending the BaseMemory
class. This allows developers to both define custom memory fields (instead of just human/persona) as well as custom memory editing functions (rather than core_memory_[append/replace]
. Note that custom memory editing functions will need to have properly formatted docstrings so that the function can be added as a custom tool to the agent.
ChatMemory
classAgents will default to using the ChatMemory
class, which has the original human/memory fields and memory editing functions in MemGPT:
from memgpt.memory import BaseMemory
class ChatMemory(BaseMemory):
def __init__(self, persona: str, human: str, limit: int = 2000):
self.memory = {
"persona": MemoryModule(name="persona", value=persona, limit=limit),
"human": MemoryModule(name="human", value=human, limit=limit),
}
def core_memory_append(self, name: str, content: str) -> Optional[str]:
"""
Append to the contents of core memory.
Args:
name (str): Section of the memory to be edited (persona or human).
content (str): Content to write to the memory. All unicode (including emojis) are supported.
Returns:
Optional[str]: None is always returned as this function does not produce a response.
"""
self.memory[name].value += "\n" + content
return None
def core_memory_replace(self, name: str, old_content: str, new_content: str) -> Optional[str]:
"""
Replace the contents of core memory. To delete memories, use an empty string for new_content.
Args:
name (str): Section of the memory to be edited (persona or human).
old_content (str): String to replace. Must be an exact match.
new_content (str): Content to write to the memory. All unicode (including emojis) are supported.
Returns:
Optional[str]: None is always returned as this function does not produce a response.
"""
self.memory[name].value = self.memory[name].value.replace(old_content, new_content)
return None
Custom tools and memory classes can now both be specified in the agent creation API:
from memgpt.memory import ChatMemory
# create agent with default tools/memory
basic_agent = client.create_agent()
# create agent with custom tools and memory
tool = client.create_tool(...)
memory = CustomMemory(human="I am Sarah", persona="I am Sam", organization="MemGPT")
custom_agent = client.create_agent(
name="my_agent", memory=memory, tools=[tool.name]
)
The memory editing bools from the extended BaseMemory
class are automatically added as tools to the agent to use.
Since specification of tools, memory, and the system prompt is now moving into the agent creation interface, we are no longer supporting presets as a mechanism to create agents.
We provide a migration script for migrating agents from v0.3.18 to this version (due to changes in the AgentState
schema).
CoreMemory
to support generalized memory fields and memory editing functions by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1479
.gitattributes
by @cpacker in https://github.com/cpacker/MemGPT/pull/1511
send_message
functions by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1519
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.18...0.3.19
Published by sarahwooders 4 months ago
This release introduces tool creation from inside Python scripts, returning usage statistics, and many bug fixes.
We added support for directly creating tools in Python:
def print_tool(message: str):
"""
Args:
message (str): The message to print.
Returns:
str: The message that was printed.
"""
print(message)
return message
tool = client.create_tool(print_tool, tags=["extras"])
agent_state = client.create_agent(tools=[tool.name]))
Sending a message to an agent now also returns usage statistics for computing cost metrics:
class MemGPTUsageStatistics(BaseModel):
completion_tokens: int
prompt_tokens: int
total_tokens: int
step_count: int
async def send_message
function by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1445
rdme-openapi.yml
to correct Python + poetry version by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1446
memgpt [list/add/delete]
(#1428) by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1449
Dockerfile
to Python 3.12 by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1456
ensure_ascii
to missing json.dumps
calls by @cpacker in https://github.com/cpacker/MemGPT/pull/1466
LocalClient
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1465
/pop
, /retry
, and /rethink
by @cpacker in https://github.com/cpacker/MemGPT/pull/1471
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.17...0.3.18
Published by sarahwooders 5 months ago
π¦ You can now use MemGPT with the Ollama embeddings endpoint!
memgpt/configs
folder by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1431
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.16...0.3.17
Published by cpacker 5 months ago
π§Ώ Milvus integration: you can now use Milvus to back the MemGPT vector database! For more information, see: https://memgpt.readme.io/docs/storage#milvus
resend
example by @cpacker in https://github.com/cpacker/MemGPT/pull/1416
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.15...0.3.16
Published by sarahwooders 5 months ago
π¦ Llama 3 support and bugfixes
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.14...0.3.15
Published by cpacker 6 months ago
π Bug-fix release
~/.memgpt/config
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1337
0.3.14
+ strip version from server yaml by @cpacker in https://github.com/cpacker/MemGPT/pull/1334
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.13...0.3.14
Published by sarahwooders 6 months ago
Please note the dev portal is in alpha and this is not an official release!
This adds support for viewing the dev portal when the MemGPT service is running. You can view the dev portal on memgpt.localhost
(if running with docker) or localhost:8283
(if running with memgpt server
).
Make sure you install MemGPT with pip install pymemgpt
and run memgpt quickstart [--backend openai]
or memgpt configure
before running the server.
There are two options to deploy the server:
Option 1: Run with docker compose
git clone [email protected]:cpacker/MemGPT.git
docker compose up
memgpt.localhost
in the browser to view the developer portalOption 2: Run with the CLI:
memgpt server
localhost:8283
in the browser to view the developer portalconfig/server_config.yaml
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1292
autoflake
and isort
) by @cpacker in https://github.com/cpacker/MemGPT/pull/1300
embedding_model
null issue in tests by @cpacker in https://github.com/cpacker/MemGPT/pull/1305
create(..)
call to LLMs to not require AgentState
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1307
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.12...0.3.13
Published by sarahwooders 6 months ago
π³ Cleaned up workflow for creating a MemGPT service with docker compose up
:
http://memgpt.localhost
docker compose -f dev-compose.yaml up --build
(built from local code).pgdata
foldercompose.yaml
)πͺ² Bugfixes for Groq API and server
/completions
by @cpacker in https://github.com/cpacker/MemGPT/pull/1288
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.11...0.3.12
Published by cpacker 6 months ago
π° We now support streaming in the CLI when using OpenAI (+ OpenAI proxy) endpoints! You can turn on streaming mode with memgpt run --stream
memgpt configure
and add functionality for modifying humans/presets more clearly by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1253
ChatCompletionResponse
to make model
field optional by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1258
memgpt/memgpt-server:latest
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1267
-d
flag to docker compose up
for tests by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1268
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.10...0.3.11
Published by sarahwooders 6 months ago
We added support for Anthropic, Cohere, and Groq!
Message
objects to dicts for local LLMs by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1251
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.9...0.3.10
Published by sarahwooders 6 months ago
This PR add Google AI Gemini Pro support for MemGPT, as well as Python 3.12 support.
Setting up Gemini with MemGPT configure:
> memgpt configure
Loading config from /Users/loaner/.memgpt/config
? Select LLM inference provider: google_ai
? Enter your Google AI (Gemini) API key (see https://aistudio.google.com/app/a
pikey): *********
? Enter your Google AI (Gemini) service endpoint (see https://ai.google.dev/api/rest): generativelanguage
? Select default model: gemini-pro
Got context window 30720 for model gemini-pro (from Google API)
? Select your model's context window (see https://cloud.google.com/vertex-ai/generative-ai/docs/learn/model-versioning#gemini-model-versions): 30720
? Select embedding provider: openai
? Select default preset: memgpt_chat
? Select default persona: sam_pov
? Select default human: basic
? Select storage backend for archival data: chroma
? Select chroma backend: persistent
? Select storage backend for recall data: sqlite
π Saving config to /Users/loaner/.memgpt/config
llama-index-embeddings-huggingface
package and fix bug with local embeddings by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1222
/rethink
by @cpacker in https://github.com/cpacker/MemGPT/pull/1227
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.8...0.3.9
Published by sarahwooders 7 months ago
This release introduces initial support for running a MemGPT server with Docker Compose, and bugfixes for storing embeddings and message timestamps.
datetime.now()
to datetime.now(UTC)
by @cpacker in https://github.com/cpacker/MemGPT/pull/1176
num_passages
in Source.metadata_
from REST list sources endpoint by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1178
docker compose up
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1183
docker compose
server by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1189
tests.yaml
if env variable is set by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1196
compose.yaml
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1204
MemGPTConfig
URI for postgres if no environment variables by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1216
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.7...0.3.8
Published by cpacker 7 months ago
π¦ Bugfix release
GET /api/agents/{a_id}/messages
by @cpacker in https://github.com/cpacker/MemGPT/pull/1135
Admin
routes in client and add tests by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1157
Agent.step()
to fix out-of-order timestamps, (2) bug fixes with usage of preset/human
vs filename values by @cpacker in https://github.com/cpacker/MemGPT/pull/1145
send_message
POST by @cpacker in https://github.com/cpacker/MemGPT/pull/1161
list sources
route by @cpacker in https://github.com/cpacker/MemGPT/pull/1164
Preset
routes to API + patch for tool_call_id
max length OpenAI error by @cpacker in https://github.com/cpacker/MemGPT/pull/1165
source_id
to path variable by @cpacker in https://github.com/cpacker/MemGPT/pull/1171
0.3.7
by @cpacker in https://github.com/cpacker/MemGPT/pull/1173
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.6...0.3.7
Published by cpacker 7 months ago
π bugfix release
send_message
) by @cpacker in https://github.com/cpacker/MemGPT/pull/1120
last_run
field to the agent state model by @cpacker in https://github.com/cpacker/MemGPT/pull/1124
GET /api/agents
response by @cpacker in https://github.com/cpacker/MemGPT/pull/1125
persona/human_name
fields to Preset
by @cpacker in https://github.com/cpacker/MemGPT/pull/1134
0.3.6
by @cpacker in https://github.com/cpacker/MemGPT/pull/1114
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.5...0.3.6
Published by cpacker 8 months ago
π¦ Bugfix release
server.server_llm_config
information for REST endpoint by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1083
0.3.5
+ add AutoGen integration tests by @cpacker in https://github.com/cpacker/MemGPT/pull/1081
test_metadata.py
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1082
autoflake
+ add autoflake
to dev extras by @cpacker in https://github.com/cpacker/MemGPT/pull/1097
TokenTextSplitter
for more reliable chunking by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1098
llama-index-embeddings-huggingface
for extras local
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1099
0.3.5
by @cpacker in https://github.com/cpacker/MemGPT/pull/1091
GET
REST API route for listing tools by @cpacker in https://github.com/cpacker/MemGPT/pull/1100
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.4...0.3.5
Published by sarahwooders 8 months ago
π Bugfix release
llama-index==0.10.6
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1016
/rewrite
by @cpacker in https://github.com/cpacker/MemGPT/pull/1034
RESTClient
and Admin
client for interacting with server from python by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1033
memgpt benchmark
command by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1041
memgpt server
for development where https is needed by @cpacker in https://github.com/cpacker/MemGPT/pull/1052
AgentState.state
by @cpacker in https://github.com/cpacker/MemGPT/pull/1058
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.3...0.3.4
Published by sarahwooders 8 months ago
Minor bugfix release
memgpt server
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1006
memgpt server
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/1012
python-box
from deps by @cpacker in https://github.com/cpacker/MemGPT/pull/1019
memgpt server
REST API by @cpacker in https://github.com/cpacker/MemGPT/pull/1014
/admin
routes on server by @cpacker in https://github.com/cpacker/MemGPT/pull/1025
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.2...0.3.3
Published by sarahwooders 8 months ago
π Bugfix release
User
from MemGPTConfig.anon_clientid
from client if does not exist by @sarahwooders in https://github.com/cpacker/MemGPT/pull/981
Box
by @cpacker in https://github.com/cpacker/MemGPT/pull/982
ChatCompletionRequest
models to the models dir by @cpacker in https://github.com/cpacker/MemGPT/pull/985
collection.upsert
instead of collection.add
for inserts by @sarahwooders in https://github.com/cpacker/MemGPT/pull/996
Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3.1...0.3.2
Published by sarahwooders 8 months ago
π Bugfix release
utf-8
encodings for all text files by @cpacker in https://github.com/cpacker/MemGPT/pull/918
~/.memgpt/config
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/970
content
to be None
for role==tool
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/971
memgpt load
by @sarahwooders in https://github.com/cpacker/MemGPT/pull/978
tool_calls
or content
to be set for assistant role by @sarahwooders in https://github.com/cpacker/MemGPT/pull/976
βοΈ Full Changelog: https://github.com/cpacker/MemGPT/compare/0.3...0.3.1