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: dont swallow application errors in streaming response [LET-4069] (#4253)

cthomasf7c07f65efab
diff --git a/letta/server/rest_api/streaming_response.py b/letta/server/rest_api/streaming_response.py
index c8e48d2ca..810298014 100644
--- a/letta/server/rest_api/streaming_response.py
+++ b/letta/server/rest_api/streaming_response.py
@@ -296,9 +296,9 @@ class StreamingResponseWithStatusCode(StreamingResponse):
raise LettaUnexpectedStreamCancellationError("Stream was terminated due to unexpected cancellation from server")
except Exception as exc:
- logger.exception("Unhandled Streaming Error")
+ logger.exception(f"Unhandled Streaming Error: {str(exc)}")
more_body = False
- error_resp = {"error": {"message": "Internal Server Error"}}
+ error_resp = {"error": {"message": str(exc)}}
error_event = f"event: error\ndata: {json.dumps(error_resp)}\n\n".encode(self.charset)
logger.debug("response_started:", self.response_started)
if not self.response_started: