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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdk-endpoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ POST /api/v1/systemone # alias of /api/v1/decisions for TypeSa
# which this one delegates to.
POST /api/v1/playground/chat/completions # session-authorized, not an SDK surface
GET /api/v1/playground/tools # session-authorized, not an SDK surface
POST /api/v1/playground/files # session-authorized, not an SDK surface
GET /api/v1/playground/files # session-authorized, not an SDK surface
DELETE /api/v1/playground/files/{file_id} # session-authorized, not an SDK surface
GET /api/v1/playground/consent # session-authorized, not an SDK surface
PUT /api/v1/playground/consent # session-authorized, not an SDK surface
GET /api/v1/playground/conversations # session-authorized, not an SDK surface
Expand Down
2 changes: 2 additions & 0 deletions src/otari/_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@
"PasswordResponse",
"PendingOrganizationInvitationPublic",
"PendingOrganizationInvitationsPublic",
"PlaygroundAttachment",
"PlaygroundComparisonCreate",
"PlaygroundComparisonSummary",
"PlaygroundComparisonsPublic",
Expand Down Expand Up @@ -1208,6 +1209,7 @@
from otari._client.models.password_response import PasswordResponse as PasswordResponse
from otari._client.models.pending_organization_invitation_public import PendingOrganizationInvitationPublic as PendingOrganizationInvitationPublic
from otari._client.models.pending_organization_invitations_public import PendingOrganizationInvitationsPublic as PendingOrganizationInvitationsPublic
from otari._client.models.playground_attachment import PlaygroundAttachment as PlaygroundAttachment
from otari._client.models.playground_comparison_create import PlaygroundComparisonCreate as PlaygroundComparisonCreate
from otari._client.models.playground_comparison_summary import PlaygroundComparisonSummary as PlaygroundComparisonSummary
from otari._client.models.playground_comparisons_public import PlaygroundComparisonsPublic as PlaygroundComparisonsPublic
Expand Down
1,561 changes: 1,221 additions & 340 deletions src/otari/_client/api/playground_api.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/otari/_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@
from otari._client.models.password_response import PasswordResponse
from otari._client.models.pending_organization_invitation_public import PendingOrganizationInvitationPublic
from otari._client.models.pending_organization_invitations_public import PendingOrganizationInvitationsPublic
from otari._client.models.playground_attachment import PlaygroundAttachment
from otari._client.models.playground_comparison_create import PlaygroundComparisonCreate
from otari._client.models.playground_comparison_summary import PlaygroundComparisonSummary
from otari._client.models.playground_comparisons_public import PlaygroundComparisonsPublic
Expand Down
93 changes: 93 additions & 0 deletions src/otari/_client/models/playground_attachment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 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
from typing import Any, ClassVar, Dict, List
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class PlaygroundAttachment(BaseModel):
"""
A file one turn sent, as the page draws its chip and sends it again. A record of the attachment rather than a reference the gateway keeps alive: the file can be deleted after the save, and a resumed turn that sends it then does not send its contents.
""" # noqa: E501
bytes: Annotated[int, Field(strict=True, ge=0)]
file_id: Annotated[str, Field(strict=True, max_length=64)]
filename: Annotated[str, Field(strict=True, max_length=255)]
__properties: ClassVar[List[str]] = ["bytes", "file_id", "filename"]

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 PlaygroundAttachment 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 PlaygroundAttachment from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({
"bytes": obj.get("bytes"),
"file_id": obj.get("file_id"),
"filename": obj.get("filename")
})
return _obj


12 changes: 11 additions & 1 deletion src/otari/_client/models/playground_message_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from otari._client.models.playground_attachment import PlaygroundAttachment
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
Expand All @@ -28,10 +29,11 @@ class PlaygroundMessageCreate(BaseModel):
"""
One turn in a transcript being saved.
""" # noqa: E501
attachments: Optional[Annotated[List[PlaygroundAttachment], Field(max_length=10)]] = None
content: Annotated[str, Field(strict=True, max_length=200000)]
reasoning: Optional[Annotated[str, Field(strict=True, max_length=200000)]] = None
role: StrictStr
__properties: ClassVar[List[str]] = ["content", "reasoning", "role"]
__properties: ClassVar[List[str]] = ["attachments", "content", "reasoning", "role"]

@field_validator('role')
def role_validate_enum(cls, value):
Expand Down Expand Up @@ -79,6 +81,13 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in attachments (list)
_items = []
if self.attachments:
for _item_attachments in self.attachments:
if _item_attachments:
_items.append(_item_attachments.to_dict())
_dict['attachments'] = _items
# set to None if reasoning (nullable) is None
# and model_fields_set contains the field
if self.reasoning is None and "reasoning" in self.model_fields_set:
Expand All @@ -96,6 +105,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
return cls.model_validate(obj)

_obj = cls.model_validate({
"attachments": [PlaygroundAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None,
"content": obj.get("content"),
"reasoning": obj.get("reasoning"),
"role": obj.get("role")
Expand Down
12 changes: 11 additions & 1 deletion src/otari/_client/models/playground_message_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from pydantic import BaseModel, ConfigDict, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from otari._client.models.playground_attachment import PlaygroundAttachment
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
Expand All @@ -27,10 +28,11 @@ class PlaygroundMessagePublic(BaseModel):
"""
One stored turn, in the order it was saved. No usage figures, matching what the save accepts: tokens, cost and timing describe the request that ran rather than the conversation, and a resumed transcript reporting an old request's latency as this session's would be lying. The billing record for that request is its ``usage_logs`` row.
""" # noqa: E501
attachments: Optional[List[PlaygroundAttachment]] = None
content: StrictStr
reasoning: Optional[StrictStr] = None
role: StrictStr
__properties: ClassVar[List[str]] = ["content", "reasoning", "role"]
__properties: ClassVar[List[str]] = ["attachments", "content", "reasoning", "role"]

model_config = ConfigDict(
validate_by_name=True,
Expand Down Expand Up @@ -71,6 +73,13 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in attachments (list)
_items = []
if self.attachments:
for _item_attachments in self.attachments:
if _item_attachments:
_items.append(_item_attachments.to_dict())
_dict['attachments'] = _items
# set to None if reasoning (nullable) is None
# and model_fields_set contains the field
if self.reasoning is None and "reasoning" in self.model_fields_set:
Expand All @@ -88,6 +97,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
return cls.model_validate(obj)

_obj = cls.model_validate({
"attachments": [PlaygroundAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None,
"content": obj.get("content"),
"reasoning": obj.get("reasoning"),
"role": obj.get("role")
Expand Down
9 changes: 7 additions & 2 deletions src/otari/_client/models/playground_tools_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict
from pydantic import BaseModel, ConfigDict, Field
from typing import Any, ClassVar, Dict, List
from otari._client.models.playground_mcp_server import PlaygroundMcpServer
from otari._client.models.playground_tool_status import PlaygroundToolStatus
Expand All @@ -30,9 +30,10 @@ class PlaygroundToolsResponse(BaseModel):
What the caller's workspace may attach to a Playground message.
""" # noqa: E501
code_execution: PlaygroundToolStatus
files: PlaygroundToolStatus = Field(description="Whether a message may attach a file uploaded here.")
mcp_servers: List[PlaygroundMcpServer]
web_search: PlaygroundToolStatus
__properties: ClassVar[List[str]] = ["code_execution", "mcp_servers", "web_search"]
__properties: ClassVar[List[str]] = ["code_execution", "files", "mcp_servers", "web_search"]

model_config = ConfigDict(
validate_by_name=True,
Expand Down Expand Up @@ -76,6 +77,9 @@ def to_dict(self) -> Dict[str, Any]:
# override the default output from pydantic by calling `to_dict()` of code_execution
if self.code_execution:
_dict['code_execution'] = self.code_execution.to_dict()
# override the default output from pydantic by calling `to_dict()` of files
if self.files:
_dict['files'] = self.files.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in mcp_servers (list)
_items = []
if self.mcp_servers:
Expand All @@ -99,6 +103,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:

_obj = cls.model_validate({
"code_execution": PlaygroundToolStatus.from_dict(obj["code_execution"]) if obj.get("code_execution") is not None else None,
"files": PlaygroundToolStatus.from_dict(obj["files"]) if obj.get("files") is not None else None,
"mcp_servers": [PlaygroundMcpServer.from_dict(_item) for _item in obj["mcp_servers"]] if obj.get("mcp_servers") is not None else None,
"web_search": PlaygroundToolStatus.from_dict(obj["web_search"]) if obj.get("web_search") is not None else None
})
Expand Down
Loading