Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk-endpoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ GET /v1/usage/series # not yet wrapped
DELETE /v1/usage # not yet wrapped
POST /v1/usage/external-events # not yet wrapped
POST /v1/usage/set-price # not yet wrapped
GET /v1/usage/in-flight # dashboard-only, per-worker live view
# Routing policies
GET /v1/routing/policies # not yet wrapped
POST /v1/routing/policies # not yet wrapped
Expand Down
4 changes: 4 additions & 0 deletions src/otari/_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@
"IMGUsageOutputTokensDetails",
"ImageGenerationRequest",
"ImagesResponse",
"InFlightEntry",
"InFlightResponse",
"Input",
"Input1",
"KeyInfo",
Expand Down Expand Up @@ -505,6 +507,8 @@
from otari._client.models.img_usage_output_tokens_details import IMGUsageOutputTokensDetails as IMGUsageOutputTokensDetails
from otari._client.models.image_generation_request import ImageGenerationRequest as ImageGenerationRequest
from otari._client.models.images_response import ImagesResponse as ImagesResponse
from otari._client.models.in_flight_entry import InFlightEntry as InFlightEntry
from otari._client.models.in_flight_response import InFlightResponse as InFlightResponse
from otari._client.models.input import Input as Input
from otari._client.models.input1 import Input1 as Input1
from otari._client.models.key_info import KeyInfo as KeyInfo
Expand Down
6 changes: 3 additions & 3 deletions src/otari/_client/api/routing_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ def rank_candidates_v1_routing_preferences_rank_post(
) -> RankResponse:
"""Rank Candidates

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.
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.

:param rank_request: (required)
:type rank_request: RankRequest
Expand Down Expand Up @@ -938,7 +938,7 @@ def rank_candidates_v1_routing_preferences_rank_post_with_http_info(
) -> ApiResponse[RankResponse]:
"""Rank Candidates

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.
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.

:param rank_request: (required)
:type rank_request: RankRequest
Expand Down Expand Up @@ -1006,7 +1006,7 @@ def rank_candidates_v1_routing_preferences_rank_post_without_preload_content(
) -> RESTResponseType:
"""Rank Candidates

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.
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.

:param rank_request: (required)
:type rank_request: RankRequest
Expand Down
248 changes: 248 additions & 0 deletions src/otari/_client/api/usage_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from typing_extensions import Annotated
from otari._client.models.external_events_request import ExternalEventsRequest
from otari._client.models.external_ingest_result import ExternalIngestResult
from otari._client.models.in_flight_response import InFlightResponse
from otari._client.models.usage_count import UsageCount
from otari._client.models.usage_delete_request import UsageDeleteRequest
from otari._client.models.usage_delete_result import UsageDeleteResult
Expand Down Expand Up @@ -1131,6 +1132,253 @@ def _ingest_external_usage_v1_usage_external_events_post_serialize(



@validate_call
def list_in_flight_v1_usage_in_flight_get(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> InFlightResponse:
"""List In Flight

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.

:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501

_param = self._list_in_flight_v1_usage_in_flight_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)

_response_types_map: Dict[str, Optional[str]] = {
'200': "InFlightResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data


@validate_call
def list_in_flight_v1_usage_in_flight_get_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[InFlightResponse]:
"""List In Flight

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.

:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501

_param = self._list_in_flight_v1_usage_in_flight_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)

_response_types_map: Dict[str, Optional[str]] = {
'200': "InFlightResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)


@validate_call
def list_in_flight_v1_usage_in_flight_get_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List In Flight

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.

:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501

_param = self._list_in_flight_v1_usage_in_flight_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)

_response_types_map: Dict[str, Optional[str]] = {
'200': "InFlightResponse",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response


def _list_in_flight_v1_usage_in_flight_get_serialize(
self,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:

_host = None

_collection_formats: Dict[str, str] = {
}

_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None

# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter


# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)


# authentication setting
_auth_settings: List[str] = [
'XApiKeyAuth',
'ApiKeyAuth'
]

return self.api_client.param_serialize(
method='GET',
resource_path='/v1/usage/in-flight',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)




@validate_call
def list_usage_v1_usage_get(
self,
Expand Down
2 changes: 2 additions & 0 deletions src/otari/_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
from otari._client.models.img_usage_output_tokens_details import IMGUsageOutputTokensDetails
from otari._client.models.image_generation_request import ImageGenerationRequest
from otari._client.models.images_response import ImagesResponse
from otari._client.models.in_flight_entry import InFlightEntry
from otari._client.models.in_flight_response import InFlightResponse
from otari._client.models.input import Input
from otari._client.models.input1 import Input1
from otari._client.models.key_info import KeyInfo
Expand Down
Loading
Loading