enterprise_ai.llm.routing
Source: sdks/python/src/enterprise_ai/llm/routing/__init__.py. Back to the Python SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class RoutesClient
/v1/routes.
Resource
RoutesClient.create
create(route: dict[str, Any]) -> Any
Create a routing rule. Creates a routing rule of the tenant and answers 201. A platform principal without tenant answers 403 platform_only; an unknown strategy 422 parameter_invalid. Audited (route.create). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/routes (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
route | dict[str, Any] | yes | Route document sent as the request body. |
Returns: Any. Decoded JSON answer of the operation "Create a routing rule".
Raises: the typed errors of the transport (Errors).
RoutesClient.delete
delete(route_id: str) -> Any
Delete a routing rule. Deletes a routing rule of the tenant and answers 204. Unknown rule: 404 route_not_found. Audited (route.delete). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/routes/{rid} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
route_id | str | yes | Identifier of the routing rule. |
Returns: Any. Decoded JSON answer of the operation "Delete a routing rule".
Raises: the typed errors of the transport (Errors).
RoutesClient.list
list(**page: Any) -> Any
List the routing rules. Routing rules of the tenant by priority then name, each with its match, strategy, candidates, fallbacks, constraints and target_model (the first candidate). Requires a reader role.
Route: /v1/routes (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
**page | Any | no | Pagination options: limit (maximum number of routes per page) and cursor (cursor of the page to read). |
Returns: Any. Decoded JSON answer of the operation "List the routing rules".
Raises: the typed errors of the transport (Errors).
RoutesClient.replace
replace(route_id: str, route: dict[str, Any]) -> Any
Replace a routing rule. Replaces the match, strategy, candidates, fallbacks, constraints, priority and enabled flag of a rule of the tenant (omitted fields take their default; the name is kept). Unknown rule: 404 route_not_found. Audited (route.update). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/routes/{rid} (PUT).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
route_id | str | yes | Identifier of the routing rule. | |
route | dict[str, Any] | yes | Full route document that replaces the current one. |
Returns: Any. Decoded JSON answer of the operation "Replace a routing rule".
Raises: the typed errors of the transport (Errors).
RoutesClient.simulate
simulate(model: str | None = None, task: str | None = None, data_classification: str | None = None, **extra: Any) -> Any
Simulate the routing of a request. Shows which model a request would be routed to, without calling it: the rule given by route_id or the first enabled rule that matches, the tenant allow and deny lists (narrowed by the request), the classification and the fallback policy. Answers the selected model, fallbacks, rejected candidates with their reason and the rule used; no eligible model answers 422 no_eligible_model. Restricted models are only allowed for tenant_admin and security_officer with allow_restricted. Requires a reader role.
Route: /v1/routes/simulate (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
model | str | None | None | no | Only cards whose model pattern matches this model id (case insensitive glob). |
task | str | None | None | no | Kind of task of the simulated call, used by the routing rules. |
data_classification | str | None | None | no | Classification of the data of the simulated call, from public to secret. |
**extra | Any | no | Extra fields merged into the request body. |
Returns: Any. Decoded JSON answer of the operation "Simulate the routing of a request".
Raises: the typed errors of the transport (Errors).
Functions
classification_allows
classification_allows(model_max: str, data: str) -> bool
True when a model cleared for model_max may process data classified data.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
model_max | str | yes | Highest classification the model is cleared for, on the same scale. | |
data | str | yes | Classification of the data: public, internal, confidential, restricted or secret. |
Returns: bool. True when data is not above model_max.
eligible_models
eligible_models(models: Iterable[dict[str, Any]], data_classification: str = 'internal', region: str | None = None, capability: str | None = None) -> list[dict[str, Any]]
Filter registry entries locally: approved, cleared for the data, in region, with capability.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
models | Iterable[dict[str, Any]] | yes | Registry entries or Model Manifests to filter. | |
data_classification | str | 'internal' | no | Classification of the data to process (default internal), compared with data_classification_max. |
region | str | None | None | no | Region the model must serve when it declares data_residency.regions; no filter when omitted. |
capability | str | None | None | no | Capability the model must list in capabilities; no filter when omitted. |
Returns: list[dict[str, Any]]. Entries whose status is approved or restricted and that pass every filter, in input order.
fallback_chain
fallback_chain(model: dict[str, Any]) -> list[str]
Primary model id followed by its declared fallbacks.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
model | dict[str, Any] | yes | Registry entry or Model Manifest with model_id and fallbacks. |
Returns: list[str]. List of model identifiers: the primary one first, then the fallbacks in order.