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
6 changes: 6 additions & 0 deletions src/otari/_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,15 @@
"CallerWorkspaceMembershipPublic",
"CandidateResponse",
"CatalogCapabilities",
"CatalogCapability",
"CatalogCredential",
"CatalogElsewhere",
"CatalogFacets",
"CatalogModelDetail",
"CatalogModelSummary",
"CatalogOffering",
"CatalogResponse",
"CatalogVendorFacet",
"ChatCompletion",
"ChatCompletionChunk",
"ChatCompletionRequest",
Expand Down Expand Up @@ -842,12 +845,15 @@
from otari._client.models.caller_workspace_membership_public import CallerWorkspaceMembershipPublic as CallerWorkspaceMembershipPublic
from otari._client.models.candidate_response import CandidateResponse as CandidateResponse
from otari._client.models.catalog_capabilities import CatalogCapabilities as CatalogCapabilities
from otari._client.models.catalog_capability import CatalogCapability as CatalogCapability
from otari._client.models.catalog_credential import CatalogCredential as CatalogCredential
from otari._client.models.catalog_elsewhere import CatalogElsewhere as CatalogElsewhere
from otari._client.models.catalog_facets import CatalogFacets as CatalogFacets
from otari._client.models.catalog_model_detail import CatalogModelDetail as CatalogModelDetail
from otari._client.models.catalog_model_summary import CatalogModelSummary as CatalogModelSummary
from otari._client.models.catalog_offering import CatalogOffering as CatalogOffering
from otari._client.models.catalog_response import CatalogResponse as CatalogResponse
from otari._client.models.catalog_vendor_facet import CatalogVendorFacet as CatalogVendorFacet
from otari._client.models.chat_completion import ChatCompletion as ChatCompletion
from otari._client.models.chat_completion_chunk import ChatCompletionChunk as ChatCompletionChunk
from otari._client.models.chat_completion_request import ChatCompletionRequest as ChatCompletionRequest
Expand Down
267 changes: 247 additions & 20 deletions src/otari/_client/api/catalog_api.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/otari/_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,15 @@
from otari._client.models.caller_workspace_membership_public import CallerWorkspaceMembershipPublic
from otari._client.models.candidate_response import CandidateResponse
from otari._client.models.catalog_capabilities import CatalogCapabilities
from otari._client.models.catalog_capability import CatalogCapability
from otari._client.models.catalog_credential import CatalogCredential
from otari._client.models.catalog_elsewhere import CatalogElsewhere
from otari._client.models.catalog_facets import CatalogFacets
from otari._client.models.catalog_model_detail import CatalogModelDetail
from otari._client.models.catalog_model_summary import CatalogModelSummary
from otari._client.models.catalog_offering import CatalogOffering
from otari._client.models.catalog_response import CatalogResponse
from otari._client.models.catalog_vendor_facet import CatalogVendorFacet
from otari._client.models.chat_completion import ChatCompletion
from otari._client.models.chat_completion_chunk import ChatCompletionChunk
from otari._client.models.chat_completion_request import ChatCompletionRequest
Expand Down
40 changes: 40 additions & 0 deletions src/otari/_client/models/catalog_capability.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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 json
from enum import Enum
from typing_extensions import Self


class CatalogCapability(str, Enum):
"""
CatalogCapability
"""

"""
allowed enum values
"""
TOOL_CALL = 'tool_call'
REASONING = 'reasoning'
STRUCTURED_OUTPUT = 'structured_output'
ATTACHMENT = 'attachment'
OPEN_WEIGHTS = 'open_weights'

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of CatalogCapability from a JSON string"""
return cls(json.loads(json_str))


101 changes: 101 additions & 0 deletions src/otari/_client/models/catalog_facets.py
Original file line number Diff line number Diff line change
@@ -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, Field, StrictStr
from typing import Any, ClassVar, Dict, List
from typing_extensions import Annotated
from otari._client.models.catalog_vendor_facet import CatalogVendorFacet
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class CatalogFacets(BaseModel):
"""
The filter rail's choices, from the caller's whole authorized catalog rather than one page.
""" # noqa: E501
providers: List[StrictStr] = Field(description="Every provider instance offering an authorized model, sorted.")
total_count: Annotated[int, Field(strict=True, ge=0)] = Field(description="Authorized models before any of the request's filters.")
vendors: List[CatalogVendorFacet]
__properties: ClassVar[List[str]] = ["providers", "total_count", "vendors"]

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 CatalogFacets 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 each item in vendors (list)
_items = []
if self.vendors:
for _item_vendors in self.vendors:
if _item_vendors:
_items.append(_item_vendors.to_dict())
_dict['vendors'] = _items
return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of CatalogFacets from a dict"""
if obj is None:
return None

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

_obj = cls.model_validate({
"providers": obj.get("providers"),
"total_count": obj.get("total_count"),
"vendors": [CatalogVendorFacet.from_dict(_item) for _item in obj["vendors"]] if obj.get("vendors") is not None else None
})
return _obj


15 changes: 13 additions & 2 deletions src/otari/_client/models/catalog_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt
from typing import Any, ClassVar, Dict, List, Optional
from otari._client.models.catalog_facets import CatalogFacets
from otari._client.models.catalog_model_summary import CatalogModelSummary
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -29,12 +30,13 @@ class CatalogResponse(BaseModel):
"""
The grouped catalog, and the facts a reader needs to interpret its prices.
""" # noqa: E501
count: StrictInt = Field(description="Models matching the search, before the window, so a caller can page without reading them all.")
count: StrictInt = Field(description="Models matching all filters before paging.")
default_pricing: StrictBool = Field(description="Whether an unpriced model is metered at the genai-prices default.")
defaults_as_of: Optional[datetime] = Field(description="When the accepted genai-prices snapshot was taken. Null while the bundled dataset serves.")
facets: Optional[CatalogFacets] = Field(default=None, description="Present when include_facets is requested.")
metadata_available: StrictBool = Field(description="False when models.dev could not be read; descriptions are then absent.")
models: List[CatalogModelSummary]
__properties: ClassVar[List[str]] = ["count", "default_pricing", "defaults_as_of", "metadata_available", "models"]
__properties: ClassVar[List[str]] = ["count", "default_pricing", "defaults_as_of", "facets", "metadata_available", "models"]

model_config = ConfigDict(
validate_by_name=True,
Expand Down Expand Up @@ -75,6 +77,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 facets
if self.facets:
_dict['facets'] = self.facets.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in models (list)
_items = []
if self.models:
Expand All @@ -87,6 +92,11 @@ def to_dict(self) -> Dict[str, Any]:
if self.defaults_as_of is None and "defaults_as_of" in self.model_fields_set:
_dict['defaults_as_of'] = None

# set to None if facets (nullable) is None
# and model_fields_set contains the field
if self.facets is None and "facets" in self.model_fields_set:
_dict['facets'] = None

return _dict

@classmethod
Expand All @@ -102,6 +112,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"count": obj.get("count"),
"default_pricing": obj.get("default_pricing"),
"defaults_as_of": obj.get("defaults_as_of"),
"facets": CatalogFacets.from_dict(obj["facets"]) if obj.get("facets") is not None else None,
"metadata_available": obj.get("metadata_available"),
"models": [CatalogModelSummary.from_dict(_item) for _item in obj["models"]] if obj.get("models") is not None else None
})
Expand Down
95 changes: 95 additions & 0 deletions src/otari/_client/models/catalog_vendor_facet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# 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, 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 CatalogVendorFacet(BaseModel):
"""
CatalogVendorFacet
""" # noqa: E501
value: StrictStr = Field(description="The vendor's name; empty for models whose vendor is unknown.")
vendor_slug: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["value", "vendor_slug"]

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 CatalogVendorFacet 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 vendor_slug (nullable) is None
# and model_fields_set contains the field
if self.vendor_slug is None and "vendor_slug" in self.model_fields_set:
_dict['vendor_slug'] = None

return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of CatalogVendorFacet from a dict"""
if obj is None:
return None

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

_obj = cls.model_validate({
"value": obj.get("value"),
"vendor_slug": obj.get("vendor_slug")
})
return _obj


11 changes: 10 additions & 1 deletion src/otari/_client/models/create_key_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ class CreateKeyRequest(BaseModel):
""" # noqa: E501
allowed_models: Optional[List[StrictStr]] = Field(default=None, description="Model allow-list: null = any model, [] = deny all, or canonical instance:model entries (with instance:* / instance:prefix* wildcards).")
capture_agent_telemetry: Optional[StrictBool] = Field(default=None, description="Per-key override of the deployment-wide capture_agent_telemetry setting: null (default) inherits it, true always stores this key's coding-agent telemetry, false always discards it. Covers both behavioral events (tool_result, tool_decision, user_prompt, api_error) from POST /otlp/v1/logs and outcome-metric data points (lines of code, commits, pull requests, active time) from POST /otlp/v1/metrics. Usage capture and billing are unaffected either way.")
end_user_budget_id: Optional[StrictStr] = Field(default=None, description="Budget each end user this key creates is capped at. Null leaves end users capped only by this key's own ceiling.")
exclude_from_budget: Optional[StrictBool] = Field(default=False, description="When true, requests on this key are logged with cost but never reserved, reconciled into the user's spend, or gated by budget.")
expires_at: Optional[datetime] = Field(default=None, description="Optional expiration timestamp")
is_service_key: Optional[StrictBool] = Field(default=False, description="When true, a request may name an end user in its 'user' field. Each end user is created on first use, owned by this key's user, and billed to its own budget, while this key's own ceiling caps all of them together.")
key_name: Optional[StrictStr] = Field(default=None, description="Optional name for the key")
metadata: Optional[Dict[str, Any]] = Field(default=None, description="Optional metadata")
reject_user_mismatch: Optional[StrictBool] = Field(default=None, description="Per-key override of the deployment-wide reject_user_mismatch setting: null (default) inherits it, true always rejects a request naming a different 'user', false always accepts it. Spend binds to this key's own user either way.")
user_id: Optional[StrictStr] = Field(default=None, description="Optional user ID to associate with this key")
workspace_id: Optional[UUID] = Field(default=None, description="Workspace this key belongs to, which must be one in the caller's organization. Omitted means that organization's default workspace. A key belongs to exactly one workspace: requests on it are scoped and billed there, so the workspace is read off the key rather than off a request header.")
__properties: ClassVar[List[str]] = ["allowed_models", "capture_agent_telemetry", "exclude_from_budget", "expires_at", "key_name", "metadata", "reject_user_mismatch", "user_id", "workspace_id"]
__properties: ClassVar[List[str]] = ["allowed_models", "capture_agent_telemetry", "end_user_budget_id", "exclude_from_budget", "expires_at", "is_service_key", "key_name", "metadata", "reject_user_mismatch", "user_id", "workspace_id"]

model_config = ConfigDict(
validate_by_name=True,
Expand Down Expand Up @@ -89,6 +91,11 @@ def to_dict(self) -> Dict[str, Any]:
if self.capture_agent_telemetry is None and "capture_agent_telemetry" in self.model_fields_set:
_dict['capture_agent_telemetry'] = None

# set to None if end_user_budget_id (nullable) is None
# and model_fields_set contains the field
if self.end_user_budget_id is None and "end_user_budget_id" in self.model_fields_set:
_dict['end_user_budget_id'] = 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:
Expand Down Expand Up @@ -128,8 +135,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
_obj = cls.model_validate({
"allowed_models": obj.get("allowed_models"),
"capture_agent_telemetry": obj.get("capture_agent_telemetry"),
"end_user_budget_id": obj.get("end_user_budget_id"),
"exclude_from_budget": obj.get("exclude_from_budget") if obj.get("exclude_from_budget") is not None else False,
"expires_at": obj.get("expires_at"),
"is_service_key": obj.get("is_service_key") if obj.get("is_service_key") is not None else False,
"key_name": obj.get("key_name"),
"metadata": obj.get("metadata"),
"reject_user_mismatch": obj.get("reject_user_mismatch"),
Expand Down
Loading
Loading