ray.serve.ingress#

ray.serve.ingress(app: fastapi.FastAPI | fastapi.APIRouter | Callable) Callable[source]#

Wrap a deployment class with a FastAPI application for HTTP request parsing.

Example

from ray import serve
from fastapi import FastAPI

app = FastAPI()

@serve.deployment
@serve.ingress(app)
class MyFastAPIDeployment:
    @app.get("/hi")
    def say_hi(self) -> str:
        return "Hello world!"

app = MyFastAPIDeployment.bind()
Parameters:

app – the FastAPI app or router object to wrap this class with. Can be any ASGI-compatible callable.