diff --git a/src/otari/_client/api/organization_pricing_api.py b/src/otari/_client/api/organization_pricing_api.py index d4b5eef9..e0ba1a1f 100644 --- a/src/otari/_client/api/organization_pricing_api.py +++ b/src/otari/_client/api/organization_pricing_api.py @@ -15,7 +15,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr +from pydantic import Field, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated from uuid import UUID @@ -598,6 +598,7 @@ def _organization_pricing_delete_organization_pricing_serialize( def organization_pricing_list_organization_pricing( self, model_key: Annotated[Optional[StrictStr], Field(description="Return only this model's periods, in the canonical 'provider:model' form.")] = None, + kind: Annotated[Optional[StrictStr], Field(description="Return only overrides of this kind.")] = None, skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of records to skip")] = None, limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Maximum number of records to return")] = None, _request_timeout: Union[ @@ -619,6 +620,8 @@ def organization_pricing_list_organization_pricing( :param model_key: Return only this model's periods, in the canonical 'provider:model' form. :type model_key: str + :param kind: Return only overrides of this kind. + :type kind: str :param skip: Number of records to skip :type skip: int :param limit: Maximum number of records to return @@ -647,6 +650,7 @@ def organization_pricing_list_organization_pricing( _param = self._organization_pricing_list_organization_pricing_serialize( model_key=model_key, + kind=kind, skip=skip, limit=limit, _request_auth=_request_auth, @@ -674,6 +678,7 @@ def organization_pricing_list_organization_pricing( def organization_pricing_list_organization_pricing_with_http_info( self, model_key: Annotated[Optional[StrictStr], Field(description="Return only this model's periods, in the canonical 'provider:model' form.")] = None, + kind: Annotated[Optional[StrictStr], Field(description="Return only overrides of this kind.")] = None, skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of records to skip")] = None, limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Maximum number of records to return")] = None, _request_timeout: Union[ @@ -695,6 +700,8 @@ def organization_pricing_list_organization_pricing_with_http_info( :param model_key: Return only this model's periods, in the canonical 'provider:model' form. :type model_key: str + :param kind: Return only overrides of this kind. + :type kind: str :param skip: Number of records to skip :type skip: int :param limit: Maximum number of records to return @@ -723,6 +730,7 @@ def organization_pricing_list_organization_pricing_with_http_info( _param = self._organization_pricing_list_organization_pricing_serialize( model_key=model_key, + kind=kind, skip=skip, limit=limit, _request_auth=_request_auth, @@ -750,6 +758,7 @@ def organization_pricing_list_organization_pricing_with_http_info( def organization_pricing_list_organization_pricing_without_preload_content( self, model_key: Annotated[Optional[StrictStr], Field(description="Return only this model's periods, in the canonical 'provider:model' form.")] = None, + kind: Annotated[Optional[StrictStr], Field(description="Return only overrides of this kind.")] = None, skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of records to skip")] = None, limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Maximum number of records to return")] = None, _request_timeout: Union[ @@ -771,6 +780,8 @@ def organization_pricing_list_organization_pricing_without_preload_content( :param model_key: Return only this model's periods, in the canonical 'provider:model' form. :type model_key: str + :param kind: Return only overrides of this kind. + :type kind: str :param skip: Number of records to skip :type skip: int :param limit: Maximum number of records to return @@ -799,6 +810,7 @@ def organization_pricing_list_organization_pricing_without_preload_content( _param = self._organization_pricing_list_organization_pricing_serialize( model_key=model_key, + kind=kind, skip=skip, limit=limit, _request_auth=_request_auth, @@ -821,6 +833,7 @@ def organization_pricing_list_organization_pricing_without_preload_content( def _organization_pricing_list_organization_pricing_serialize( self, model_key, + kind, skip, limit, _request_auth, @@ -849,6 +862,10 @@ def _organization_pricing_list_organization_pricing_serialize( _query_params.append(('model_key', model_key)) + if kind is not None: + + _query_params.append(('kind', kind)) + if skip is not None: _query_params.append(('skip', skip)) diff --git a/src/otari/_client/api/pricing_api.py b/src/otari/_client/api/pricing_api.py index acec0c93..fa8896af 100644 --- a/src/otari/_client/api/pricing_api.py +++ b/src/otari/_client/api/pricing_api.py @@ -16,7 +16,7 @@ from typing_extensions import Annotated from datetime import datetime -from pydantic import Field, StrictStr +from pydantic import Field, StrictStr, field_validator from typing import List, Optional from typing_extensions import Annotated from otari._client.models.accepted_snapshot_response import AcceptedSnapshotResponse @@ -317,6 +317,7 @@ def pricing_delete_pricing( self, model_key: StrictStr, effective_at: Annotated[Optional[datetime], Field(description="ISO datetime identifying a specific pricing row to delete")] = None, + kind: Annotated[Optional[StrictStr], Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -332,12 +333,14 @@ def pricing_delete_pricing( ) -> None: """Delete Pricing - Delete pricing entries for a model. + Delete pricing entries for a model, or for a search or fetch instance. :param model_key: (required) :type model_key: str :param effective_at: ISO datetime identifying a specific pricing row to delete :type effective_at: datetime + :param kind: What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate. + :type kind: str :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 @@ -363,6 +366,7 @@ def pricing_delete_pricing( _param = self._pricing_delete_pricing_serialize( model_key=model_key, effective_at=effective_at, + kind=kind, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -389,6 +393,7 @@ def pricing_delete_pricing_with_http_info( self, model_key: StrictStr, effective_at: Annotated[Optional[datetime], Field(description="ISO datetime identifying a specific pricing row to delete")] = None, + kind: Annotated[Optional[StrictStr], Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -404,12 +409,14 @@ def pricing_delete_pricing_with_http_info( ) -> ApiResponse[None]: """Delete Pricing - Delete pricing entries for a model. + Delete pricing entries for a model, or for a search or fetch instance. :param model_key: (required) :type model_key: str :param effective_at: ISO datetime identifying a specific pricing row to delete :type effective_at: datetime + :param kind: What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate. + :type kind: str :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 @@ -435,6 +442,7 @@ def pricing_delete_pricing_with_http_info( _param = self._pricing_delete_pricing_serialize( model_key=model_key, effective_at=effective_at, + kind=kind, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -461,6 +469,7 @@ def pricing_delete_pricing_without_preload_content( self, model_key: StrictStr, effective_at: Annotated[Optional[datetime], Field(description="ISO datetime identifying a specific pricing row to delete")] = None, + kind: Annotated[Optional[StrictStr], Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -476,12 +485,14 @@ def pricing_delete_pricing_without_preload_content( ) -> RESTResponseType: """Delete Pricing - Delete pricing entries for a model. + Delete pricing entries for a model, or for a search or fetch instance. :param model_key: (required) :type model_key: str :param effective_at: ISO datetime identifying a specific pricing row to delete :type effective_at: datetime + :param kind: What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate. + :type kind: str :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 @@ -507,6 +518,7 @@ def pricing_delete_pricing_without_preload_content( _param = self._pricing_delete_pricing_serialize( model_key=model_key, effective_at=effective_at, + kind=kind, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -528,6 +540,7 @@ def _pricing_delete_pricing_serialize( self, model_key, effective_at, + kind, _request_auth, _content_type, _headers, @@ -565,6 +578,10 @@ def _pricing_delete_pricing_serialize( else: _query_params.append(('effective_at', effective_at)) + if kind is not None: + + _query_params.append(('kind', kind)) + # process the header parameters # process the form parameters # process the body parameter @@ -855,6 +872,7 @@ def pricing_get_pricing( self, model_key: StrictStr, as_of: Annotated[Optional[datetime], Field(description="ISO datetime for effective lookup")] = None, + kind: Annotated[Optional[StrictStr], Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -870,12 +888,14 @@ def pricing_get_pricing( ) -> PricingResponse: """Get Pricing - Get pricing for a specific model as of a timestamp. A 404 for a model of a hosted provider restricted to another organization than the caller's. + Get pricing for a specific model, or a search or fetch instance, as of a timestamp. A 404 for a model of a hosted provider restricted to another organization than the caller's. :param model_key: (required) :type model_key: str :param as_of: ISO datetime for effective lookup :type as_of: datetime + :param kind: What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate. + :type kind: str :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 @@ -901,6 +921,7 @@ def pricing_get_pricing( _param = self._pricing_get_pricing_serialize( model_key=model_key, as_of=as_of, + kind=kind, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -928,6 +949,7 @@ def pricing_get_pricing_with_http_info( self, model_key: StrictStr, as_of: Annotated[Optional[datetime], Field(description="ISO datetime for effective lookup")] = None, + kind: Annotated[Optional[StrictStr], Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -943,12 +965,14 @@ def pricing_get_pricing_with_http_info( ) -> ApiResponse[PricingResponse]: """Get Pricing - Get pricing for a specific model as of a timestamp. A 404 for a model of a hosted provider restricted to another organization than the caller's. + Get pricing for a specific model, or a search or fetch instance, as of a timestamp. A 404 for a model of a hosted provider restricted to another organization than the caller's. :param model_key: (required) :type model_key: str :param as_of: ISO datetime for effective lookup :type as_of: datetime + :param kind: What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate. + :type kind: str :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 @@ -974,6 +998,7 @@ def pricing_get_pricing_with_http_info( _param = self._pricing_get_pricing_serialize( model_key=model_key, as_of=as_of, + kind=kind, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1001,6 +1026,7 @@ def pricing_get_pricing_without_preload_content( self, model_key: StrictStr, as_of: Annotated[Optional[datetime], Field(description="ISO datetime for effective lookup")] = None, + kind: Annotated[Optional[StrictStr], Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1016,12 +1042,14 @@ def pricing_get_pricing_without_preload_content( ) -> RESTResponseType: """Get Pricing - Get pricing for a specific model as of a timestamp. A 404 for a model of a hosted provider restricted to another organization than the caller's. + Get pricing for a specific model, or a search or fetch instance, as of a timestamp. A 404 for a model of a hosted provider restricted to another organization than the caller's. :param model_key: (required) :type model_key: str :param as_of: ISO datetime for effective lookup :type as_of: datetime + :param kind: What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate. + :type kind: str :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 @@ -1047,6 +1075,7 @@ def pricing_get_pricing_without_preload_content( _param = self._pricing_get_pricing_serialize( model_key=model_key, as_of=as_of, + kind=kind, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1069,6 +1098,7 @@ def _pricing_get_pricing_serialize( self, model_key, as_of, + kind, _request_auth, _content_type, _headers, @@ -1106,6 +1136,10 @@ def _pricing_get_pricing_serialize( else: _query_params.append(('as_of', as_of)) + if kind is not None: + + _query_params.append(('kind', kind)) + # process the header parameters # process the form parameters # process the body parameter @@ -1148,6 +1182,7 @@ def _pricing_get_pricing_serialize( def pricing_get_pricing_history( self, model_key: StrictStr, + kind: Annotated[Optional[StrictStr], Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1163,10 +1198,12 @@ def pricing_get_pricing_history( ) -> List[PricingResponse]: """Get Pricing History - Return the full pricing history for a model. A 404 for a model of a hosted provider restricted to another organization than the caller's. + Return the full pricing history for a model, or for a search or fetch instance. A 404 for a model of a hosted provider restricted to another organization than the caller's. :param model_key: (required) :type model_key: str + :param kind: What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate. + :type kind: str :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 @@ -1191,6 +1228,7 @@ def pricing_get_pricing_history( _param = self._pricing_get_pricing_history_serialize( model_key=model_key, + kind=kind, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1217,6 +1255,7 @@ def pricing_get_pricing_history( def pricing_get_pricing_history_with_http_info( self, model_key: StrictStr, + kind: Annotated[Optional[StrictStr], Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1232,10 +1271,12 @@ def pricing_get_pricing_history_with_http_info( ) -> ApiResponse[List[PricingResponse]]: """Get Pricing History - Return the full pricing history for a model. A 404 for a model of a hosted provider restricted to another organization than the caller's. + Return the full pricing history for a model, or for a search or fetch instance. A 404 for a model of a hosted provider restricted to another organization than the caller's. :param model_key: (required) :type model_key: str + :param kind: What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate. + :type kind: str :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 @@ -1260,6 +1301,7 @@ def pricing_get_pricing_history_with_http_info( _param = self._pricing_get_pricing_history_serialize( model_key=model_key, + kind=kind, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1286,6 +1328,7 @@ def pricing_get_pricing_history_with_http_info( def pricing_get_pricing_history_without_preload_content( self, model_key: StrictStr, + kind: Annotated[Optional[StrictStr], Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1301,10 +1344,12 @@ def pricing_get_pricing_history_without_preload_content( ) -> RESTResponseType: """Get Pricing History - Return the full pricing history for a model. A 404 for a model of a hosted provider restricted to another organization than the caller's. + Return the full pricing history for a model, or for a search or fetch instance. A 404 for a model of a hosted provider restricted to another organization than the caller's. :param model_key: (required) :type model_key: str + :param kind: What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate. + :type kind: str :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 @@ -1329,6 +1374,7 @@ def pricing_get_pricing_history_without_preload_content( _param = self._pricing_get_pricing_history_serialize( model_key=model_key, + kind=kind, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1350,6 +1396,7 @@ def pricing_get_pricing_history_without_preload_content( def _pricing_get_pricing_history_serialize( self, model_key, + kind, _request_auth, _content_type, _headers, @@ -1374,6 +1421,10 @@ def _pricing_get_pricing_history_serialize( if model_key is not None: _path_params['model_key'] = model_key # process the query parameters + if kind is not None: + + _query_params.append(('kind', kind)) + # process the header parameters # process the form parameters # process the body parameter @@ -1432,7 +1483,7 @@ def pricing_list_current_pricing( ) -> CurrentPricingPage: """List Current Pricing - List the rate each priced model is metered at, one row per model key. Listing prices answers the stored history, one row per ``effective_at``, so a page of that is a page of revisions rather than a page of models. This answers one row per key: the newest rate that has taken effect, or the earliest scheduled rate for a key that has none yet. ``count`` is the number of priced models, so a caller can page without reading the collection to learn how long it is. A hosted provider restricted to another organization than the caller's is left out of both. + List the rate each priced key is metered at, one row per kind and key. Listing prices answers the stored history, one row per ``effective_at``, so a page of that is a page of revisions rather than a page of keys. This answers one row per key: the newest rate that has taken effect, or the earliest scheduled rate for a key that has none yet. Every kind is returned, a row's ``kind`` telling a model's price from a search or fetch instance's, and ``count`` is the number of priced keys of any kind, so a caller can page without reading the collection to learn how long it is. A hosted provider restricted to another organization than the caller's is left out of both. :param skip: :type skip: int @@ -1504,7 +1555,7 @@ def pricing_list_current_pricing_with_http_info( ) -> ApiResponse[CurrentPricingPage]: """List Current Pricing - List the rate each priced model is metered at, one row per model key. Listing prices answers the stored history, one row per ``effective_at``, so a page of that is a page of revisions rather than a page of models. This answers one row per key: the newest rate that has taken effect, or the earliest scheduled rate for a key that has none yet. ``count`` is the number of priced models, so a caller can page without reading the collection to learn how long it is. A hosted provider restricted to another organization than the caller's is left out of both. + List the rate each priced key is metered at, one row per kind and key. Listing prices answers the stored history, one row per ``effective_at``, so a page of that is a page of revisions rather than a page of keys. This answers one row per key: the newest rate that has taken effect, or the earliest scheduled rate for a key that has none yet. Every kind is returned, a row's ``kind`` telling a model's price from a search or fetch instance's, and ``count`` is the number of priced keys of any kind, so a caller can page without reading the collection to learn how long it is. A hosted provider restricted to another organization than the caller's is left out of both. :param skip: :type skip: int @@ -1576,7 +1627,7 @@ def pricing_list_current_pricing_without_preload_content( ) -> RESTResponseType: """List Current Pricing - List the rate each priced model is metered at, one row per model key. Listing prices answers the stored history, one row per ``effective_at``, so a page of that is a page of revisions rather than a page of models. This answers one row per key: the newest rate that has taken effect, or the earliest scheduled rate for a key that has none yet. ``count`` is the number of priced models, so a caller can page without reading the collection to learn how long it is. A hosted provider restricted to another organization than the caller's is left out of both. + List the rate each priced key is metered at, one row per kind and key. Listing prices answers the stored history, one row per ``effective_at``, so a page of that is a page of revisions rather than a page of keys. This answers one row per key: the newest rate that has taken effect, or the earliest scheduled rate for a key that has none yet. Every kind is returned, a row's ``kind`` telling a model's price from a search or fetch instance's, and ``count`` is the number of priced keys of any kind, so a caller can page without reading the collection to learn how long it is. A hosted provider restricted to another organization than the caller's is left out of both. :param skip: :type skip: int @@ -1716,7 +1767,7 @@ def pricing_list_pricing( ) -> List[PricingResponse]: """List Pricing - List all model pricing. A hosted provider restricted to another organization than the caller's is left out, as it is from the catalog. + List every stored price version, of every kind. A row's ``kind`` says whether it prices a model or a search or fetch instance. A hosted provider restricted to another organization than the caller's is left out, as it is from the catalog. :param skip: :type skip: int @@ -1788,7 +1839,7 @@ def pricing_list_pricing_with_http_info( ) -> ApiResponse[List[PricingResponse]]: """List Pricing - List all model pricing. A hosted provider restricted to another organization than the caller's is left out, as it is from the catalog. + List every stored price version, of every kind. A row's ``kind`` says whether it prices a model or a search or fetch instance. A hosted provider restricted to another organization than the caller's is left out, as it is from the catalog. :param skip: :type skip: int @@ -1860,7 +1911,7 @@ def pricing_list_pricing_without_preload_content( ) -> RESTResponseType: """List Pricing - List all model pricing. A hosted provider restricted to another organization than the caller's is left out, as it is from the catalog. + List every stored price version, of every kind. A row's ``kind`` says whether it prices a model or a search or fetch instance. A hosted provider restricted to another organization than the caller's is left out, as it is from the catalog. :param skip: :type skip: int diff --git a/src/otari/_client/models/current_pricing_page.py b/src/otari/_client/models/current_pricing_page.py index f68194ec..0685c812 100644 --- a/src/otari/_client/models/current_pricing_page.py +++ b/src/otari/_client/models/current_pricing_page.py @@ -26,7 +26,7 @@ class CurrentPricingPage(BaseModel): """ - One page of current model prices, with the total number of priced models. + One page of current prices, with the total number of priced keys of any kind. """ # noqa: E501 count: StrictInt data: List[PricingResponse] diff --git a/src/otari/_client/models/organization_model_pricing_create.py b/src/otari/_client/models/organization_model_pricing_create.py index 4f7be98a..b58e7492 100644 --- a/src/otari/_client/models/organization_model_pricing_create.py +++ b/src/otari/_client/models/organization_model_pricing_create.py @@ -28,27 +28,28 @@ class OrganizationModelPricingCreate(BaseModel): """ - Create one rate override for a model, for a period. + Create one rate override for a model, or a search or fetch instance, for a period. """ # noqa: E501 cache_read_price_per_million: Optional[Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]]] = Field(default=None, description="Price per 1M cached-input tokens") cache_write_price_per_million: Optional[Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]]] = Field(default=None, description="Price per 1M cache-write (creation) tokens") effective_from: Optional[datetime] = Field(default=None, description="ISO 8601 datetime from which this rate applies, inclusive. Defaults to now.") effective_to: Optional[datetime] = Field(default=None, description="ISO 8601 datetime at which this rate stops applying, exclusive. Null leaves it open ended. Because the end is exclusive, the next period may begin at exactly this instant without overlapping.") input_price_per_million: Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]] = Field(description="Price per 1M of the rate's unit: input tokens, requests or images") - model_key: Annotated[str, Field(min_length=1, strict=True, max_length=255)] = Field(description="Model identifier in 'provider:model' form, matching the key the deployment price list uses. A provider instance name is valid here ('home_lab:llama-3'), because pricing keys on the instance a request resolves to.") + kind: Optional[StrictStr] = Field(default=None, description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.") + model_key: Annotated[str, Field(min_length=1, strict=True, max_length=255)] = Field(description="For a model, 'provider:model', matching the key the deployment price list uses; a provider instance name is valid here ('home_lab:llama-3'), because pricing keys on the instance a request resolves to. For a search or fetch kind, the instance's name.") output_price_per_million: Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]] = Field(description="Price per 1M output tokens; unused by a rate in requests or images") pricing_tiers: Optional[List[PricingTier]] = Field(default=None, description="Whole-request context thresholds. Fields omitted by a tier inherit the base rate.") unit: Optional[StrictStr] = Field(default='tokens', description="What the rates are per: tokens for a model, requests or images for a non-token endpoint, each priced per million. A completion model priced per requests is charged one request per successful call.") - __properties: ClassVar[List[str]] = ["cache_read_price_per_million", "cache_write_price_per_million", "effective_from", "effective_to", "input_price_per_million", "model_key", "output_price_per_million", "pricing_tiers", "unit"] + __properties: ClassVar[List[str]] = ["cache_read_price_per_million", "cache_write_price_per_million", "effective_from", "effective_to", "input_price_per_million", "kind", "model_key", "output_price_per_million", "pricing_tiers", "unit"] - @field_validator('model_key') - def model_key_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not isinstance(value, str): - value = str(value) + @field_validator('kind') + def kind_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - if not re.match(r"^[^\s:\/]+[:\/][^\s]+$", value): - raise ValueError(r"must validate the regular expression /^[^\s:\/]+[:\/][^\s]+$/") + if value not in set(['model', 'search', 'fetch']): + raise ValueError("must be one of enum values ('model', 'search', 'fetch')") return value @field_validator('unit') @@ -127,6 +128,11 @@ def to_dict(self) -> Dict[str, Any]: if self.effective_to is None and "effective_to" in self.model_fields_set: _dict['effective_to'] = None + # set to None if kind (nullable) is None + # and model_fields_set contains the field + if self.kind is None and "kind" in self.model_fields_set: + _dict['kind'] = None + # set to None if pricing_tiers (nullable) is None # and model_fields_set contains the field if self.pricing_tiers is None and "pricing_tiers" in self.model_fields_set: @@ -149,6 +155,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "effective_from": obj.get("effective_from"), "effective_to": obj.get("effective_to"), "input_price_per_million": obj.get("input_price_per_million"), + "kind": obj.get("kind"), "model_key": obj.get("model_key"), "output_price_per_million": obj.get("output_price_per_million"), "pricing_tiers": [PricingTier.from_dict(_item) for _item in obj["pricing_tiers"]] if obj.get("pricing_tiers") is not None else None, diff --git a/src/otari/_client/models/organization_model_pricing_public.py b/src/otari/_client/models/organization_model_pricing_public.py index f3866f1f..ab74627f 100644 --- a/src/otari/_client/models/organization_model_pricing_public.py +++ b/src/otari/_client/models/organization_model_pricing_public.py @@ -18,7 +18,7 @@ import json from datetime import datetime -from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from otari._client.models.pricing_tier import PricingTier @@ -37,13 +37,14 @@ class OrganizationModelPricingPublic(BaseModel): effective_to: Optional[datetime] id: UUID input_price_per_million: Union[StrictFloat, StrictInt] + kind: StrictStr = Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.") model_key: StrictStr organization_id: UUID output_price_per_million: Union[StrictFloat, StrictInt] pricing_tiers: List[PricingTier] unit: StrictStr updated_at: datetime - __properties: ClassVar[List[str]] = ["cache_read_price_per_million", "cache_write_price_per_million", "created_at", "effective_from", "effective_to", "id", "input_price_per_million", "model_key", "organization_id", "output_price_per_million", "pricing_tiers", "unit", "updated_at"] + __properties: ClassVar[List[str]] = ["cache_read_price_per_million", "cache_write_price_per_million", "created_at", "effective_from", "effective_to", "id", "input_price_per_million", "kind", "model_key", "organization_id", "output_price_per_million", "pricing_tiers", "unit", "updated_at"] model_config = ConfigDict( validate_by_name=True, @@ -125,6 +126,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "effective_to": obj.get("effective_to"), "id": obj.get("id"), "input_price_per_million": obj.get("input_price_per_million"), + "kind": obj.get("kind"), "model_key": obj.get("model_key"), "organization_id": obj.get("organization_id"), "output_price_per_million": obj.get("output_price_per_million"), diff --git a/src/otari/_client/models/pricing_response.py b/src/otari/_client/models/pricing_response.py index e69a7e24..71cfffe3 100644 --- a/src/otari/_client/models/pricing_response.py +++ b/src/otari/_client/models/pricing_response.py @@ -33,13 +33,14 @@ class PricingResponse(BaseModel): created_at: StrictStr effective_at: StrictStr input_price_per_million: Union[StrictFloat, StrictInt] + kind: StrictStr = Field(description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.") model_key: StrictStr origin: Optional[StrictStr] = Field(description="Which writer set this row: config, api, or migration. Null when recorded before origins were.") output_price_per_million: Union[StrictFloat, StrictInt] pricing_tiers: List[PricingTier] unit: StrictStr = Field(description="What the rates are per: tokens, requests, or images.") updated_at: StrictStr - __properties: ClassVar[List[str]] = ["cache_read_price_per_million", "cache_write_price_per_million", "created_at", "effective_at", "input_price_per_million", "model_key", "origin", "output_price_per_million", "pricing_tiers", "unit", "updated_at"] + __properties: ClassVar[List[str]] = ["cache_read_price_per_million", "cache_write_price_per_million", "created_at", "effective_at", "input_price_per_million", "kind", "model_key", "origin", "output_price_per_million", "pricing_tiers", "unit", "updated_at"] model_config = ConfigDict( validate_by_name=True, @@ -119,6 +120,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "created_at": obj.get("created_at"), "effective_at": obj.get("effective_at"), "input_price_per_million": obj.get("input_price_per_million"), + "kind": obj.get("kind"), "model_key": obj.get("model_key"), "origin": obj.get("origin"), "output_price_per_million": obj.get("output_price_per_million"), diff --git a/src/otari/_client/models/set_pricing_request.py b/src/otari/_client/models/set_pricing_request.py index 262ffaf1..ef7a775f 100644 --- a/src/otari/_client/models/set_pricing_request.py +++ b/src/otari/_client/models/set_pricing_request.py @@ -34,11 +34,22 @@ class SetPricingRequest(BaseModel): cache_write_price_per_million: Optional[Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]]] = Field(default=None, description="Price per 1M cache-write (creation) tokens") effective_at: Optional[datetime] = Field(default=None, description="ISO 8601 datetime from which this price applies. Defaults to now if omitted.") input_price_per_million: Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]] = Field(description="Price per 1M of the rate's unit: input tokens, requests or images") - model_key: StrictStr = Field(description="Model identifier in format 'provider:model'") + kind: Optional[StrictStr] = Field(default=None, description="What the row prices: 'model' (the default), or 'search' or 'fetch' for a search or fetch instance, keyed by the instance's name and priced per call. Only the deployment operator sets a search or fetch rate.") + model_key: StrictStr = Field(description="Model identifier in format 'provider:model', or a search or fetch instance's name for those kinds") output_price_per_million: Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]] = Field(description="Price per 1M output tokens; unused by a rate in requests or images") pricing_tiers: Optional[List[PricingTier]] = Field(default=None, description="Whole-request context thresholds. Fields omitted by a tier inherit the base rate.") unit: Optional[StrictStr] = Field(default='tokens', description="What the rates are per: 'tokens' for a model, 'requests' for a gateway-run tool, a moderation call, or a completion model billed per call (USD per million requests), 'images' for image generation (USD per million images).") - __properties: ClassVar[List[str]] = ["cache_read_price_per_million", "cache_write_price_per_million", "effective_at", "input_price_per_million", "model_key", "output_price_per_million", "pricing_tiers", "unit"] + __properties: ClassVar[List[str]] = ["cache_read_price_per_million", "cache_write_price_per_million", "effective_at", "input_price_per_million", "kind", "model_key", "output_price_per_million", "pricing_tiers", "unit"] + + @field_validator('kind') + def kind_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['model', 'search', 'fetch']): + raise ValueError("must be one of enum values ('model', 'search', 'fetch')") + return value @field_validator('unit') def unit_validate_enum(cls, value): @@ -111,6 +122,11 @@ def to_dict(self) -> Dict[str, Any]: if self.effective_at is None and "effective_at" in self.model_fields_set: _dict['effective_at'] = None + # set to None if kind (nullable) is None + # and model_fields_set contains the field + if self.kind is None and "kind" in self.model_fields_set: + _dict['kind'] = None + # set to None if pricing_tiers (nullable) is None # and model_fields_set contains the field if self.pricing_tiers is None and "pricing_tiers" in self.model_fields_set: @@ -132,6 +148,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "cache_write_price_per_million": obj.get("cache_write_price_per_million"), "effective_at": obj.get("effective_at"), "input_price_per_million": obj.get("input_price_per_million"), + "kind": obj.get("kind"), "model_key": obj.get("model_key"), "output_price_per_million": obj.get("output_price_per_million"), "pricing_tiers": [PricingTier.from_dict(_item) for _item in obj["pricing_tiers"]] if obj.get("pricing_tiers") is not None else None,