Skip to content

Commit 509bc49

Browse files
tbillegithub-actions[bot]
authored andcommitted
chore: regenerate SDK client core from Otari OpenAPI spec
1 parent 05c045f commit 509bc49

8 files changed

Lines changed: 177 additions & 17 deletions

File tree

src/otari/_client/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"ChatCompletion",
7878
"ChatCompletionChunk",
7979
"ChatCompletionRequest",
80+
"ChatCompletionRequestToolsInner",
8081
"ChatMessageInput",
8182
"Content",
8283
"Content1",
@@ -279,6 +280,7 @@
279280
from otari._client.models.chat_completion import ChatCompletion as ChatCompletion
280281
from otari._client.models.chat_completion_chunk import ChatCompletionChunk as ChatCompletionChunk
281282
from otari._client.models.chat_completion_request import ChatCompletionRequest as ChatCompletionRequest
283+
from otari._client.models.chat_completion_request_tools_inner import ChatCompletionRequestToolsInner as ChatCompletionRequestToolsInner
282284
from otari._client.models.chat_message_input import ChatMessageInput as ChatMessageInput
283285
from otari._client.models.content import Content as Content
284286
from otari._client.models.content1 import Content1 as Content1

src/otari/_client/api/messages_api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def count_message_tokens_v1_messages_count_tokens_post(
5757
) -> CountTokensResponse:
5858
"""Count Message Tokens
5959
60-
Anthropic ``/v1/messages/count_tokens``-compatible endpoint. Returns ``{\"input_tokens\": N}`` without contacting an upstream provider: counting is local, so there is no budget reservation, pricing, or usage logging. Authentication mirrors :func:`create_message` — platform mode resolves the caller's token against the platform, standalone mode validates the API key — so the endpoint is not an open token-counting oracle.
60+
Anthropic ``/v1/messages/count_tokens``-compatible endpoint. Returns ``{\"input_tokens\": N}`` without contacting an upstream provider: counting is local, so there is no budget reservation, pricing, or usage logging. Authentication mirrors :func:`create_message` — hybrid mode resolves the caller's token against the platform, standalone mode validates the API key — so the endpoint is not an open token-counting oracle.
6161
6262
:param count_tokens_request: (required)
6363
:type count_tokens_request: CountTokensRequest
@@ -125,7 +125,7 @@ def count_message_tokens_v1_messages_count_tokens_post_with_http_info(
125125
) -> ApiResponse[CountTokensResponse]:
126126
"""Count Message Tokens
127127
128-
Anthropic ``/v1/messages/count_tokens``-compatible endpoint. Returns ``{\"input_tokens\": N}`` without contacting an upstream provider: counting is local, so there is no budget reservation, pricing, or usage logging. Authentication mirrors :func:`create_message` — platform mode resolves the caller's token against the platform, standalone mode validates the API key — so the endpoint is not an open token-counting oracle.
128+
Anthropic ``/v1/messages/count_tokens``-compatible endpoint. Returns ``{\"input_tokens\": N}`` without contacting an upstream provider: counting is local, so there is no budget reservation, pricing, or usage logging. Authentication mirrors :func:`create_message` — hybrid mode resolves the caller's token against the platform, standalone mode validates the API key — so the endpoint is not an open token-counting oracle.
129129
130130
:param count_tokens_request: (required)
131131
:type count_tokens_request: CountTokensRequest
@@ -193,7 +193,7 @@ def count_message_tokens_v1_messages_count_tokens_post_without_preload_content(
193193
) -> RESTResponseType:
194194
"""Count Message Tokens
195195
196-
Anthropic ``/v1/messages/count_tokens``-compatible endpoint. Returns ``{\"input_tokens\": N}`` without contacting an upstream provider: counting is local, so there is no budget reservation, pricing, or usage logging. Authentication mirrors :func:`create_message` — platform mode resolves the caller's token against the platform, standalone mode validates the API key — so the endpoint is not an open token-counting oracle.
196+
Anthropic ``/v1/messages/count_tokens``-compatible endpoint. Returns ``{\"input_tokens\": N}`` without contacting an upstream provider: counting is local, so there is no budget reservation, pricing, or usage logging. Authentication mirrors :func:`create_message` — hybrid mode resolves the caller's token against the platform, standalone mode validates the API key — so the endpoint is not an open token-counting oracle.
197197
198198
:param count_tokens_request: (required)
199199
:type count_tokens_request: CountTokensRequest
@@ -333,7 +333,7 @@ def create_message_v1_messages_post(
333333
) -> MessageResponse:
334334
"""Create Message
335335
336-
Anthropic Messages API-compatible endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and platform mode. Platform-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
336+
Anthropic Messages API-compatible endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and hybrid mode. Hybrid-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
337337
338338
:param messages_request: (required)
339339
:type messages_request: MessagesRequest
@@ -401,7 +401,7 @@ def create_message_v1_messages_post_with_http_info(
401401
) -> ApiResponse[MessageResponse]:
402402
"""Create Message
403403
404-
Anthropic Messages API-compatible endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and platform mode. Platform-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
404+
Anthropic Messages API-compatible endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and hybrid mode. Hybrid-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
405405
406406
:param messages_request: (required)
407407
:type messages_request: MessagesRequest
@@ -469,7 +469,7 @@ def create_message_v1_messages_post_without_preload_content(
469469
) -> RESTResponseType:
470470
"""Create Message
471471
472-
Anthropic Messages API-compatible endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and platform mode. Platform-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
472+
Anthropic Messages API-compatible endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and hybrid mode. Hybrid-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
473473
474474
:param messages_request: (required)
475475
:type messages_request: MessagesRequest

src/otari/_client/api/responses_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def create_response_v1_responses_post(
5555
) -> object:
5656
"""Create Response
5757
58-
OpenAI-compatible Responses endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and platform mode. Platform-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
58+
OpenAI-compatible Responses endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and hybrid mode. Hybrid-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
5959
6060
:param responses_request: (required)
6161
:type responses_request: ResponsesRequest
@@ -123,7 +123,7 @@ def create_response_v1_responses_post_with_http_info(
123123
) -> ApiResponse[object]:
124124
"""Create Response
125125
126-
OpenAI-compatible Responses endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and platform mode. Platform-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
126+
OpenAI-compatible Responses endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and hybrid mode. Hybrid-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
127127
128128
:param responses_request: (required)
129129
:type responses_request: ResponsesRequest
@@ -191,7 +191,7 @@ def create_response_v1_responses_post_without_preload_content(
191191
) -> RESTResponseType:
192192
"""Create Response
193193
194-
OpenAI-compatible Responses endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and platform mode. Platform-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
194+
OpenAI-compatible Responses endpoint. Supports MCP tool-use loops, sandboxed code execution, and SearXNG web_search in both standalone mode and hybrid mode. Hybrid-mode requests resolve credentials via the platform service and (for non-tool-loop requests) get multi-attempt fallback across the resolved route. Tool-loop requests collapse to a single attempt — once ``on_first_response`` lock-in plumbing lands across the codebase, a follow-up will enable pre-lock-in fallback for tool-loop requests too.
195195
196196
:param responses_request: (required)
197197
:type responses_request: ResponsesRequest

src/otari/_client/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from otari._client.models.chat_completion import ChatCompletion
4747
from otari._client.models.chat_completion_chunk import ChatCompletionChunk
4848
from otari._client.models.chat_completion_request import ChatCompletionRequest
49+
from otari._client.models.chat_completion_request_tools_inner import ChatCompletionRequestToolsInner
4950
from otari._client.models.chat_message_input import ChatMessageInput
5051
from otari._client.models.content import Content
5152
from otari._client.models.content1 import Content1

src/otari/_client/models/chat_completion_request.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from typing import Any, ClassVar, Dict, List, Optional, Union
2222
from typing_extensions import Annotated
2323
from uuid import UUID
24+
from otari._client.models.chat_completion_request_tools_inner import ChatCompletionRequestToolsInner
2425
from otari._client.models.chat_message_input import ChatMessageInput
2526
from otari._client.models.guardrail_config import GuardrailConfig
2627
from otari._client.models.mcp_server_config import McpServerConfig
@@ -56,7 +57,7 @@ class ChatCompletionRequest(BaseModel):
5657
stream_options: Optional[Dict[str, Any]] = None
5758
temperature: Optional[Union[StrictFloat, StrictInt]] = None
5859
tool_choice: Optional[ToolChoice] = None
59-
tools: Optional[List[Optional[Dict[str, Any]]]] = None
60+
tools: Optional[List[ChatCompletionRequestToolsInner]] = None
6061
tools_header: Optional[Annotated[str, Field(strict=True, max_length=4000)]] = Field(default=None, description="Optional override for the lead-in that the gateway prepends before the per-tool hint block in the system message. Useful for expressing global tool-selection policy (e.g. 'prefer MCP tools over code_execution'). Falls back to OTARI_TOOLS_HEADER env, then to the built-in default.")
6162
top_logprobs: Optional[StrictInt] = None
6263
top_p: Optional[Union[StrictFloat, StrictInt]] = None
@@ -139,6 +140,13 @@ def to_dict(self) -> Dict[str, Any]:
139140
# override the default output from pydantic by calling `to_dict()` of tool_choice
140141
if self.tool_choice:
141142
_dict['tool_choice'] = self.tool_choice.to_dict()
143+
# override the default output from pydantic by calling `to_dict()` of each item in tools (list)
144+
_items = []
145+
if self.tools:
146+
for _item_tools in self.tools:
147+
if _item_tools:
148+
_items.append(_item_tools.to_dict())
149+
_dict['tools'] = _items
142150
# set to None if frequency_penalty (nullable) is None
143151
# and model_fields_set contains the field
144152
if self.frequency_penalty is None and "frequency_penalty" in self.model_fields_set:
@@ -293,7 +301,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
293301
"stream_options": obj.get("stream_options"),
294302
"temperature": obj.get("temperature"),
295303
"tool_choice": ToolChoice.from_dict(obj["tool_choice"]) if obj.get("tool_choice") is not None else None,
296-
"tools": obj.get("tools"),
304+
"tools": [ChatCompletionRequestToolsInner.from_dict(_item) for _item in obj["tools"]] if obj.get("tools") is not None else None,
297305
"tools_header": obj.get("tools_header"),
298306
"top_logprobs": obj.get("top_logprobs"),
299307
"top_p": obj.get("top_p"),
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# coding: utf-8
2+
3+
"""
4+
otari
5+
6+
Otari, an OpenAI-compatible LLM gateway with API key management
7+
8+
The version of the OpenAPI document: 0.0.0-dev
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
15+
from __future__ import annotations
16+
from inspect import getfullargspec
17+
import json
18+
import pprint
19+
import re # noqa: F401
20+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
21+
from typing import Any, Dict, Optional
22+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
23+
from typing_extensions import Literal, Self
24+
from pydantic import Field
25+
26+
CHATCOMPLETIONREQUESTTOOLSINNER_ANY_OF_SCHEMAS = ["Dict[str, object]"]
27+
28+
class ChatCompletionRequestToolsInner(BaseModel):
29+
"""
30+
ChatCompletionRequestToolsInner
31+
"""
32+
33+
# data type: Dict[str, object]
34+
anyof_schema_1_validator: Optional[Dict[str, Any]] = None
35+
# data type: Dict[str, object]
36+
anyof_schema_2_validator: Optional[Dict[str, Any]] = None
37+
if TYPE_CHECKING:
38+
actual_instance: Optional[Union[Dict[str, object]]] = None
39+
else:
40+
actual_instance: Any = None
41+
any_of_schemas: Set[str] = { "Dict[str, object]" }
42+
43+
model_config = {
44+
"validate_assignment": True,
45+
"protected_namespaces": (),
46+
}
47+
48+
def __init__(self, *args, **kwargs) -> None:
49+
if args:
50+
if len(args) > 1:
51+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
52+
if kwargs:
53+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
54+
super().__init__(actual_instance=args[0])
55+
else:
56+
super().__init__(**kwargs)
57+
58+
@field_validator('actual_instance')
59+
def actual_instance_must_validate_anyof(cls, v):
60+
instance = ChatCompletionRequestToolsInner.model_construct()
61+
error_messages = []
62+
# validate data type: Dict[str, object]
63+
try:
64+
instance.anyof_schema_1_validator = v
65+
return v
66+
except (ValidationError, ValueError) as e:
67+
error_messages.append(str(e))
68+
# validate data type: Dict[str, object]
69+
try:
70+
instance.anyof_schema_2_validator = v
71+
return v
72+
except (ValidationError, ValueError) as e:
73+
error_messages.append(str(e))
74+
if error_messages:
75+
# no match
76+
raise ValueError("No match found when setting the actual_instance in ChatCompletionRequestToolsInner with anyOf schemas: Dict[str, object]. Details: " + ", ".join(error_messages))
77+
else:
78+
return v
79+
80+
@classmethod
81+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
82+
return cls.from_json(json.dumps(obj))
83+
84+
@classmethod
85+
def from_json(cls, json_str: str) -> Self:
86+
"""Returns the object represented by the json string"""
87+
instance = cls.model_construct()
88+
error_messages = []
89+
# deserialize data into Dict[str, object]
90+
try:
91+
# validation
92+
instance.anyof_schema_1_validator = json.loads(json_str)
93+
# assign value to actual_instance
94+
instance.actual_instance = instance.anyof_schema_1_validator
95+
return instance
96+
except (ValidationError, ValueError) as e:
97+
error_messages.append(str(e))
98+
# deserialize data into Dict[str, object]
99+
try:
100+
# validation
101+
instance.anyof_schema_2_validator = json.loads(json_str)
102+
# assign value to actual_instance
103+
instance.actual_instance = instance.anyof_schema_2_validator
104+
return instance
105+
except (ValidationError, ValueError) as e:
106+
error_messages.append(str(e))
107+
108+
if error_messages:
109+
# no match
110+
raise ValueError("No match found when deserializing the JSON string into ChatCompletionRequestToolsInner with anyOf schemas: Dict[str, object]. Details: " + ", ".join(error_messages))
111+
else:
112+
return instance
113+
114+
def to_json(self) -> str:
115+
"""Returns the JSON representation of the actual instance"""
116+
if self.actual_instance is None:
117+
return "null"
118+
119+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
120+
return self.actual_instance.to_json()
121+
else:
122+
return json.dumps(self.actual_instance)
123+
124+
def to_dict(self) -> Optional[Union[Dict[str, Any], Dict[str, object]]]:
125+
"""Returns the dict representation of the actual instance"""
126+
if self.actual_instance is None:
127+
return None
128+
129+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
130+
return self.actual_instance.to_dict()
131+
else:
132+
return self.actual_instance
133+
134+
def to_str(self) -> str:
135+
"""Returns the string representation of the actual instance"""
136+
return pprint.pformat(self.model_dump())
137+
138+

0 commit comments

Comments
 (0)