From 357c87b7020c4d7d783eda04d83fe641d7773d39 Mon Sep 17 00:00:00 2001 From: tbille <2707508+tbille@users.noreply.github.com> Date: Tue, 22 Sep 2026 18:33:05 +0000 Subject: [PATCH] chore: regenerate SDK client core from Otari OpenAPI spec --- src/otari/_client/__init__.py | 14 +++ src/otari/_client/api/files_api.py | 60 +++++---- src/otari/_client/models/__init__.py | 7 ++ .../_client/models/catalog_model_detail.py | 2 +- .../_client/models/catalog_model_summary.py | 2 +- src/otari/_client/models/catalog_offering.py | 2 +- .../models/cc_cache_creation_token_details.py | 100 +++++++++++++++ .../models/cc_chat_completion_message.py | 19 ++- .../_client/models/cc_completion_usage.py | 2 +- src/otari/_client/models/cc_image_content.py | 101 ++++++++++++++++ src/otari/_client/models/cc_image_url.py | 88 ++++++++++++++ .../models/cc_prompt_tokens_details.py | 24 +++- .../cck_cache_creation_token_details.py | 100 +++++++++++++++ src/otari/_client/models/cck_choice_delta.py | 30 ++++- .../_client/models/cck_choice_delta_audio.py | 114 ++++++++++++++++++ .../_client/models/cck_completion_usage.py | 2 +- src/otari/_client/models/cck_image_content.py | 101 ++++++++++++++++ src/otari/_client/models/cck_image_url.py | 88 ++++++++++++++ .../models/cck_prompt_tokens_details.py | 24 +++- .../_client/models/selector_index_response.py | 6 +- .../_client/models/tool_setting_field.py | 16 +-- .../workspace_code_execution_policy_update.py | 2 +- 22 files changed, 856 insertions(+), 48 deletions(-) create mode 100644 src/otari/_client/models/cc_cache_creation_token_details.py create mode 100644 src/otari/_client/models/cc_image_content.py create mode 100644 src/otari/_client/models/cc_image_url.py create mode 100644 src/otari/_client/models/cck_cache_creation_token_details.py create mode 100644 src/otari/_client/models/cck_choice_delta_audio.py create mode 100644 src/otari/_client/models/cck_image_content.py create mode 100644 src/otari/_client/models/cck_image_url.py diff --git a/src/otari/_client/__init__.py b/src/otari/_client/__init__.py index 6f738a6f..a0aa0244 100644 --- a/src/otari/_client/__init__.py +++ b/src/otari/_client/__init__.py @@ -120,6 +120,7 @@ "BudgetResponse", "BuiltInGuardrailCatalog", "BuiltInGuardrailSpec", + "CCCacheCreationTokenDetails", "CCChatCompletionAudio", "CCChatCompletionMessage", "CCChatCompletionMessageCustomToolCall", @@ -133,8 +134,12 @@ "CCCustom", "CCFunction", "CCFunctionCall", + "CCImageContent", + "CCImageURL", + "CCKCacheCreationTokenDetails", "CCKChatCompletionTokenLogprob", "CCKChoiceDelta", + "CCKChoiceDeltaAudio", "CCKChoiceDeltaFunctionCall", "CCKChoiceDeltaToolCall", "CCKChoiceDeltaToolCallFunction", @@ -142,6 +147,8 @@ "CCKChunkChoice", "CCKCompletionTokensDetails", "CCKCompletionUsage", + "CCKImageContent", + "CCKImageURL", "CCKPromptTokensDetails", "CCKTopLogprob", "CCPromptTokensDetails", @@ -737,6 +744,7 @@ from otari._client.models.budget_response import BudgetResponse as BudgetResponse from otari._client.models.built_in_guardrail_catalog import BuiltInGuardrailCatalog as BuiltInGuardrailCatalog from otari._client.models.built_in_guardrail_spec import BuiltInGuardrailSpec as BuiltInGuardrailSpec +from otari._client.models.cc_cache_creation_token_details import CCCacheCreationTokenDetails as CCCacheCreationTokenDetails from otari._client.models.cc_chat_completion_audio import CCChatCompletionAudio as CCChatCompletionAudio from otari._client.models.cc_chat_completion_message import CCChatCompletionMessage as CCChatCompletionMessage from otari._client.models.cc_chat_completion_message_custom_tool_call import CCChatCompletionMessageCustomToolCall as CCChatCompletionMessageCustomToolCall @@ -750,8 +758,12 @@ from otari._client.models.cc_custom import CCCustom as CCCustom from otari._client.models.cc_function import CCFunction as CCFunction from otari._client.models.cc_function_call import CCFunctionCall as CCFunctionCall +from otari._client.models.cc_image_content import CCImageContent as CCImageContent +from otari._client.models.cc_image_url import CCImageURL as CCImageURL +from otari._client.models.cck_cache_creation_token_details import CCKCacheCreationTokenDetails as CCKCacheCreationTokenDetails from otari._client.models.cck_chat_completion_token_logprob import CCKChatCompletionTokenLogprob as CCKChatCompletionTokenLogprob from otari._client.models.cck_choice_delta import CCKChoiceDelta as CCKChoiceDelta +from otari._client.models.cck_choice_delta_audio import CCKChoiceDeltaAudio as CCKChoiceDeltaAudio from otari._client.models.cck_choice_delta_function_call import CCKChoiceDeltaFunctionCall as CCKChoiceDeltaFunctionCall from otari._client.models.cck_choice_delta_tool_call import CCKChoiceDeltaToolCall as CCKChoiceDeltaToolCall from otari._client.models.cck_choice_delta_tool_call_function import CCKChoiceDeltaToolCallFunction as CCKChoiceDeltaToolCallFunction @@ -759,6 +771,8 @@ from otari._client.models.cck_chunk_choice import CCKChunkChoice as CCKChunkChoice from otari._client.models.cck_completion_tokens_details import CCKCompletionTokensDetails as CCKCompletionTokensDetails from otari._client.models.cck_completion_usage import CCKCompletionUsage as CCKCompletionUsage +from otari._client.models.cck_image_content import CCKImageContent as CCKImageContent +from otari._client.models.cck_image_url import CCKImageURL as CCKImageURL from otari._client.models.cck_prompt_tokens_details import CCKPromptTokensDetails as CCKPromptTokensDetails from otari._client.models.cck_top_logprob import CCKTopLogprob as CCKTopLogprob from otari._client.models.cc_prompt_tokens_details import CCPromptTokensDetails as CCPromptTokensDetails diff --git a/src/otari/_client/api/files_api.py b/src/otari/_client/api/files_api.py index 8dd17f0d..3dc96670 100644 --- a/src/otari/_client/api/files_api.py +++ b/src/otari/_client/api/files_api.py @@ -16,7 +16,7 @@ from typing_extensions import Annotated from pydantic import Field, StrictBytes, StrictStr, field_validator -from typing import Any, Dict, Optional, Tuple, Union +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from uuid import UUID @@ -1202,8 +1202,9 @@ def files_list_files( workspace_id: Optional[UUID] = None, limit: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = None, after: Optional[StrictStr] = None, - after_id: Optional[StrictStr] = None, order: Optional[StrictStr] = None, + page: Optional[StrictStr] = None, + ids: Optional[List[StrictStr]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1219,7 +1220,7 @@ def files_list_files( ) -> Dict[str, object]: """List Files - List the authenticated user's uploaded files in the request's workspace. ``workspace_id`` narrows a master-key listing to one workspace; a keyed request is already confined to its key's own and cannot widen or move it. Pages are cursor-based: ``after`` (OpenAI) or ``after_id`` (Anthropic) names the last file of the previous page, and ``has_more`` says whether to ask again. A cursor that has since been deleted or has expired is still a position; one the caller never owned is a 404. + List the authenticated user's uploaded files in the request's workspace. ``workspace_id`` narrows a master-key listing to one workspace; a keyed request is already confined to its key's own and cannot widen or move it. Each flavor pages with its own cursor. OpenAI's ``after`` names the last file of the previous page, and ``has_more`` says whether to ask again. Anthropic's ``next_page`` is passed back as ``page``, and ``ids[]`` reads up to 100 named files in one page. A cursor whose file has since been deleted or has expired is still a position. An ``after`` the caller never owned is a 404, and a ``page`` token this gateway did not issue is a 400. :param user: :type user: str @@ -1231,10 +1232,12 @@ def files_list_files( :type limit: int :param after: :type after: str - :param after_id: - :type after_id: str :param order: :type order: str + :param page: + :type page: str + :param ids: + :type ids: List[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 @@ -1263,8 +1266,9 @@ def files_list_files( workspace_id=workspace_id, limit=limit, after=after, - after_id=after_id, order=order, + page=page, + ids=ids, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1294,8 +1298,9 @@ def files_list_files_with_http_info( workspace_id: Optional[UUID] = None, limit: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = None, after: Optional[StrictStr] = None, - after_id: Optional[StrictStr] = None, order: Optional[StrictStr] = None, + page: Optional[StrictStr] = None, + ids: Optional[List[StrictStr]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1311,7 +1316,7 @@ def files_list_files_with_http_info( ) -> ApiResponse[Dict[str, object]]: """List Files - List the authenticated user's uploaded files in the request's workspace. ``workspace_id`` narrows a master-key listing to one workspace; a keyed request is already confined to its key's own and cannot widen or move it. Pages are cursor-based: ``after`` (OpenAI) or ``after_id`` (Anthropic) names the last file of the previous page, and ``has_more`` says whether to ask again. A cursor that has since been deleted or has expired is still a position; one the caller never owned is a 404. + List the authenticated user's uploaded files in the request's workspace. ``workspace_id`` narrows a master-key listing to one workspace; a keyed request is already confined to its key's own and cannot widen or move it. Each flavor pages with its own cursor. OpenAI's ``after`` names the last file of the previous page, and ``has_more`` says whether to ask again. Anthropic's ``next_page`` is passed back as ``page``, and ``ids[]`` reads up to 100 named files in one page. A cursor whose file has since been deleted or has expired is still a position. An ``after`` the caller never owned is a 404, and a ``page`` token this gateway did not issue is a 400. :param user: :type user: str @@ -1323,10 +1328,12 @@ def files_list_files_with_http_info( :type limit: int :param after: :type after: str - :param after_id: - :type after_id: str :param order: :type order: str + :param page: + :type page: str + :param ids: + :type ids: List[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 @@ -1355,8 +1362,9 @@ def files_list_files_with_http_info( workspace_id=workspace_id, limit=limit, after=after, - after_id=after_id, order=order, + page=page, + ids=ids, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1386,8 +1394,9 @@ def files_list_files_without_preload_content( workspace_id: Optional[UUID] = None, limit: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = None, after: Optional[StrictStr] = None, - after_id: Optional[StrictStr] = None, order: Optional[StrictStr] = None, + page: Optional[StrictStr] = None, + ids: Optional[List[StrictStr]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1403,7 +1412,7 @@ def files_list_files_without_preload_content( ) -> RESTResponseType: """List Files - List the authenticated user's uploaded files in the request's workspace. ``workspace_id`` narrows a master-key listing to one workspace; a keyed request is already confined to its key's own and cannot widen or move it. Pages are cursor-based: ``after`` (OpenAI) or ``after_id`` (Anthropic) names the last file of the previous page, and ``has_more`` says whether to ask again. A cursor that has since been deleted or has expired is still a position; one the caller never owned is a 404. + List the authenticated user's uploaded files in the request's workspace. ``workspace_id`` narrows a master-key listing to one workspace; a keyed request is already confined to its key's own and cannot widen or move it. Each flavor pages with its own cursor. OpenAI's ``after`` names the last file of the previous page, and ``has_more`` says whether to ask again. Anthropic's ``next_page`` is passed back as ``page``, and ``ids[]`` reads up to 100 named files in one page. A cursor whose file has since been deleted or has expired is still a position. An ``after`` the caller never owned is a 404, and a ``page`` token this gateway did not issue is a 400. :param user: :type user: str @@ -1415,10 +1424,12 @@ def files_list_files_without_preload_content( :type limit: int :param after: :type after: str - :param after_id: - :type after_id: str :param order: :type order: str + :param page: + :type page: str + :param ids: + :type ids: List[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 @@ -1447,8 +1458,9 @@ def files_list_files_without_preload_content( workspace_id=workspace_id, limit=limit, after=after, - after_id=after_id, order=order, + page=page, + ids=ids, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1473,8 +1485,9 @@ def _files_list_files_serialize( workspace_id, limit, after, - after_id, order, + page, + ids, _request_auth, _content_type, _headers, @@ -1484,6 +1497,7 @@ def _files_list_files_serialize( _host = None _collection_formats: Dict[str, str] = { + 'ids[]': 'multi', } _path_params: Dict[str, str] = {} @@ -1517,14 +1531,18 @@ def _files_list_files_serialize( _query_params.append(('after', after)) - if after_id is not None: - - _query_params.append(('after_id', after_id)) - if order is not None: _query_params.append(('order', order)) + if page is not None: + + _query_params.append(('page', page)) + + if ids is not None: + + _query_params.append(('ids[]', ids)) + # process the header parameters # process the form parameters # process the body parameter diff --git a/src/otari/_client/models/__init__.py b/src/otari/_client/models/__init__.py index 148f2e08..7f1d55f1 100644 --- a/src/otari/_client/models/__init__.py +++ b/src/otari/_client/models/__init__.py @@ -55,6 +55,7 @@ from otari._client.models.budget_response import BudgetResponse from otari._client.models.built_in_guardrail_catalog import BuiltInGuardrailCatalog from otari._client.models.built_in_guardrail_spec import BuiltInGuardrailSpec +from otari._client.models.cc_cache_creation_token_details import CCCacheCreationTokenDetails from otari._client.models.cc_chat_completion_audio import CCChatCompletionAudio from otari._client.models.cc_chat_completion_message import CCChatCompletionMessage from otari._client.models.cc_chat_completion_message_custom_tool_call import CCChatCompletionMessageCustomToolCall @@ -68,8 +69,12 @@ from otari._client.models.cc_custom import CCCustom from otari._client.models.cc_function import CCFunction from otari._client.models.cc_function_call import CCFunctionCall +from otari._client.models.cc_image_content import CCImageContent +from otari._client.models.cc_image_url import CCImageURL +from otari._client.models.cck_cache_creation_token_details import CCKCacheCreationTokenDetails from otari._client.models.cck_chat_completion_token_logprob import CCKChatCompletionTokenLogprob from otari._client.models.cck_choice_delta import CCKChoiceDelta +from otari._client.models.cck_choice_delta_audio import CCKChoiceDeltaAudio from otari._client.models.cck_choice_delta_function_call import CCKChoiceDeltaFunctionCall from otari._client.models.cck_choice_delta_tool_call import CCKChoiceDeltaToolCall from otari._client.models.cck_choice_delta_tool_call_function import CCKChoiceDeltaToolCallFunction @@ -77,6 +82,8 @@ from otari._client.models.cck_chunk_choice import CCKChunkChoice from otari._client.models.cck_completion_tokens_details import CCKCompletionTokensDetails from otari._client.models.cck_completion_usage import CCKCompletionUsage +from otari._client.models.cck_image_content import CCKImageContent +from otari._client.models.cck_image_url import CCKImageURL from otari._client.models.cck_prompt_tokens_details import CCKPromptTokensDetails from otari._client.models.cck_top_logprob import CCKTopLogprob from otari._client.models.cc_prompt_tokens_details import CCPromptTokensDetails diff --git a/src/otari/_client/models/catalog_model_detail.py b/src/otari/_client/models/catalog_model_detail.py index b41c4be4..7a97d758 100644 --- a/src/otari/_client/models/catalog_model_detail.py +++ b/src/otari/_client/models/catalog_model_detail.py @@ -54,7 +54,7 @@ class CatalogModelDetail(BaseModel): providers: List[StrictStr] = Field(description="The provider instances offering it, sorted.") release_date: Optional[StrictStr] = None resolves_to: Optional[StrictStr] = Field(default=None, description="The offering `selector` resolves to.") - selector: Optional[StrictStr] = Field(default=None, description="The id as a selector: send it as `model` and the model's cheapest offering answers. Null until the gateway has indexed the catalog.") + selector: Optional[StrictStr] = Field(default=None, description="The id as a selector: send it as `model` and the model's cheapest offering the caller can reach answers, the vendor's own provider first where it serves the model. Null until the gateway has indexed the catalog.") selectors: List[StrictStr] = Field(description="Every offering's selector, so the list can be searched by one.") unpriced_count: StrictInt = Field(description="How many offerings carry no price for this caller.") vendor: Optional[StrictStr] diff --git a/src/otari/_client/models/catalog_model_summary.py b/src/otari/_client/models/catalog_model_summary.py index 21a7d40e..b892859a 100644 --- a/src/otari/_client/models/catalog_model_summary.py +++ b/src/otari/_client/models/catalog_model_summary.py @@ -49,7 +49,7 @@ class CatalogModelSummary(BaseModel): providers: List[StrictStr] = Field(description="The provider instances offering it, sorted.") release_date: Optional[StrictStr] = None resolves_to: Optional[StrictStr] = Field(default=None, description="The offering `selector` resolves to.") - selector: Optional[StrictStr] = Field(default=None, description="The id as a selector: send it as `model` and the model's cheapest offering answers. Null until the gateway has indexed the catalog.") + selector: Optional[StrictStr] = Field(default=None, description="The id as a selector: send it as `model` and the model's cheapest offering the caller can reach answers, the vendor's own provider first where it serves the model. Null until the gateway has indexed the catalog.") selectors: List[StrictStr] = Field(description="Every offering's selector, so the list can be searched by one.") unpriced_count: StrictInt = Field(description="How many offerings carry no price for this caller.") vendor: Optional[StrictStr] diff --git a/src/otari/_client/models/catalog_offering.py b/src/otari/_client/models/catalog_offering.py index 30717099..bf77d318 100644 --- a/src/otari/_client/models/catalog_offering.py +++ b/src/otari/_client/models/catalog_offering.py @@ -43,7 +43,7 @@ class CatalogOffering(BaseModel): provider_type: StrictStr = Field(description="The any-llm implementation behind the instance.") quantization: Optional[StrictStr] = Field(default=None, description="From the provider's id, when it names one.") selector: StrictStr = Field(description="What to send as `model`, in `instance:model` form.") - short_selector: Optional[StrictStr] = Field(default=None, description="A shorter spelling the gateway also accepts: the instance with the model's cleaned id (`fireworks:gpt-oss-120b`). Null where two offerings on the instance would share it, or until the gateway has indexed the catalog.") + short_selector: Optional[StrictStr] = Field(default=None, description="The pinned spelling the gateway also accepts for this offering: the instance with the model's catalog id (`fireworks:openai/gpt-oss-120b`), which pins the instance and reaches the model's cheapest offering on it. Null for a dearer sibling on the same instance, or until the gateway has indexed the catalog.") usage_30d: Optional[OfferingUsage] = None __properties: ClassVar[List[str]] = ["context_window", "credential", "discovered", "max_output_tokens", "metadata_input_price_per_million", "metadata_output_price_per_million", "price_reference", "price_source", "pricing", "provider", "provider_type", "quantization", "selector", "short_selector", "usage_30d"] diff --git a/src/otari/_client/models/cc_cache_creation_token_details.py b/src/otari/_client/models/cc_cache_creation_token_details.py new file mode 100644 index 00000000..a302fc32 --- /dev/null +++ b/src/otari/_client/models/cc_cache_creation_token_details.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + otari + + Otari, an OpenAI-compatible LLM gateway with API key management + + The version of the OpenAPI document: 0.0.0-dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CCCacheCreationTokenDetails(BaseModel): + """ + Cache writes split by time-to-live, as Anthropic reports them. + """ # noqa: E501 + ephemeral_5m_input_tokens: Optional[StrictInt] = Field(default=None, description="Filter to a single failure status code (e.g. 429 for provider rate limits, 402 for missing-pricing rejections). Only error rows carry one, so this filter also restricts to status='error' unless 'status' is given explicitly") + ephemeral_1h_input_tokens: Optional[StrictInt] = Field(default=None, description="Filter to a single failure status code (e.g. 429 for provider rate limits, 402 for missing-pricing rejections). Only error rows carry one, so this filter also restricts to status='error' unless 'status' is given explicitly") + __properties: ClassVar[List[str]] = ["ephemeral_5m_input_tokens", "ephemeral_1h_input_tokens"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CCCacheCreationTokenDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if ephemeral_5m_input_tokens (nullable) is None + # and model_fields_set contains the field + if self.ephemeral_5m_input_tokens is None and "ephemeral_5m_input_tokens" in self.model_fields_set: + _dict['ephemeral_5m_input_tokens'] = None + + # set to None if ephemeral_1h_input_tokens (nullable) is None + # and model_fields_set contains the field + if self.ephemeral_1h_input_tokens is None and "ephemeral_1h_input_tokens" in self.model_fields_set: + _dict['ephemeral_1h_input_tokens'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CCCacheCreationTokenDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ephemeral_5m_input_tokens": obj.get("ephemeral_5m_input_tokens"), + "ephemeral_1h_input_tokens": obj.get("ephemeral_1h_input_tokens") + }) + return _obj + + diff --git a/src/otari/_client/models/cc_chat_completion_message.py b/src/otari/_client/models/cc_chat_completion_message.py index 877fd26e..b24ec504 100644 --- a/src/otari/_client/models/cc_chat_completion_message.py +++ b/src/otari/_client/models/cc_chat_completion_message.py @@ -22,6 +22,7 @@ from otari._client.models.cc_chat_completion_audio import CCChatCompletionAudio from otari._client.models.cc_chat_completion_message_tool_calls_inner import CCChatCompletionMessageToolCallsInner from otari._client.models.cc_function_call import CCFunctionCall +from otari._client.models.cc_image_content import CCImageContent from typing import Optional, Set from typing_extensions import Self from pydantic_core import to_jsonable_python @@ -39,8 +40,9 @@ class CCChatCompletionMessage(BaseModel): tool_calls: Optional[List[CCChatCompletionMessageToolCallsInner]] = None reasoning: Optional[StrictStr] = Field(default=None, description="Filter to a single event type or metric name (e.g. 'tool_result', 'claude_code.commit.count')") extra_content: Optional[Dict[str, Any]] = Field(default=None, description="Provider-native request fields used as defaults (e.g. exa's 'type', searxng's 'engines').") + images: Optional[List[CCImageContent]] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["content", "refusal", "role", "annotations", "audio", "function_call", "tool_calls", "reasoning", "extra_content"] + __properties: ClassVar[List[str]] = ["content", "refusal", "role", "annotations", "audio", "function_call", "tool_calls", "reasoning", "extra_content", "images"] @field_validator('role') def role_validate_enum(cls, value): @@ -103,6 +105,13 @@ def to_dict(self) -> Dict[str, Any]: if _item_tool_calls: _items.append(_item_tool_calls.to_dict()) _dict['tool_calls'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in images (list) + _items = [] + if self.images: + for _item_images in self.images: + if _item_images: + _items.append(_item_images.to_dict()) + _dict['images'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -148,6 +157,11 @@ def to_dict(self) -> Dict[str, Any]: if self.extra_content is None and "extra_content" in self.model_fields_set: _dict['extra_content'] = None + # set to None if images (nullable) is None + # and model_fields_set contains the field + if self.images is None and "images" in self.model_fields_set: + _dict['images'] = None + return _dict @classmethod @@ -168,7 +182,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "function_call": CCFunctionCall.from_dict(obj["function_call"]) if obj.get("function_call") is not None else None, "tool_calls": [CCChatCompletionMessageToolCallsInner.from_dict(_item) for _item in obj["tool_calls"]] if obj.get("tool_calls") is not None else None, "reasoning": obj.get("reasoning"), - "extra_content": obj.get("extra_content") + "extra_content": obj.get("extra_content"), + "images": [CCImageContent.from_dict(_item) for _item in obj["images"]] if obj.get("images") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/otari/_client/models/cc_completion_usage.py b/src/otari/_client/models/cc_completion_usage.py index fa7f7ebb..ba83da47 100644 --- a/src/otari/_client/models/cc_completion_usage.py +++ b/src/otari/_client/models/cc_completion_usage.py @@ -27,7 +27,7 @@ class CCCompletionUsage(BaseModel): """ - Usage statistics for the completion request. + CCCompletionUsage """ # noqa: E501 completion_tokens: StrictInt prompt_tokens: StrictInt diff --git a/src/otari/_client/models/cc_image_content.py b/src/otari/_client/models/cc_image_content.py new file mode 100644 index 00000000..3c622126 --- /dev/null +++ b/src/otari/_client/models/cc_image_content.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + otari + + Otari, an OpenAI-compatible LLM gateway with API key management + + The version of the OpenAPI document: 0.0.0-dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from otari._client.models.cc_image_url import CCImageURL +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CCImageContent(BaseModel): + """ + OpenAI-compatible image response content. + """ # noqa: E501 + type: StrictStr + image_url: CCImageURL + __properties: ClassVar[List[str]] = ["type", "image_url"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['image_url']): + raise ValueError("must be one of enum values ('image_url')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CCImageContent from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of image_url + if self.image_url: + _dict['image_url'] = self.image_url.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CCImageContent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "image_url": CCImageURL.from_dict(obj["image_url"]) if obj.get("image_url") is not None else None + }) + return _obj + + diff --git a/src/otari/_client/models/cc_image_url.py b/src/otari/_client/models/cc_image_url.py new file mode 100644 index 00000000..45022e35 --- /dev/null +++ b/src/otari/_client/models/cc_image_url.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + otari + + Otari, an OpenAI-compatible LLM gateway with API key management + + The version of the OpenAPI document: 0.0.0-dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CCImageURL(BaseModel): + """ + OpenAI-compatible URL for an image response part. + """ # noqa: E501 + url: StrictStr + __properties: ClassVar[List[str]] = ["url"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CCImageURL from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CCImageURL from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url") + }) + return _obj + + diff --git a/src/otari/_client/models/cc_prompt_tokens_details.py b/src/otari/_client/models/cc_prompt_tokens_details.py index 024c5cb5..4e8155d3 100644 --- a/src/otari/_client/models/cc_prompt_tokens_details.py +++ b/src/otari/_client/models/cc_prompt_tokens_details.py @@ -19,18 +19,21 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt from typing import Any, ClassVar, Dict, List, Optional +from otari._client.models.cc_cache_creation_token_details import CCCacheCreationTokenDetails from typing import Optional, Set from typing_extensions import Self from pydantic_core import to_jsonable_python class CCPromptTokensDetails(BaseModel): """ - Breakdown of tokens used in the prompt. + OpenAI prompt token breakdown extended with the TTL split of cache writes. As in OpenAI, ``cached_tokens`` and ``cache_write_tokens`` are subsets of ``prompt_tokens``. """ # noqa: E501 audio_tokens: Optional[StrictInt] = None cached_tokens: Optional[StrictInt] = Field(default=None, description="Filter to a single failure status code (e.g. 429 for provider rate limits, 402 for missing-pricing rejections). Only error rows carry one, so this filter also restricts to status='error' unless 'status' is given explicitly") + cache_write_tokens: Optional[StrictInt] = None + cache_creation_token_details: Optional[CCCacheCreationTokenDetails] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["audio_tokens", "cached_tokens"] + __properties: ClassVar[List[str]] = ["audio_tokens", "cached_tokens", "cache_write_tokens", "cache_creation_token_details"] model_config = ConfigDict( validate_by_name=True, @@ -73,6 +76,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of cache_creation_token_details + if self.cache_creation_token_details: + _dict['cache_creation_token_details'] = self.cache_creation_token_details.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -88,6 +94,16 @@ def to_dict(self) -> Dict[str, Any]: if self.cached_tokens is None and "cached_tokens" in self.model_fields_set: _dict['cached_tokens'] = None + # set to None if cache_write_tokens (nullable) is None + # and model_fields_set contains the field + if self.cache_write_tokens is None and "cache_write_tokens" in self.model_fields_set: + _dict['cache_write_tokens'] = None + + # set to None if cache_creation_token_details (nullable) is None + # and model_fields_set contains the field + if self.cache_creation_token_details is None and "cache_creation_token_details" in self.model_fields_set: + _dict['cache_creation_token_details'] = None + return _dict @classmethod @@ -101,7 +117,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "audio_tokens": obj.get("audio_tokens"), - "cached_tokens": obj.get("cached_tokens") + "cached_tokens": obj.get("cached_tokens"), + "cache_write_tokens": obj.get("cache_write_tokens"), + "cache_creation_token_details": CCCacheCreationTokenDetails.from_dict(obj["cache_creation_token_details"]) if obj.get("cache_creation_token_details") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/otari/_client/models/cck_cache_creation_token_details.py b/src/otari/_client/models/cck_cache_creation_token_details.py new file mode 100644 index 00000000..b3d15d0b --- /dev/null +++ b/src/otari/_client/models/cck_cache_creation_token_details.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + otari + + Otari, an OpenAI-compatible LLM gateway with API key management + + The version of the OpenAPI document: 0.0.0-dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CCKCacheCreationTokenDetails(BaseModel): + """ + Cache writes split by time-to-live, as Anthropic reports them. + """ # noqa: E501 + ephemeral_5m_input_tokens: Optional[StrictInt] = None + ephemeral_1h_input_tokens: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["ephemeral_5m_input_tokens", "ephemeral_1h_input_tokens"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CCKCacheCreationTokenDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if ephemeral_5m_input_tokens (nullable) is None + # and model_fields_set contains the field + if self.ephemeral_5m_input_tokens is None and "ephemeral_5m_input_tokens" in self.model_fields_set: + _dict['ephemeral_5m_input_tokens'] = None + + # set to None if ephemeral_1h_input_tokens (nullable) is None + # and model_fields_set contains the field + if self.ephemeral_1h_input_tokens is None and "ephemeral_1h_input_tokens" in self.model_fields_set: + _dict['ephemeral_1h_input_tokens'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CCKCacheCreationTokenDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ephemeral_5m_input_tokens": obj.get("ephemeral_5m_input_tokens"), + "ephemeral_1h_input_tokens": obj.get("ephemeral_1h_input_tokens") + }) + return _obj + + diff --git a/src/otari/_client/models/cck_choice_delta.py b/src/otari/_client/models/cck_choice_delta.py index c7b8152c..944a8758 100644 --- a/src/otari/_client/models/cck_choice_delta.py +++ b/src/otari/_client/models/cck_choice_delta.py @@ -19,8 +19,10 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional +from otari._client.models.cck_choice_delta_audio import CCKChoiceDeltaAudio from otari._client.models.cck_choice_delta_function_call import CCKChoiceDeltaFunctionCall from otari._client.models.cck_choice_delta_tool_call import CCKChoiceDeltaToolCall +from otari._client.models.cck_image_content import CCKImageContent from typing import Optional, Set from typing_extensions import Self from pydantic_core import to_jsonable_python @@ -36,8 +38,10 @@ class CCKChoiceDelta(BaseModel): tool_calls: Optional[List[CCKChoiceDeltaToolCall]] = None reasoning: Optional[StrictStr] = Field(default=None, description="Filter to a single event type or metric name (e.g. 'tool_result', 'claude_code.commit.count')") extra_content: Optional[Dict[str, Any]] = None + images: Optional[List[CCKImageContent]] = None + audio: Optional[CCKChoiceDeltaAudio] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["content", "function_call", "refusal", "role", "tool_calls", "reasoning", "extra_content"] + __properties: ClassVar[List[str]] = ["content", "function_call", "refusal", "role", "tool_calls", "reasoning", "extra_content", "images", "audio"] @field_validator('role') def role_validate_enum(cls, value): @@ -100,6 +104,16 @@ def to_dict(self) -> Dict[str, Any]: if _item_tool_calls: _items.append(_item_tool_calls.to_dict()) _dict['tool_calls'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in images (list) + _items = [] + if self.images: + for _item_images in self.images: + if _item_images: + _items.append(_item_images.to_dict()) + _dict['images'] = _items + # override the default output from pydantic by calling `to_dict()` of audio + if self.audio: + _dict['audio'] = self.audio.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -140,6 +154,16 @@ def to_dict(self) -> Dict[str, Any]: if self.extra_content is None and "extra_content" in self.model_fields_set: _dict['extra_content'] = None + # set to None if images (nullable) is None + # and model_fields_set contains the field + if self.images is None and "images" in self.model_fields_set: + _dict['images'] = None + + # set to None if audio (nullable) is None + # and model_fields_set contains the field + if self.audio is None and "audio" in self.model_fields_set: + _dict['audio'] = None + return _dict @classmethod @@ -158,7 +182,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "role": obj.get("role"), "tool_calls": [CCKChoiceDeltaToolCall.from_dict(_item) for _item in obj["tool_calls"]] if obj.get("tool_calls") is not None else None, "reasoning": obj.get("reasoning"), - "extra_content": obj.get("extra_content") + "extra_content": obj.get("extra_content"), + "images": [CCKImageContent.from_dict(_item) for _item in obj["images"]] if obj.get("images") is not None else None, + "audio": CCKChoiceDeltaAudio.from_dict(obj["audio"]) if obj.get("audio") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/otari/_client/models/cck_choice_delta_audio.py b/src/otari/_client/models/cck_choice_delta_audio.py new file mode 100644 index 00000000..c605d02f --- /dev/null +++ b/src/otari/_client/models/cck_choice_delta_audio.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + otari + + Otari, an OpenAI-compatible LLM gateway with API key management + + The version of the OpenAPI document: 0.0.0-dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CCKChoiceDeltaAudio(BaseModel): + """ + Partial audio object emitted by a streaming chat completion. Providers may send the identifier, transcript, data, and expiration timestamp in separate chunks, so every field is optional. The data field contains the base64-encoded bytes for the current chunk. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Filter to a single event type or metric name (e.g. 'tool_result', 'claude_code.commit.count')") + data: Optional[StrictStr] = None + transcript: Optional[StrictStr] = None + expires_at: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["id", "data", "transcript", "expires_at"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CCKChoiceDeltaAudio from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if transcript (nullable) is None + # and model_fields_set contains the field + if self.transcript is None and "transcript" in self.model_fields_set: + _dict['transcript'] = None + + # set to None if expires_at (nullable) is None + # and model_fields_set contains the field + if self.expires_at is None and "expires_at" in self.model_fields_set: + _dict['expires_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CCKChoiceDeltaAudio from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "data": obj.get("data"), + "transcript": obj.get("transcript"), + "expires_at": obj.get("expires_at") + }) + return _obj + + diff --git a/src/otari/_client/models/cck_completion_usage.py b/src/otari/_client/models/cck_completion_usage.py index be68c7e0..7375c747 100644 --- a/src/otari/_client/models/cck_completion_usage.py +++ b/src/otari/_client/models/cck_completion_usage.py @@ -27,7 +27,7 @@ class CCKCompletionUsage(BaseModel): """ - Usage statistics for the completion request. + CCKCompletionUsage """ # noqa: E501 completion_tokens: StrictInt prompt_tokens: StrictInt diff --git a/src/otari/_client/models/cck_image_content.py b/src/otari/_client/models/cck_image_content.py new file mode 100644 index 00000000..9806b917 --- /dev/null +++ b/src/otari/_client/models/cck_image_content.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + otari + + Otari, an OpenAI-compatible LLM gateway with API key management + + The version of the OpenAPI document: 0.0.0-dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from otari._client.models.cck_image_url import CCKImageURL +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CCKImageContent(BaseModel): + """ + OpenAI-compatible image response content. + """ # noqa: E501 + type: StrictStr + image_url: CCKImageURL + __properties: ClassVar[List[str]] = ["type", "image_url"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['image_url']): + raise ValueError("must be one of enum values ('image_url')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CCKImageContent from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of image_url + if self.image_url: + _dict['image_url'] = self.image_url.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CCKImageContent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "image_url": CCKImageURL.from_dict(obj["image_url"]) if obj.get("image_url") is not None else None + }) + return _obj + + diff --git a/src/otari/_client/models/cck_image_url.py b/src/otari/_client/models/cck_image_url.py new file mode 100644 index 00000000..eb6d97e7 --- /dev/null +++ b/src/otari/_client/models/cck_image_url.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + otari + + Otari, an OpenAI-compatible LLM gateway with API key management + + The version of the OpenAPI document: 0.0.0-dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CCKImageURL(BaseModel): + """ + OpenAI-compatible URL for an image response part. + """ # noqa: E501 + url: StrictStr + __properties: ClassVar[List[str]] = ["url"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CCKImageURL from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CCKImageURL from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url") + }) + return _obj + + diff --git a/src/otari/_client/models/cck_prompt_tokens_details.py b/src/otari/_client/models/cck_prompt_tokens_details.py index 49183659..27154131 100644 --- a/src/otari/_client/models/cck_prompt_tokens_details.py +++ b/src/otari/_client/models/cck_prompt_tokens_details.py @@ -19,18 +19,21 @@ from pydantic import BaseModel, ConfigDict, StrictInt from typing import Any, ClassVar, Dict, List, Optional +from otari._client.models.cck_cache_creation_token_details import CCKCacheCreationTokenDetails from typing import Optional, Set from typing_extensions import Self from pydantic_core import to_jsonable_python class CCKPromptTokensDetails(BaseModel): """ - Breakdown of tokens used in the prompt. + OpenAI prompt token breakdown extended with the TTL split of cache writes. As in OpenAI, ``cached_tokens`` and ``cache_write_tokens`` are subsets of ``prompt_tokens``. """ # noqa: E501 audio_tokens: Optional[StrictInt] = None cached_tokens: Optional[StrictInt] = None + cache_write_tokens: Optional[StrictInt] = None + cache_creation_token_details: Optional[CCKCacheCreationTokenDetails] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["audio_tokens", "cached_tokens"] + __properties: ClassVar[List[str]] = ["audio_tokens", "cached_tokens", "cache_write_tokens", "cache_creation_token_details"] model_config = ConfigDict( validate_by_name=True, @@ -73,6 +76,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of cache_creation_token_details + if self.cache_creation_token_details: + _dict['cache_creation_token_details'] = self.cache_creation_token_details.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -88,6 +94,16 @@ def to_dict(self) -> Dict[str, Any]: if self.cached_tokens is None and "cached_tokens" in self.model_fields_set: _dict['cached_tokens'] = None + # set to None if cache_write_tokens (nullable) is None + # and model_fields_set contains the field + if self.cache_write_tokens is None and "cache_write_tokens" in self.model_fields_set: + _dict['cache_write_tokens'] = None + + # set to None if cache_creation_token_details (nullable) is None + # and model_fields_set contains the field + if self.cache_creation_token_details is None and "cache_creation_token_details" in self.model_fields_set: + _dict['cache_creation_token_details'] = None + return _dict @classmethod @@ -101,7 +117,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "audio_tokens": obj.get("audio_tokens"), - "cached_tokens": obj.get("cached_tokens") + "cached_tokens": obj.get("cached_tokens"), + "cache_write_tokens": obj.get("cache_write_tokens"), + "cache_creation_token_details": CCKCacheCreationTokenDetails.from_dict(obj["cache_creation_token_details"]) if obj.get("cache_creation_token_details") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/otari/_client/models/selector_index_response.py b/src/otari/_client/models/selector_index_response.py index 8447e9f2..a3f13673 100644 --- a/src/otari/_client/models/selector_index_response.py +++ b/src/otari/_client/models/selector_index_response.py @@ -29,8 +29,8 @@ class SelectorIndexResponse(BaseModel): """ # noqa: E501 models: StrictInt = Field(description="Slugs that resolve to an offering.") offerings: StrictInt = Field(description="Selectors the deployment serves.") - short_selectors: StrictInt = Field(description="Offerings with an unambiguous short spelling.") - __properties: ClassVar[List[str]] = ["models", "offerings", "short_selectors"] + pinned_selectors: StrictInt = Field(description="Pinned spellings, one per instance a model is offered on.") + __properties: ClassVar[List[str]] = ["models", "offerings", "pinned_selectors"] model_config = ConfigDict( validate_by_name=True, @@ -85,7 +85,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "models": obj.get("models"), "offerings": obj.get("offerings"), - "short_selectors": obj.get("short_selectors") + "pinned_selectors": obj.get("pinned_selectors") }) return _obj diff --git a/src/otari/_client/models/tool_setting_field.py b/src/otari/_client/models/tool_setting_field.py index 9d61790f..49fd3ea3 100644 --- a/src/otari/_client/models/tool_setting_field.py +++ b/src/otari/_client/models/tool_setting_field.py @@ -28,13 +28,13 @@ class ToolSettingField(BaseModel): """ One editable tool/guardrail field surfaced to the dashboard. """ # noqa: E501 - choices: Optional[List[StrictStr]] = None description: Optional[StrictStr] = None key: StrictStr + options: Optional[List[StrictStr]] = None service: StrictStr type: StrictStr value: Optional[Value1] - __properties: ClassVar[List[str]] = ["choices", "description", "key", "service", "type", "value"] + __properties: ClassVar[List[str]] = ["description", "key", "options", "service", "type", "value"] @field_validator('service') def service_validate_enum(cls, value): @@ -92,16 +92,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of value if self.value: _dict['value'] = self.value.to_dict() - # set to None if choices (nullable) is None - # and model_fields_set contains the field - if self.choices is None and "choices" in self.model_fields_set: - _dict['choices'] = None - # set to None if description (nullable) is None # and model_fields_set contains the field if self.description is None and "description" in self.model_fields_set: _dict['description'] = None + # set to None if options (nullable) is None + # and model_fields_set contains the field + if self.options is None and "options" in self.model_fields_set: + _dict['options'] = None + # set to None if value (nullable) is None # and model_fields_set contains the field if self.value is None and "value" in self.model_fields_set: @@ -119,9 +119,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "choices": obj.get("choices"), "description": obj.get("description"), "key": obj.get("key"), + "options": obj.get("options"), "service": obj.get("service"), "type": obj.get("type"), "value": Value1.from_dict(obj["value"]) if obj.get("value") is not None else None diff --git a/src/otari/_client/models/workspace_code_execution_policy_update.py b/src/otari/_client/models/workspace_code_execution_policy_update.py index 3a995fc3..b352dca1 100644 --- a/src/otari/_client/models/workspace_code_execution_policy_update.py +++ b/src/otari/_client/models/workspace_code_execution_policy_update.py @@ -32,7 +32,7 @@ class WorkspaceCodeExecutionPolicyUpdate(BaseModel): default_purpose_hint: Optional[Annotated[str, Field(strict=True, max_length=2048)]] = Field(default=None, description="Hint used when a request declares otari_code_execution without one of its own") enabled: StrictBool = Field(description="False refuses code execution for this workspace") exec_timeout_s: Optional[Annotated[int, Field(le=60, strict=True, gt=0)]] = Field(default=None, description="Ceiling on one execution's runtime in seconds; only ever lowers the effective limit, so at most 60") - executor: Optional[CodeExecutor] = Field(default=None, description="Who runs a provider-native code-execution declaration for this workspace: 'auto' (the provider when it runs the tool natively for the model, else this gateway's sandbox), 'otari' or 'provider'. Pins over the deployment default and over the request's X-Otari-Code-Execution header; null leaves both in charge") + executor: Optional[CodeExecutor] = Field(default=None, description="Who runs a provider-native code-execution declaration for this workspace: 'auto' (the provider when it runs the tool natively for the model, else this gateway's sandbox), 'otari' or 'provider'. Pins over the deployment default and over the request's Otari-Code-Execution header; null leaves both in charge") image: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(default=None, description="Sandbox image this workspace's code runs in. Must be one the operator curated into sandbox_allowed_session_images (or the deployment's own sandbox_session_image); null uses the deployment's") max_iterations: Optional[Annotated[int, Field(le=25, strict=True, gt=0)]] = Field(default=None, description="Ceiling on tool-loop iterations; only ever lowers the effective limit, so at most 25") tools: Optional[List[StrictStr]] = Field(default=None, description="Code-execution tool kinds this workspace may use, from code_execution, bash_code_execution, text_editor_code_execution. Only ever removes one the backend serves; null exposes whatever it serves")