feat: Implement streaming chat completions endpoint [LET-5485] (#5446)

* wip

* Add chat completions router and fix streaming service

* Finish chat completions

* Finish chat completions

* Remove extra print statement

* Run just api

* Don't explicitly throw http exceptions but surface Letta errors

* Remap errors

* Trigger CI

* Add missing Optional import
This commit is contained in:
Matthew Zhou
2025-10-15 11:03:48 -07:00
committed by Caren Thomas
parent 714978f5ee
commit 2dae4d33c3
9 changed files with 1721 additions and 54 deletions

View File

@@ -142,6 +142,14 @@ class LettaMCPTimeoutError(LettaMCPError):
super().__init__(message=message, code=ErrorCode.TIMEOUT, details=details)
class LettaServiceUnavailableError(LettaError):
"""Error raised when a required service is unavailable."""
def __init__(self, message: str, service_name: Optional[str] = None):
details = {"service_name": service_name} if service_name else {}
super().__init__(message=message, code=ErrorCode.INTERNAL_SERVER_ERROR, details=details)
class LettaUnexpectedStreamCancellationError(LettaError):
"""Error raised when a streaming request is terminated unexpectedly."""