Skip to content

Commit b5c55d1

Browse files
abrookinsclaude
andcommitted
Fix duplicate context_usage_percentage parameter in API responses
Resolve TypeError by properly handling the context_usage_percentage field in WorkingMemoryResponse creation to avoid duplicate keyword arguments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a1a778a commit b5c55d1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

agent_memory_server/api.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,9 @@ async def get_working_memory(
312312
)
313313

314314
# Return WorkingMemoryResponse with percentage
315-
return WorkingMemoryResponse(
316-
**working_mem.model_dump(),
317-
context_usage_percentage=context_usage_percentage,
318-
)
315+
working_mem_data = working_mem.model_dump()
316+
working_mem_data["context_usage_percentage"] = context_usage_percentage
317+
return WorkingMemoryResponse(**working_mem_data)
319318

320319

321320
@router.put("/v1/working-memory/{session_id}", response_model=WorkingMemoryResponse)
@@ -402,10 +401,9 @@ async def put_working_memory(
402401
)
403402

404403
# Return WorkingMemoryResponse with percentage
405-
return WorkingMemoryResponse(
406-
**updated_memory.model_dump(),
407-
context_usage_percentage=context_usage_percentage,
408-
)
404+
updated_memory_data = updated_memory.model_dump()
405+
updated_memory_data["context_usage_percentage"] = context_usage_percentage
406+
return WorkingMemoryResponse(**updated_memory_data)
409407

410408

411409
@router.delete("/v1/working-memory/{session_id}", response_model=AckResponse)

0 commit comments

Comments
 (0)