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.

feat(asyncify): convert actor load in sources count (#2428)

cthomas02685db77fd5
diff --git a/letta/server/rest_api/routers/v1/sources.py b/letta/server/rest_api/routers/v1/sources.py
index 740af39be..130a0434b 100644
--- a/letta/server/rest_api/routers/v1/sources.py
+++ b/letta/server/rest_api/routers/v1/sources.py
@@ -29,7 +29,8 @@ async def count_sources(
"""
Count all data sources created by a user.
"""
- return await server.source_manager.size(actor=server.user_manager.get_user_or_default(user_id=actor_id))
+ actor = server.user_manager.get_actor_or_default_async(actor_id=actor_id)
+ return await server.source_manager.size_async(actor=actor)
@router.get("/{source_id}", response_model=Source, operation_id="retrieve_source")
diff --git a/letta/services/source_manager.py b/letta/services/source_manager.py
index d3137bc51..80240377c 100644
--- a/letta/services/source_manager.py
+++ b/letta/services/source_manager.py
@@ -83,7 +83,7 @@ class SourceManager:
@enforce_types
@trace_method
- async def size(self, actor: PydanticUser) -> int:
+ async def size_async(self, actor: PydanticUser) -> int:
"""
Get the total count of sources for the given user.
"""