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: enable optimized json response parsing (#8436)

cthomasb8e7c14f1636
diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py
index bdd48ce12..b0612472c 100644
--- a/letta/server/rest_api/app.py
+++ b/letta/server/rest_api/app.py
@@ -18,7 +18,7 @@ faulthandler.enable()
from fastapi import FastAPI, Request
from fastapi.exceptions import RequestValidationError
-from fastapi.responses import JSONResponse
+from fastapi.responses import JSONResponse, ORJSONResponse
from marshmallow import ValidationError
from sqlalchemy.exc import IntegrityError, OperationalError
from starlette.middleware.cors import CORSMiddleware
@@ -338,6 +338,7 @@ def create_application() -> "FastAPI":
version=letta_version,
debug=debug_mode, # if True, the stack trace will be printed in the response
lifespan=lifespan,
+ default_response_class=ORJSONResponse, # Use orjson for 10x faster JSON serialization
)
# === Global Exception Handlers ===