Skip to content

Commit 5acf519

Browse files
committed
Fix tests
1 parent 0536a29 commit 5acf519

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

agent-memory-client/agent_memory_client/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ def parse_tool_call(tool_call: dict[str, Any]) -> UnifiedToolCall:
17191719
id=tool_call.get("id"),
17201720
name=tool_call.get("name", ""),
17211721
arguments=tool_call.get("args", {}),
1722-
provider="langchain",
1722+
provider="generic",
17231723
)
17241724

17251725
# Generic format - assume it's already in a usable format
@@ -2104,9 +2104,9 @@ async def _resolve_delete_long_term_memories(
21042104
result = await self.delete_long_term_memories(memory_ids=memory_ids)
21052105
# Handle both dict-like and model responses
21062106
try:
2107-
status = result.get("status") # type: ignore[call-arg]
2108-
except Exception:
21092107
status = getattr(result, "status", None)
2108+
except Exception:
2109+
status = None
21102110
if not status:
21112111
status = "Deleted memories successfully"
21122112
return {"status": status}

agent_memory_server/mcp.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,18 @@ async def edit_long_term_memory(
10301030

10311031
# Filter out None values to only include fields that should be updated
10321032
update_dict = {k: v for k, v in update_dict.items() if v is not None}
1033-
updates = EditMemoryRecordRequest(**update_dict)
1033+
updates = EditMemoryRecordRequest(
1034+
text=text if text is not None else None,
1035+
topics=topics if topics is not None else None,
1036+
entities=entities if entities is not None else None,
1037+
memory_type=memory_type if memory_type is not None else None,
1038+
namespace=namespace if namespace is not None else None,
1039+
user_id=user_id if user_id is not None else None,
1040+
session_id=session_id if session_id is not None else None,
1041+
event_date=update_dict.get("event_date")
1042+
if "event_date" in update_dict
1043+
else None,
1044+
)
10341045

10351046
return await core_update_long_term_memory(memory_id=memory_id, updates=updates)
10361047

agent_memory_server/models.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Literal
55

66
from mcp.server.fastmcp.prompts import base
7+
from mcp.types import AudioContent, EmbeddedResource, ImageContent, TextContent
78
from pydantic import BaseModel, Field
89
from ulid import ULID
910

@@ -434,10 +435,11 @@ class MemoryPromptRequest(BaseModel):
434435
long_term_search: SearchRequest | bool | None = None
435436

436437

437-
class SystemMessage(base.Message):
438+
class SystemMessage(BaseModel):
438439
"""A system message"""
439440

440441
role: Literal["system"] = "system"
442+
content: str | TextContent | ImageContent | AudioContent | EmbeddedResource
441443

442444

443445
class UserMessage(base.Message):
@@ -453,7 +455,7 @@ class MemoryPromptResponse(BaseModel):
453455
class LenientMemoryRecord(ExtractedMemoryRecord):
454456
"""A memory record that can be created without an ID"""
455457

456-
id: str | None = Field(default_factory=lambda: str(ULID()))
458+
id: str = Field(default_factory=lambda: str(ULID()))
457459

458460

459461
class DeleteMemoryRecordRequest(BaseModel):

examples/memory_editing_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ async def _handle_multiple_function_calls(
156156
# Execute all tool calls
157157
for i, tool_call in enumerate(tool_calls):
158158
function_name = tool_call.get("name", "unknown")
159-
print(f"🔧 Using {function_name} tool ({i+1}/{len(tool_calls)})...")
159+
print(f"🔧 Using {function_name} tool ({i + 1}/{len(tool_calls)})...")
160160

161161
# Use the client's unified tool call resolver
162162
result = await client.resolve_tool_call(
@@ -312,7 +312,7 @@ async def _handle_multiple_function_calls(
312312
for i, tool_call in enumerate(followup_calls):
313313
fname = tool_call.get("name", "unknown")
314314
print(
315-
f" 🔧 Follow-up using {fname} tool ({i+1}/{len(followup_calls)})..."
315+
f" 🔧 Follow-up using {fname} tool ({i + 1}/{len(followup_calls)})..."
316316
)
317317
res = await client.resolve_tool_call(
318318
tool_call=tool_call,

0 commit comments

Comments
 (0)