From a8679be705716d6182fc6a25d7adb714177b8265 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 29 Sep 2026 07:09:55 +0000 Subject: [PATCH] fix(proxy): chunk ROI spend user lookup Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com> --- litellm/proxy/roi_calculator/sync.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/litellm/proxy/roi_calculator/sync.py b/litellm/proxy/roi_calculator/sync.py index e06174149c8..94b517cb66b 100644 --- a/litellm/proxy/roi_calculator/sync.py +++ b/litellm/proxy/roi_calculator/sync.py @@ -12,6 +12,7 @@ from typing_extensions import ReadOnly, TypedDict, Unpack from litellm.proxy.roi_calculator.estimator import CompletionCaller, Estimator, EstimatorModel, cache_context from litellm.proxy.roi_calculator.github import GitHub, GitHubPullListItem, SourceError from litellm.proxy.roi_calculator.pull_cache import cache_key, settings_fingerprint +from litellm.repositories.chunked_in import find_many_in from litellm.types.roi_calculator import ( ROIEstimate, ROIPullEvidence, @@ -54,7 +55,7 @@ class _UserTable(Protocol): async def find_many( self, *, - where: dict[str, object], + where: Mapping[str, object], ) -> Sequence[Mapping[str, object]]: ... @@ -133,14 +134,7 @@ async def read_spend( ) user_ids: Final = tuple(sorted(frozenset(group.user_id for group in groups if group.user_id))) user_table: Final = database.litellm_usertable - user_filter: Final[dict[str, object]] = {"user_id": {"in": list(user_ids)}} - users: Final = _USER_EMAILS.validate_python( - await user_table.find_many( - where=user_filter, - ) - if user_ids - else () - ) + users: Final = _USER_EMAILS.validate_python(await find_many_in(user_table, "user_id", user_ids)) emails: Final[Mapping[str, str]] = MappingProxyType( {user.user_id: normalize_email(user.user_email) for user in users if normalize_email(user.user_email)} )