fix: fix core memory heartbeat issue (#1929)

This commit is contained in:
Sarah Wooders 2024-10-23 12:22:37 -07:00 committed by GitHub
parent 5253b0475e
commit 3b1210f69b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 384 additions and 461 deletions

View File

@ -13,7 +13,6 @@ services:
env_file:
- .env
environment:
- MEMGPT_SERVER_PASS=test_server_token
- WATCHFILES_FORCE_POLLING=true
volumes:

View File

@ -12,6 +12,8 @@ CORS(app)
app = Flask(__name__)
CORS(app)
# NOTE: this is out of date for >=0.5.0
MEMGPT_SERVER_URL = "http://127.0.0.1:8283"
MEMGPT_TOKEN = os.getenv("MEMGPT_SERVER_PASS")
assert MEMGPT_TOKEN, f"Missing env variable MEMGPT_SERVER_PASS"

View File

@ -168,7 +168,7 @@ from sqlalchemy.orm import sessionmaker
from letta.config import LettaConfig
# NOTE: hack to see if single session management works
from letta.settings import model_settings, settings
from letta.settings import model_settings, settings, tool_settings
config = LettaConfig.load()
@ -828,7 +828,8 @@ class SyncServer(Server):
# tool already added
continue
source_code = parse_source_code(func)
json_schema = generate_schema(func, func_name)
# memory functions are not terminal
json_schema = generate_schema(func, terminal=False, name=func_name)
source_type = "python"
tags = ["memory", "memgpt-base"]
tool = self.create_tool(
@ -2009,7 +2010,10 @@ class SyncServer(Server):
def add_default_external_tools(self, user_id: Optional[str] = None) -> bool:
"""Add default langchain tools. Return true if successful, false otherwise."""
success = True
if tool_settings.composio_api_key:
tools = Tool.load_default_langchain_tools() + Tool.load_default_crewai_tools() + Tool.load_default_composio_tools()
else:
tools = Tool.load_default_langchain_tools() + Tool.load_default_crewai_tools()
for tool in tools:
try:
self.ms.create_tool(tool)

View File

@ -7,6 +7,10 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
from letta.local_llm.constants import DEFAULT_WRAPPER_NAME
class ToolSettings(BaseSettings):
composio_api_key: Optional[str] = None
class ModelSettings(BaseSettings):
# env_prefix='my_prefix_'
@ -99,3 +103,4 @@ class TestSettings(Settings):
settings = Settings(_env_parse_none_str="None")
test_settings = TestSettings()
model_settings = ModelSettings()
tool_settings = ToolSettings()

View File

@ -103,28 +103,3 @@ class LettaUser(HttpUser):
# except Exception as e:
# with self.client.get("/", catch_response=True) as response:
# response.failure(str(e))
# class AdminUser(HttpUser):
# wait_time = between(5, 10)
# token = None
#
# def on_start(self):
# # Authenticate as admin
# self.client.headers = {"Authorization": "pasword"}
#
# @task
# def create_user(self):
# user_data = {
# "name": f"User-{''.join(random.choices(string.ascii_lowercase + string.digits, k=8))}"
# }
# self.client.post("/admin/users", json=user_data)
#
# @task
# def get_all_users(self):
# self.client.get("/admin/users")
#
# @task
# def get_all_agents(self):
# self.client.get("/api/admin/agents")
#

802
poetry.lock generated

File diff suppressed because it is too large Load Diff