Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cap streaming chunk size #1802

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions py/core/main/api/v3/retrieval_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,11 @@ async def rag_app(
async def stream_generator():
try:
async for chunk in response:
yield chunk
if len(chunk) > 1024:
for i in range(0, len(chunk), 1024):
yield chunk[i : i + 1024]
else:
yield chunk
except GeneratorExit:
# Clean up if needed, then return
return
Expand Down Expand Up @@ -667,7 +671,11 @@ async def agent_app(
async def stream_generator():
try:
async for chunk in response:
yield chunk
if len(chunk) > 1024:
for i in range(0, len(chunk), 1024):
yield chunk[i : i + 1024]
else:
yield chunk
except GeneratorExit:
# Clean up if needed, then return
return
Expand Down
3 changes: 1 addition & 2 deletions py/core/main/services/management_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,6 @@ async def get_all_user_limits(self, user_id: UUID) -> dict[str, Any]:
)
)["total_entries"]


storage_limits = {
"chunks": {
"limit": max_chunks,
Expand All @@ -1084,7 +1083,7 @@ async def get_all_user_limits(self, user_id: UUID) -> dict[str, Any]:
"limit": max_collections,
"used": used_collections,
"remaining": max_collections - used_collections,
}
},
}
# 5) Return a structured response
result = {
Expand Down
Loading