Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: use descriptive error messages for known errors in LLM streaming (#10207)
cthomas0a38934e5c80
diff --git a/letta/server/rest_api/redis_stream_manager.py b/letta/server/rest_api/redis_stream_manager.pyindex 2eeb55f54..5f630fcb4 100644--- a/letta/server/rest_api/redis_stream_manager.py+++ b/letta/server/rest_api/redis_stream_manager.py@@ -9,6 +9,7 @@ from contextlib import aclosingfrom typing import Dict, List, Optionalfrom letta.data_sources.redis_client import AsyncRedisClient+from letta.errors import LettaErrorfrom letta.log import get_loggerfrom letta.schemas.enums import RunStatusfrom letta.schemas.letta_message import LettaErrorMessage@@ -381,7 +382,7 @@ async def create_background_stream_processor(error_message = LettaErrorMessage(run_id=run_id,error_type="internal_error",- message="An unknown error occurred with the LLM streaming request.",+ message=str(e) if isinstance(e, LettaError) else "An unknown error occurred with the LLM streaming request.",detail=str(e),)await writer.write_chunk(diff --git a/letta/services/streaming_service.py b/letta/services/streaming_service.pyindex a458be71d..1adeea2b3 100644--- a/letta/services/streaming_service.py+++ b/letta/services/streaming_service.py@@ -16,6 +16,7 @@ from letta.constants import REDIS_RUN_ID_PREFIXfrom letta.data_sources.redis_client import AsyncRedisClient, NoopAsyncRedisClient, get_redis_clientfrom letta.errors import (ConversationBusyError,+ LettaError,LettaInvalidArgumentError,LettaServiceUnavailableError,LLMAuthenticationError,@@ -745,7 +746,7 @@ class StreamingService:error_message = LettaErrorMessage(run_id=run_id,error_type="internal_error",- message="An unknown error occurred with the LLM streaming request.",+ message=error_detail if isinstance(e, LettaError) else "An unknown error occurred with the LLM streaming request.",detail=error_detail,)error_data = {"error": error_message.model_dump()}