Skip to content

Commit 3663545

Browse files
authored
chore: regenerate SDK client core from Otari OpenAPI spec (#29)
1 parent 276fb50 commit 3663545

9 files changed

Lines changed: 487 additions & 7 deletions

File tree

sdk-endpoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ GET /v1/usage/series # not yet wrapped
119119
DELETE /v1/usage # not yet wrapped
120120
POST /v1/usage/external-events # not yet wrapped
121121
POST /v1/usage/set-price # not yet wrapped
122+
GET /v1/usage/in-flight # dashboard-only, per-worker live view
122123
# Routing policies
123124
GET /v1/routing/policies # not yet wrapped
124125
POST /v1/routing/policies # not yet wrapped

src/otari/_client/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@
148148
"IMGUsageOutputTokensDetails",
149149
"ImageGenerationRequest",
150150
"ImagesResponse",
151+
"InFlightEntry",
152+
"InFlightResponse",
151153
"Input",
152154
"Input1",
153155
"KeyInfo",
@@ -505,6 +507,8 @@
505507
from otari._client.models.img_usage_output_tokens_details import IMGUsageOutputTokensDetails as IMGUsageOutputTokensDetails
506508
from otari._client.models.image_generation_request import ImageGenerationRequest as ImageGenerationRequest
507509
from otari._client.models.images_response import ImagesResponse as ImagesResponse
510+
from otari._client.models.in_flight_entry import InFlightEntry as InFlightEntry
511+
from otari._client.models.in_flight_response import InFlightResponse as InFlightResponse
508512
from otari._client.models.input import Input as Input
509513
from otari._client.models.input1 import Input1 as Input1
510514
from otari._client.models.key_info import KeyInfo as KeyInfo

src/otari/_client/api/routing_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ def rank_candidates_v1_routing_preferences_rank_post(
870870
) -> RankResponse:
871871
"""Rank Candidates
872872
873-
Record scored examples: one routing-memory record each, plus an audit row. The routing-memory record is written before its audit row for each example, because it is the load-bearing one (the router votes over it) and embedding it can fail; writing the audit row only afterwards means a failed embedding never leaves an orphan audit row. A failed embedding is a 502 that names the model, not a 500. Every example in the batch is embedded, so this is the call an operator makes most often and the one most likely to meet a misconfigured ``router_embedding_model``. Score keys are stored in the spelling the policy uses (see :func:`_validated_scores`), because the router matches them against its candidate selectors by exact string.
873+
Record scored examples: one routing-memory record each, plus an audit row. The routing-memory record is written before its audit row for each example, because it is the load-bearing one (the router votes over it) and embedding it can fail; writing the audit row only afterwards means a failed embedding never leaves an orphan audit row. A failed embedding is a 502 that names the model, not a 500. Every example in the batch is embedded, so this is the call an operator makes most often and the one most likely to meet a misconfigured ``router_embedding_model``. Score keys are stored canonically as ``instance:model`` (see :func:`_validated_scores`), which is the form the router canonicalizes its candidates to, so how a policy spells a candidate cannot decide whether it matches.
874874
875875
:param rank_request: (required)
876876
:type rank_request: RankRequest
@@ -938,7 +938,7 @@ def rank_candidates_v1_routing_preferences_rank_post_with_http_info(
938938
) -> ApiResponse[RankResponse]:
939939
"""Rank Candidates
940940
941-
Record scored examples: one routing-memory record each, plus an audit row. The routing-memory record is written before its audit row for each example, because it is the load-bearing one (the router votes over it) and embedding it can fail; writing the audit row only afterwards means a failed embedding never leaves an orphan audit row. A failed embedding is a 502 that names the model, not a 500. Every example in the batch is embedded, so this is the call an operator makes most often and the one most likely to meet a misconfigured ``router_embedding_model``. Score keys are stored in the spelling the policy uses (see :func:`_validated_scores`), because the router matches them against its candidate selectors by exact string.
941+
Record scored examples: one routing-memory record each, plus an audit row. The routing-memory record is written before its audit row for each example, because it is the load-bearing one (the router votes over it) and embedding it can fail; writing the audit row only afterwards means a failed embedding never leaves an orphan audit row. A failed embedding is a 502 that names the model, not a 500. Every example in the batch is embedded, so this is the call an operator makes most often and the one most likely to meet a misconfigured ``router_embedding_model``. Score keys are stored canonically as ``instance:model`` (see :func:`_validated_scores`), which is the form the router canonicalizes its candidates to, so how a policy spells a candidate cannot decide whether it matches.
942942
943943
:param rank_request: (required)
944944
:type rank_request: RankRequest
@@ -1006,7 +1006,7 @@ def rank_candidates_v1_routing_preferences_rank_post_without_preload_content(
10061006
) -> RESTResponseType:
10071007
"""Rank Candidates
10081008
1009-
Record scored examples: one routing-memory record each, plus an audit row. The routing-memory record is written before its audit row for each example, because it is the load-bearing one (the router votes over it) and embedding it can fail; writing the audit row only afterwards means a failed embedding never leaves an orphan audit row. A failed embedding is a 502 that names the model, not a 500. Every example in the batch is embedded, so this is the call an operator makes most often and the one most likely to meet a misconfigured ``router_embedding_model``. Score keys are stored in the spelling the policy uses (see :func:`_validated_scores`), because the router matches them against its candidate selectors by exact string.
1009+
Record scored examples: one routing-memory record each, plus an audit row. The routing-memory record is written before its audit row for each example, because it is the load-bearing one (the router votes over it) and embedding it can fail; writing the audit row only afterwards means a failed embedding never leaves an orphan audit row. A failed embedding is a 502 that names the model, not a 500. Every example in the batch is embedded, so this is the call an operator makes most often and the one most likely to meet a misconfigured ``router_embedding_model``. Score keys are stored canonically as ``instance:model`` (see :func:`_validated_scores`), which is the form the router canonicalizes its candidates to, so how a policy spells a candidate cannot decide whether it matches.
10101010
10111011
:param rank_request: (required)
10121012
:type rank_request: RankRequest

src/otari/_client/api/usage_api.py

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from typing_extensions import Annotated
2222
from otari._client.models.external_events_request import ExternalEventsRequest
2323
from otari._client.models.external_ingest_result import ExternalIngestResult
24+
from otari._client.models.in_flight_response import InFlightResponse
2425
from otari._client.models.usage_count import UsageCount
2526
from otari._client.models.usage_delete_request import UsageDeleteRequest
2627
from otari._client.models.usage_delete_result import UsageDeleteResult
@@ -1131,6 +1132,253 @@ def _ingest_external_usage_v1_usage_external_events_post_serialize(
11311132

11321133

11331134

1135+
@validate_call
1136+
def list_in_flight_v1_usage_in_flight_get(
1137+
self,
1138+
_request_timeout: Union[
1139+
None,
1140+
Annotated[StrictFloat, Field(gt=0)],
1141+
Tuple[
1142+
Annotated[StrictFloat, Field(gt=0)],
1143+
Annotated[StrictFloat, Field(gt=0)]
1144+
]
1145+
] = None,
1146+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
1147+
_content_type: Optional[StrictStr] = None,
1148+
_headers: Optional[Dict[StrictStr, Any]] = None,
1149+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1150+
) -> InFlightResponse:
1151+
"""List In Flight
1152+
1153+
Requests the gateway is currently serving, longest-running first. A usage row is written when a request settles, so the log alone cannot answer \"is anything happening right now\": on a slow backend, a 30-second local model call is invisible until it finishes. This reports what is in progress. Read from an in-memory registry, so it describes the process that answers this call and not the deployment: behind a load balancer, consecutive polls reach different otari processes, and there is no deployment-wide total to ask for. ``total`` is the true in-flight count for the answering process even when ``requests`` is capped.
1154+
1155+
:param _request_timeout: timeout setting for this request. If one
1156+
number provided, it will be total request
1157+
timeout. It can also be a pair (tuple) of
1158+
(connection, read) timeouts.
1159+
:type _request_timeout: int, tuple(int, int), optional
1160+
:param _request_auth: set to override the auth_settings for an a single
1161+
request; this effectively ignores the
1162+
authentication in the spec for a single request.
1163+
:type _request_auth: dict, optional
1164+
:param _content_type: force content-type for the request.
1165+
:type _content_type: str, Optional
1166+
:param _headers: set to override the headers for a single
1167+
request; this effectively ignores the headers
1168+
in the spec for a single request.
1169+
:type _headers: dict, optional
1170+
:param _host_index: set to override the host_index for a single
1171+
request; this effectively ignores the host_index
1172+
in the spec for a single request.
1173+
:type _host_index: int, optional
1174+
:return: Returns the result object.
1175+
""" # noqa: E501
1176+
1177+
_param = self._list_in_flight_v1_usage_in_flight_get_serialize(
1178+
_request_auth=_request_auth,
1179+
_content_type=_content_type,
1180+
_headers=_headers,
1181+
_host_index=_host_index
1182+
)
1183+
1184+
_response_types_map: Dict[str, Optional[str]] = {
1185+
'200': "InFlightResponse",
1186+
}
1187+
response_data = self.api_client.call_api(
1188+
*_param,
1189+
_request_timeout=_request_timeout
1190+
)
1191+
response_data.read()
1192+
return self.api_client.response_deserialize(
1193+
response_data=response_data,
1194+
response_types_map=_response_types_map,
1195+
).data
1196+
1197+
1198+
@validate_call
1199+
def list_in_flight_v1_usage_in_flight_get_with_http_info(
1200+
self,
1201+
_request_timeout: Union[
1202+
None,
1203+
Annotated[StrictFloat, Field(gt=0)],
1204+
Tuple[
1205+
Annotated[StrictFloat, Field(gt=0)],
1206+
Annotated[StrictFloat, Field(gt=0)]
1207+
]
1208+
] = None,
1209+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
1210+
_content_type: Optional[StrictStr] = None,
1211+
_headers: Optional[Dict[StrictStr, Any]] = None,
1212+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1213+
) -> ApiResponse[InFlightResponse]:
1214+
"""List In Flight
1215+
1216+
Requests the gateway is currently serving, longest-running first. A usage row is written when a request settles, so the log alone cannot answer \"is anything happening right now\": on a slow backend, a 30-second local model call is invisible until it finishes. This reports what is in progress. Read from an in-memory registry, so it describes the process that answers this call and not the deployment: behind a load balancer, consecutive polls reach different otari processes, and there is no deployment-wide total to ask for. ``total`` is the true in-flight count for the answering process even when ``requests`` is capped.
1217+
1218+
:param _request_timeout: timeout setting for this request. If one
1219+
number provided, it will be total request
1220+
timeout. It can also be a pair (tuple) of
1221+
(connection, read) timeouts.
1222+
:type _request_timeout: int, tuple(int, int), optional
1223+
:param _request_auth: set to override the auth_settings for an a single
1224+
request; this effectively ignores the
1225+
authentication in the spec for a single request.
1226+
:type _request_auth: dict, optional
1227+
:param _content_type: force content-type for the request.
1228+
:type _content_type: str, Optional
1229+
:param _headers: set to override the headers for a single
1230+
request; this effectively ignores the headers
1231+
in the spec for a single request.
1232+
:type _headers: dict, optional
1233+
:param _host_index: set to override the host_index for a single
1234+
request; this effectively ignores the host_index
1235+
in the spec for a single request.
1236+
:type _host_index: int, optional
1237+
:return: Returns the result object.
1238+
""" # noqa: E501
1239+
1240+
_param = self._list_in_flight_v1_usage_in_flight_get_serialize(
1241+
_request_auth=_request_auth,
1242+
_content_type=_content_type,
1243+
_headers=_headers,
1244+
_host_index=_host_index
1245+
)
1246+
1247+
_response_types_map: Dict[str, Optional[str]] = {
1248+
'200': "InFlightResponse",
1249+
}
1250+
response_data = self.api_client.call_api(
1251+
*_param,
1252+
_request_timeout=_request_timeout
1253+
)
1254+
response_data.read()
1255+
return self.api_client.response_deserialize(
1256+
response_data=response_data,
1257+
response_types_map=_response_types_map,
1258+
)
1259+
1260+
1261+
@validate_call
1262+
def list_in_flight_v1_usage_in_flight_get_without_preload_content(
1263+
self,
1264+
_request_timeout: Union[
1265+
None,
1266+
Annotated[StrictFloat, Field(gt=0)],
1267+
Tuple[
1268+
Annotated[StrictFloat, Field(gt=0)],
1269+
Annotated[StrictFloat, Field(gt=0)]
1270+
]
1271+
] = None,
1272+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
1273+
_content_type: Optional[StrictStr] = None,
1274+
_headers: Optional[Dict[StrictStr, Any]] = None,
1275+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1276+
) -> RESTResponseType:
1277+
"""List In Flight
1278+
1279+
Requests the gateway is currently serving, longest-running first. A usage row is written when a request settles, so the log alone cannot answer \"is anything happening right now\": on a slow backend, a 30-second local model call is invisible until it finishes. This reports what is in progress. Read from an in-memory registry, so it describes the process that answers this call and not the deployment: behind a load balancer, consecutive polls reach different otari processes, and there is no deployment-wide total to ask for. ``total`` is the true in-flight count for the answering process even when ``requests`` is capped.
1280+
1281+
:param _request_timeout: timeout setting for this request. If one
1282+
number provided, it will be total request
1283+
timeout. It can also be a pair (tuple) of
1284+
(connection, read) timeouts.
1285+
:type _request_timeout: int, tuple(int, int), optional
1286+
:param _request_auth: set to override the auth_settings for an a single
1287+
request; this effectively ignores the
1288+
authentication in the spec for a single request.
1289+
:type _request_auth: dict, optional
1290+
:param _content_type: force content-type for the request.
1291+
:type _content_type: str, Optional
1292+
:param _headers: set to override the headers for a single
1293+
request; this effectively ignores the headers
1294+
in the spec for a single request.
1295+
:type _headers: dict, optional
1296+
:param _host_index: set to override the host_index for a single
1297+
request; this effectively ignores the host_index
1298+
in the spec for a single request.
1299+
:type _host_index: int, optional
1300+
:return: Returns the result object.
1301+
""" # noqa: E501
1302+
1303+
_param = self._list_in_flight_v1_usage_in_flight_get_serialize(
1304+
_request_auth=_request_auth,
1305+
_content_type=_content_type,
1306+
_headers=_headers,
1307+
_host_index=_host_index
1308+
)
1309+
1310+
_response_types_map: Dict[str, Optional[str]] = {
1311+
'200': "InFlightResponse",
1312+
}
1313+
response_data = self.api_client.call_api(
1314+
*_param,
1315+
_request_timeout=_request_timeout
1316+
)
1317+
return response_data.response
1318+
1319+
1320+
def _list_in_flight_v1_usage_in_flight_get_serialize(
1321+
self,
1322+
_request_auth,
1323+
_content_type,
1324+
_headers,
1325+
_host_index,
1326+
) -> RequestSerialized:
1327+
1328+
_host = None
1329+
1330+
_collection_formats: Dict[str, str] = {
1331+
}
1332+
1333+
_path_params: Dict[str, str] = {}
1334+
_query_params: List[Tuple[str, str]] = []
1335+
_header_params: Dict[str, Optional[str]] = _headers or {}
1336+
_form_params: List[Tuple[str, str]] = []
1337+
_files: Dict[
1338+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1339+
] = {}
1340+
_body_params: Optional[bytes] = None
1341+
1342+
# process the path parameters
1343+
# process the query parameters
1344+
# process the header parameters
1345+
# process the form parameters
1346+
# process the body parameter
1347+
1348+
1349+
# set the HTTP header `Accept`
1350+
if 'Accept' not in _header_params:
1351+
_header_params['Accept'] = self.api_client.select_header_accept(
1352+
[
1353+
'application/json'
1354+
]
1355+
)
1356+
1357+
1358+
# authentication setting
1359+
_auth_settings: List[str] = [
1360+
'XApiKeyAuth',
1361+
'ApiKeyAuth'
1362+
]
1363+
1364+
return self.api_client.param_serialize(
1365+
method='GET',
1366+
resource_path='/v1/usage/in-flight',
1367+
path_params=_path_params,
1368+
query_params=_query_params,
1369+
header_params=_header_params,
1370+
body=_body_params,
1371+
post_params=_form_params,
1372+
files=_files,
1373+
auth_settings=_auth_settings,
1374+
collection_formats=_collection_formats,
1375+
_host=_host,
1376+
_request_auth=_request_auth
1377+
)
1378+
1379+
1380+
1381+
11341382
@validate_call
11351383
def list_usage_v1_usage_get(
11361384
self,

src/otari/_client/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
from otari._client.models.img_usage_output_tokens_details import IMGUsageOutputTokensDetails
109109
from otari._client.models.image_generation_request import ImageGenerationRequest
110110
from otari._client.models.images_response import ImagesResponse
111+
from otari._client.models.in_flight_entry import InFlightEntry
112+
from otari._client.models.in_flight_response import InFlightResponse
111113
from otari._client.models.input import Input
112114
from otari._client.models.input1 import Input1
113115
from otari._client.models.key_info import KeyInfo

0 commit comments

Comments
 (0)