rebase.endpoint
Declare an HTTP endpoint for a function, workflow, or model.
Signature
rb.endpoint(
*,
name: str | None = None,
method: str = "POST",
path: str | None = None,
auth: str = "api_key",
mode: str | None = None,
timeout: int | None = None,
timeout_seconds: int | None = None,
docs: bool = False,
enabled: bool = True,
) -> EndpointConfigParameters
| Parameter | Type | Description |
|---|---|---|
name | `str | None` |
method | str | HTTP method. Supported values are GET, POST, PUT, PATCH, and DELETE. Defaults to POST. |
path | `str | None` |
auth | str | Invocation auth mode. Supported values are api_key, workspace, and public. Defaults to api_key. |
mode | `str | None` |
timeout | `int | None` |
timeout_seconds | `int | None` |
docs | bool | Store endpoint documentation metadata for future docs generation. |
enabled | bool | Whether the endpoint can be invoked. |
Usage
import rebase as rb
project = rb.project("forecasting")
@project.function(endpoint=rb.endpoint(method="POST", path="/forecast"))
def forecast(zone: str = "SE3") -> dict:
return {"zone": zone}Standalone decorators are supported. Without project, the target belongs to the implicit default project.
@rb.function(project="forecasting")
@rb.endpoint(method="POST", path="/forecast")
def forecast(zone: str = "SE3") -> dict:
return {"zone": zone}Models accept endpoint configs at construction time:
model = PricePredictor(
project="forecasting",
endpoint=rb.endpoint(method="POST", path="/predict"),
)
