app
Main Entry Point for the EleanorAI Framework Backend FastAPI application.
This module serves as the main entry point for the Eleanor Backend API. It initializes the FastAPI application, sets up exception handlers, adds middleware, and includes routers for different API endpoints.
The API application must be launched via the backend API command in the Eleanor CLI so that configuration and pre-launch checks are performed.
Attributes
app
module-attribute
app = FastAPI(
version=__version__,
lifespan=lifespan,
redoc_url=APP_REDOC_URL,
generate_unique_id_function=custom_generate_unique_id,
)
Classes
Functions
custom_generate_unique_id
Generates a unique ID for a given API route. This is needed to reduce the insane default method name lengths for generated clients under the default methodology.
Parameters:
-
route
(APIRoute
) –The API route for which to generate the unique ID.
Returns:
-
str
–The generated unique ID.
Raises:
-
ValueError
–If a duplicate route ID is detected.
custom_validation_exception_handler
async
custom_validation_exception_handler(
request: BaseRequest, exc: RequestValidationError
)
service_exception_handler
async
service_exception_handler(
request: BaseRequest, exc: ServiceError
)