Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: remove message UTC validation temporarily to fix dev portal + add `-d` flag to `docker compose up` for tests (#1268)

Sarah Woodersbe50e4430135
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index b5ee398fd..67afc874f 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -47,7 +47,7 @@ jobs:
MEMGPT_SERVER_PASS: test_server_token
MEMGPT_CONFIG_PATH: configs/server_config.yaml
- run: docker compose up &
+ run: docker compose up -d
- name: Run server tests
env:
diff --git a/memgpt/server/rest_api/agents/index.py b/memgpt/server/rest_api/agents/index.py
index d71df7b70..1a86b1a30 100644
--- a/memgpt/server/rest_api/agents/index.py
+++ b/memgpt/server/rest_api/agents/index.py
@@ -57,26 +57,21 @@ def setup_agents_index_router(server: SyncServer, interface: QueuingInterface, p
interface.clear()
try:
- try:
- # print("YYY", request.config)
- agent_state = server.create_agent(
- user_id=user_id,
- # **request.config
- # TODO turn into a pydantic model
- name=request.config["name"],
- preset=request.config["preset"] if "preset" in request.config else None,
- persona_name=request.config["persona_name"] if "persona_name" in request.config else None,
- human_name=request.config["human_name"] if "human_name" in request.config else None,
- persona=request.config["persona"] if "persona" in request.config else None,
- human=request.config["human"] if "human" in request.config else None,
- # llm_config=LLMConfigModel(
- # model=request.config['model'],
- # )
- function_names=request.config["function_names"].split(",") if "function_names" in request.config else None,
- )
- except:
- print(f"Failed to create agent from provided config:\n{request.config}")
- raise
+ agent_state = server.create_agent(
+ user_id=user_id,
+ # **request.config
+ # TODO turn into a pydantic model
+ name=request.config["name"],
+ preset=request.config["preset"] if "preset" in request.config else None,
+ persona_name=request.config["persona_name"] if "persona_name" in request.config else None,
+ human_name=request.config["human_name"] if "human_name" in request.config else None,
+ persona=request.config["persona"] if "persona" in request.config else None,
+ human=request.config["human"] if "human" in request.config else None,
+ # llm_config=LLMConfigModel(
+ # model=request.config['model'],
+ # )
+ function_names=request.config["function_names"].split(",") if "function_names" in request.config else None,
+ )
llm_config = LLMConfigModel(**vars(agent_state.llm_config))
embedding_config = EmbeddingConfigModel(**vars(agent_state.embedding_config))
diff --git a/memgpt/server/rest_api/agents/message.py b/memgpt/server/rest_api/agents/message.py
index 3c1d0b67a..3ea0d2f30 100644
--- a/memgpt/server/rest_api/agents/message.py
+++ b/memgpt/server/rest_api/agents/message.py
@@ -34,13 +34,22 @@ class UserMessageRequest(BaseModel):
description="Timestamp to tag the message with (in ISO format). If null, timestamp will be created server-side on receipt of message.",
)
- @validator("timestamp")
- def validate_timestamp(cls, value: Any) -> Any:
- if value.tzinfo is None or value.tzinfo.utcoffset(value) is None:
- raise ValueError("Timestamp must include timezone information.")
- if value.tzinfo.utcoffset(value) != datetime.fromtimestamp(timezone.utc).utcoffset():
- raise ValueError("Timestamp must be in UTC.")
- return value
+ # @validator("timestamp", pre=True, always=True)
+ # def validate_timestamp(cls, value: Optional[datetime]) -> Optional[datetime]:
+ # if value is None:
+ # return value # If the timestamp is None, just return None, implying default handling to set server-side
+
+ # if not isinstance(value, datetime):
+ # raise TypeError("Timestamp must be a datetime object with timezone information.")
+
+ # if value.tzinfo is None or value.tzinfo.utcoffset(value) is None:
+ # raise ValueError("Timestamp must be timezone-aware.")
+
+ # # Convert timestamp to UTC if it's not already in UTC
+ # if value.tzinfo.utcoffset(value) != timezone.utc.utcoffset(value):
+ # value = value.astimezone(timezone.utc)
+
+ # return value
class UserMessageResponse(BaseModel):
diff --git a/tests/test_client.py b/tests/test_client.py
index 945419ab4..ff739033d 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -106,7 +106,7 @@ def run_server():
@pytest.fixture(
params=[
{"base_url": local_service_url},
- {"base_url": docker_compose_url}, # TODO: add when docker compose added to tests
+ # {"base_url": docker_compose_url}, # TODO: add when docker compose added to tests
# {"base_url": None} # TODO: add when implemented
],
scope="module",