diff --git a/sdk-endpoints.txt b/sdk-endpoints.txt index 877cd53b..2dbb8311 100644 --- a/sdk-endpoints.txt +++ b/sdk-endpoints.txt @@ -190,6 +190,7 @@ GET /api/v1/tool-settings # not yet wrapped PATCH /api/v1/tool-settings # not yet wrapped POST /api/v1/tool-settings/{service}/test # not yet wrapped GET /api/v1/tool-settings/guardrails/profiles # not yet wrapped +GET /api/v1/tool-settings/guardrails/catalog # not yet wrapped POST /api/v1/search # not yet wrapped POST /api/v1/search/{search_tool_name} # not yet wrapped # Search tools (runtime search-tool management) diff --git a/src/otari/_client/__init__.py b/src/otari/_client/__init__.py index bfea9472..24c51a46 100644 --- a/src/otari/_client/__init__.py +++ b/src/otari/_client/__init__.py @@ -106,11 +106,14 @@ "AudioSpeechRequest", "AuthenticatePasskeyRequest", "AuthorizeResponse", + "BackendType", "BatchRequestItem", "BillingMeters", "BlobResourceContents", "BudgetResetLogResponse", "BudgetResponse", + "BuiltInGuardrailCatalog", + "BuiltInGuardrailSpec", "CCChatCompletionAudio", "CCChatCompletionMessage", "CCChatCompletionMessageCustomToolCall", @@ -211,9 +214,11 @@ "ExternalUsageEvent", "GatewaySettings", "GuardrailCatalog", + "GuardrailCategory", "GuardrailConfig", "GuardrailParameterSpec", "GuardrailProfileSpec", + "GuardrailStage", "HTTPValidationError", "IMGImage", "IMGUsage", @@ -426,6 +431,7 @@ "OrganizationScopedBudgetPublic", "OrganizationScopedBudgetUpdate", "OrganizationScopedBudgetsPublic", + "OutputShape", "PasskeySessionResponse", "PasswordResponse", "PendingOrganizationInvitationPublic", @@ -456,6 +462,7 @@ "RegisterPasskeyRequest", "RequestPasswordResetRequest", "RequestPasswordResetResponse", + "RequirementGroup", "RerankRequest", "RerankResponse", "ResendVerificationRequest", @@ -537,6 +544,7 @@ "ValidationError", "Value", "Value1", + "VariantLicense", "VerifyEmailRequest", "VerifyEmailResponse", "WebAuthnCredentialPublic", @@ -664,11 +672,14 @@ from otari._client.models.audio_speech_request import AudioSpeechRequest as AudioSpeechRequest from otari._client.models.authenticate_passkey_request import AuthenticatePasskeyRequest as AuthenticatePasskeyRequest from otari._client.models.authorize_response import AuthorizeResponse as AuthorizeResponse +from otari._client.models.backend_type import BackendType as BackendType from otari._client.models.batch_request_item import BatchRequestItem as BatchRequestItem from otari._client.models.billing_meters import BillingMeters as BillingMeters from otari._client.models.blob_resource_contents import BlobResourceContents as BlobResourceContents from otari._client.models.budget_reset_log_response import BudgetResetLogResponse as BudgetResetLogResponse 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_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 @@ -769,9 +780,11 @@ from otari._client.models.external_usage_event import ExternalUsageEvent as ExternalUsageEvent from otari._client.models.gateway_settings import GatewaySettings as GatewaySettings from otari._client.models.guardrail_catalog import GuardrailCatalog as GuardrailCatalog +from otari._client.models.guardrail_category import GuardrailCategory as GuardrailCategory from otari._client.models.guardrail_config import GuardrailConfig as GuardrailConfig from otari._client.models.guardrail_parameter_spec import GuardrailParameterSpec as GuardrailParameterSpec from otari._client.models.guardrail_profile_spec import GuardrailProfileSpec as GuardrailProfileSpec +from otari._client.models.guardrail_stage import GuardrailStage as GuardrailStage from otari._client.models.http_validation_error import HTTPValidationError as HTTPValidationError from otari._client.models.img_image import IMGImage as IMGImage from otari._client.models.img_usage import IMGUsage as IMGUsage @@ -984,6 +997,7 @@ from otari._client.models.organization_scoped_budget_public import OrganizationScopedBudgetPublic as OrganizationScopedBudgetPublic from otari._client.models.organization_scoped_budget_update import OrganizationScopedBudgetUpdate as OrganizationScopedBudgetUpdate from otari._client.models.organization_scoped_budgets_public import OrganizationScopedBudgetsPublic as OrganizationScopedBudgetsPublic +from otari._client.models.output_shape import OutputShape as OutputShape from otari._client.models.passkey_session_response import PasskeySessionResponse as PasskeySessionResponse from otari._client.models.password_response import PasswordResponse as PasswordResponse from otari._client.models.pending_organization_invitation_public import PendingOrganizationInvitationPublic as PendingOrganizationInvitationPublic @@ -1014,6 +1028,7 @@ from otari._client.models.register_passkey_request import RegisterPasskeyRequest as RegisterPasskeyRequest from otari._client.models.request_password_reset_request import RequestPasswordResetRequest as RequestPasswordResetRequest from otari._client.models.request_password_reset_response import RequestPasswordResetResponse as RequestPasswordResetResponse +from otari._client.models.requirement_group import RequirementGroup as RequirementGroup from otari._client.models.rerank_request import RerankRequest as RerankRequest from otari._client.models.rerank_response import RerankResponse as RerankResponse from otari._client.models.resend_verification_request import ResendVerificationRequest as ResendVerificationRequest @@ -1095,6 +1110,7 @@ from otari._client.models.validation_error import ValidationError as ValidationError from otari._client.models.value import Value as Value from otari._client.models.value1 import Value1 as Value1 +from otari._client.models.variant_license import VariantLicense as VariantLicense from otari._client.models.verify_email_request import VerifyEmailRequest as VerifyEmailRequest from otari._client.models.verify_email_response import VerifyEmailResponse as VerifyEmailResponse from otari._client.models.web_authn_credential_public import WebAuthnCredentialPublic as WebAuthnCredentialPublic diff --git a/src/otari/_client/api/auth_api.py b/src/otari/_client/api/auth_api.py index 17786db9..421ecc0b 100644 --- a/src/otari/_client/api/auth_api.py +++ b/src/otari/_client/api/auth_api.py @@ -4104,7 +4104,7 @@ def auth_signup( ) -> SignupResponse: """Signup - Claim a roster identity, or do nothing: the response never says which. No session is minted. A newly claimed identity is hard-blocked from signing in until it verifies, so there is nothing yet to sign it into. + Claim a roster identity, register a new one, or do nothing: the response never says which. Which of the three this deployment will do is ``open_signup``, published in the bootstrap so the page can say so before anyone types an address. No session is minted. A newly claimed or registered identity is hard-blocked from signing in until it verifies, so there is nothing yet to sign it into. :param signup_request: (required) :type signup_request: SignupRequest @@ -4172,7 +4172,7 @@ def auth_signup_with_http_info( ) -> ApiResponse[SignupResponse]: """Signup - Claim a roster identity, or do nothing: the response never says which. No session is minted. A newly claimed identity is hard-blocked from signing in until it verifies, so there is nothing yet to sign it into. + Claim a roster identity, register a new one, or do nothing: the response never says which. Which of the three this deployment will do is ``open_signup``, published in the bootstrap so the page can say so before anyone types an address. No session is minted. A newly claimed or registered identity is hard-blocked from signing in until it verifies, so there is nothing yet to sign it into. :param signup_request: (required) :type signup_request: SignupRequest @@ -4240,7 +4240,7 @@ def auth_signup_without_preload_content( ) -> RESTResponseType: """Signup - Claim a roster identity, or do nothing: the response never says which. No session is minted. A newly claimed identity is hard-blocked from signing in until it verifies, so there is nothing yet to sign it into. + Claim a roster identity, register a new one, or do nothing: the response never says which. Which of the three this deployment will do is ``open_signup``, published in the bootstrap so the page can say so before anyone types an address. No session is minted. A newly claimed or registered identity is hard-blocked from signing in until it verifies, so there is nothing yet to sign it into. :param signup_request: (required) :type signup_request: SignupRequest diff --git a/src/otari/_client/api/tool_settings_api.py b/src/otari/_client/api/tool_settings_api.py index 583368e9..adf77751 100644 --- a/src/otari/_client/api/tool_settings_api.py +++ b/src/otari/_client/api/tool_settings_api.py @@ -16,6 +16,7 @@ from typing_extensions import Annotated from pydantic import StrictStr +from otari._client.models.built_in_guardrail_catalog import BuiltInGuardrailCatalog from otari._client.models.guardrail_catalog import GuardrailCatalog from otari._client.models.test_service_request import TestServiceRequest from otari._client.models.test_service_response import TestServiceResponse @@ -287,6 +288,253 @@ def _tool_settings_get_tool_settings_serialize( + @validate_call + def tool_settings_list_builtin_guardrails( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BuiltInGuardrailCatalog: + """List Builtin Guardrails + + List the guardrails this gateway can run itself, for the form that defines one. Every guardrail ``any_guardrail`` ships, with the constructor and per-call arguments each one takes, so a guardrail is configured by picking it and filling typed fields. A parameter names the environment variable that fills it where one exists, and ``requirement_groups`` carries the constraints satisfied by any of several parameters, which no single required flag can state. This is the counterpart of ``GET /api/v1/providers/catalog``: the same picker, for a guardrail rather than a provider, and on the same gate that one takes. Reaches no service, so there is no unavailable state to report. ``runnable`` says whether the modules a guardrail's backend needs are installed here, probed rather than imported, and ``missing_extra`` names the Otari extra that would fix it. On the operator router rather than the reader beside it, on both halves of what it answers. It is the input to a write that stores a vendor API key deployment-wide, which is an operator's action alone; and ``runnable`` describes the host's installed packages, which is infrastructure rather than something a tenant is owed about their own requests. A profile *name* is the one thing a caller needs, and the profiles read next door is where the set of those is published. Not on ``verify_catalog_reader`` either: that plane is a closed set of three deployment-describing reads a data-plane key may make, and this is a management read, not one of them. + + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._tool_settings_list_builtin_guardrails_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BuiltInGuardrailCatalog", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def tool_settings_list_builtin_guardrails_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BuiltInGuardrailCatalog]: + """List Builtin Guardrails + + List the guardrails this gateway can run itself, for the form that defines one. Every guardrail ``any_guardrail`` ships, with the constructor and per-call arguments each one takes, so a guardrail is configured by picking it and filling typed fields. A parameter names the environment variable that fills it where one exists, and ``requirement_groups`` carries the constraints satisfied by any of several parameters, which no single required flag can state. This is the counterpart of ``GET /api/v1/providers/catalog``: the same picker, for a guardrail rather than a provider, and on the same gate that one takes. Reaches no service, so there is no unavailable state to report. ``runnable`` says whether the modules a guardrail's backend needs are installed here, probed rather than imported, and ``missing_extra`` names the Otari extra that would fix it. On the operator router rather than the reader beside it, on both halves of what it answers. It is the input to a write that stores a vendor API key deployment-wide, which is an operator's action alone; and ``runnable`` describes the host's installed packages, which is infrastructure rather than something a tenant is owed about their own requests. A profile *name* is the one thing a caller needs, and the profiles read next door is where the set of those is published. Not on ``verify_catalog_reader`` either: that plane is a closed set of three deployment-describing reads a data-plane key may make, and this is a management read, not one of them. + + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._tool_settings_list_builtin_guardrails_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BuiltInGuardrailCatalog", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def tool_settings_list_builtin_guardrails_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Builtin Guardrails + + List the guardrails this gateway can run itself, for the form that defines one. Every guardrail ``any_guardrail`` ships, with the constructor and per-call arguments each one takes, so a guardrail is configured by picking it and filling typed fields. A parameter names the environment variable that fills it where one exists, and ``requirement_groups`` carries the constraints satisfied by any of several parameters, which no single required flag can state. This is the counterpart of ``GET /api/v1/providers/catalog``: the same picker, for a guardrail rather than a provider, and on the same gate that one takes. Reaches no service, so there is no unavailable state to report. ``runnable`` says whether the modules a guardrail's backend needs are installed here, probed rather than imported, and ``missing_extra`` names the Otari extra that would fix it. On the operator router rather than the reader beside it, on both halves of what it answers. It is the input to a write that stores a vendor API key deployment-wide, which is an operator's action alone; and ``runnable`` describes the host's installed packages, which is infrastructure rather than something a tenant is owed about their own requests. A profile *name* is the one thing a caller needs, and the profiles read next door is where the set of those is published. Not on ``verify_catalog_reader`` either: that plane is a closed set of three deployment-describing reads a data-plane key may make, and this is a management read, not one of them. + + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._tool_settings_list_builtin_guardrails_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BuiltInGuardrailCatalog", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _tool_settings_list_builtin_guardrails_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'XApiKeyAuth', + 'ApiKeyAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/tool-settings/guardrails/catalog', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def tool_settings_list_guardrail_profiles( self, diff --git a/src/otari/_client/models/__init__.py b/src/otari/_client/models/__init__.py index 47ec6633..f620a700 100644 --- a/src/otari/_client/models/__init__.py +++ b/src/otari/_client/models/__init__.py @@ -45,11 +45,14 @@ from otari._client.models.audio_speech_request import AudioSpeechRequest from otari._client.models.authenticate_passkey_request import AuthenticatePasskeyRequest from otari._client.models.authorize_response import AuthorizeResponse +from otari._client.models.backend_type import BackendType from otari._client.models.batch_request_item import BatchRequestItem from otari._client.models.billing_meters import BillingMeters from otari._client.models.blob_resource_contents import BlobResourceContents from otari._client.models.budget_reset_log_response import BudgetResetLogResponse 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_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 @@ -150,9 +153,11 @@ from otari._client.models.external_usage_event import ExternalUsageEvent from otari._client.models.gateway_settings import GatewaySettings from otari._client.models.guardrail_catalog import GuardrailCatalog +from otari._client.models.guardrail_category import GuardrailCategory from otari._client.models.guardrail_config import GuardrailConfig from otari._client.models.guardrail_parameter_spec import GuardrailParameterSpec from otari._client.models.guardrail_profile_spec import GuardrailProfileSpec +from otari._client.models.guardrail_stage import GuardrailStage from otari._client.models.http_validation_error import HTTPValidationError from otari._client.models.img_image import IMGImage from otari._client.models.img_usage import IMGUsage @@ -365,6 +370,7 @@ from otari._client.models.organization_scoped_budget_public import OrganizationScopedBudgetPublic from otari._client.models.organization_scoped_budget_update import OrganizationScopedBudgetUpdate from otari._client.models.organization_scoped_budgets_public import OrganizationScopedBudgetsPublic +from otari._client.models.output_shape import OutputShape from otari._client.models.passkey_session_response import PasskeySessionResponse from otari._client.models.password_response import PasswordResponse from otari._client.models.pending_organization_invitation_public import PendingOrganizationInvitationPublic @@ -395,6 +401,7 @@ from otari._client.models.register_passkey_request import RegisterPasskeyRequest from otari._client.models.request_password_reset_request import RequestPasswordResetRequest from otari._client.models.request_password_reset_response import RequestPasswordResetResponse +from otari._client.models.requirement_group import RequirementGroup from otari._client.models.rerank_request import RerankRequest from otari._client.models.rerank_response import RerankResponse from otari._client.models.resend_verification_request import ResendVerificationRequest @@ -476,6 +483,7 @@ from otari._client.models.validation_error import ValidationError from otari._client.models.value import Value from otari._client.models.value1 import Value1 +from otari._client.models.variant_license import VariantLicense from otari._client.models.verify_email_request import VerifyEmailRequest from otari._client.models.verify_email_response import VerifyEmailResponse from otari._client.models.web_authn_credential_public import WebAuthnCredentialPublic diff --git a/src/otari/_client/models/backend_type.py b/src/otari/_client/models/backend_type.py new file mode 100644 index 00000000..4257b174 --- /dev/null +++ b/src/otari/_client/models/backend_type.py @@ -0,0 +1,39 @@ +# 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 BackendType(str, Enum): + """ + How a guardrail executes. + """ + + """ + allowed enum values + """ + LOCAL_ENCODER = 'local_encoder' + LOCAL_DECODER = 'local_decoder' + HOSTED_API = 'hosted_api' + LIBRARY_WRAPPED = 'library_wrapped' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BackendType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/src/otari/_client/models/built_in_guardrail_catalog.py b/src/otari/_client/models/built_in_guardrail_catalog.py new file mode 100644 index 00000000..eb41fb63 --- /dev/null +++ b/src/otari/_client/models/built_in_guardrail_catalog.py @@ -0,0 +1,96 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Optional +from otari._client.models.built_in_guardrail_spec import BuiltInGuardrailSpec +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BuiltInGuardrailCatalog(BaseModel): + """ + Every guardrail this gateway ships, whether or not it can currently run it. + """ # noqa: E501 + guardrails: Optional[List[BuiltInGuardrailSpec]] = None + __properties: ClassVar[List[str]] = ["guardrails"] + + 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 BuiltInGuardrailCatalog 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 guardrails (list) + _items = [] + if self.guardrails: + for _item_guardrails in self.guardrails: + if _item_guardrails: + _items.append(_item_guardrails.to_dict()) + _dict['guardrails'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BuiltInGuardrailCatalog from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "guardrails": [BuiltInGuardrailSpec.from_dict(_item) for _item in obj["guardrails"]] if obj.get("guardrails") is not None else None + }) + return _obj + + diff --git a/src/otari/_client/models/built_in_guardrail_spec.py b/src/otari/_client/models/built_in_guardrail_spec.py new file mode 100644 index 00000000..5d0195ec --- /dev/null +++ b/src/otari/_client/models/built_in_guardrail_spec.py @@ -0,0 +1,162 @@ +# 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, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from otari._client.models.backend_type import BackendType +from otari._client.models.guardrail_category import GuardrailCategory +from otari._client.models.guardrail_parameter_spec import GuardrailParameterSpec +from otari._client.models.requirement_group import RequirementGroup +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BuiltInGuardrailSpec(BaseModel): + """ + One guardrail this gateway can construct and run itself. Upstream's own metadata model, extended rather than copied, so a field it adds is carried instead of waiting on an edit here. The four taxonomy enums document themselves in the published schema, which is why almost nothing below restates what a field name and its type already say; the descriptions that remain are on the answers only this gateway can give. Inheriting also takes upstream's field serializers, which sort every set-valued field on the way out, so the JSON is stable across calls without sorting anything here. + """ # noqa: E501 + alternate_backends: Optional[List[StrictStr]] = None + backend: BackendType + categories: List[StrictStr] + create_parameters: Optional[List[GuardrailParameterSpec]] = Field(default=None, description="Constructor arguments, which is where a vendor API key and an endpoint live") + default_license: StrictStr + description: StrictStr + display_name: StrictStr + guardrail_name: StrictStr = Field(description="The any-guardrail class, and the name a stored guardrail selects") + missing_extra: Optional[StrictStr] = Field(default=None, description="The Otari extra to install to make this runnable, when one would. Null when it already runs, and null for a guardrail this gateway holds no backend information about") + multilingual: Optional[StrictBool] = False + multimodal: Optional[StrictBool] = False + optional_validate_kwargs: Optional[List[StrictStr]] = None + output_shapes: List[StrictStr] + primary_category: GuardrailCategory + required_validate_kwargs: Optional[List[StrictStr]] = None + requirement_groups: Optional[List[RequirementGroup]] = Field(default=None, description="One-of constraints that no single parameter's required flag can express. At least one member of each group must be supplied, or one of the environment variables that satisfies it") + requires_api_key: Optional[StrictBool] = False + runnable: StrictBool = Field(description="Whether every module this guardrail's backend needs is installed here. False is a missing package and not a broken guardrail") + stages: List[StrictStr] + supports_batch: Optional[StrictBool] = Field(default=False, description="Whether several inputs run as one real batched call, not a per-item loop") + validate_parameters: Optional[List[GuardrailParameterSpec]] = Field(default=None, description="Per-call arguments, sent with the text on every check") + variant_licenses: Optional[List[Dict[str, StrictStr]]] = None + vendor: StrictStr + __properties: ClassVar[List[str]] = ["alternate_backends", "backend", "categories", "create_parameters", "default_license", "description", "display_name", "guardrail_name", "missing_extra", "multilingual", "multimodal", "optional_validate_kwargs", "output_shapes", "primary_category", "required_validate_kwargs", "requirement_groups", "requires_api_key", "runnable", "stages", "supports_batch", "validate_parameters", "variant_licenses", "vendor"] + + 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 BuiltInGuardrailSpec 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 create_parameters (list) + _items = [] + if self.create_parameters: + for _item_create_parameters in self.create_parameters: + if _item_create_parameters: + _items.append(_item_create_parameters.to_dict()) + _dict['create_parameters'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in requirement_groups (list) + _items = [] + if self.requirement_groups: + for _item_requirement_groups in self.requirement_groups: + if _item_requirement_groups: + _items.append(_item_requirement_groups.to_dict()) + _dict['requirement_groups'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in validate_parameters (list) + _items = [] + if self.validate_parameters: + for _item_validate_parameters in self.validate_parameters: + if _item_validate_parameters: + _items.append(_item_validate_parameters.to_dict()) + _dict['validate_parameters'] = _items + # set to None if missing_extra (nullable) is None + # and model_fields_set contains the field + if self.missing_extra is None and "missing_extra" in self.model_fields_set: + _dict['missing_extra'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BuiltInGuardrailSpec from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "alternate_backends": obj.get("alternate_backends"), + "backend": obj.get("backend"), + "categories": obj.get("categories"), + "create_parameters": [GuardrailParameterSpec.from_dict(_item) for _item in obj["create_parameters"]] if obj.get("create_parameters") is not None else None, + "default_license": obj.get("default_license"), + "description": obj.get("description"), + "display_name": obj.get("display_name"), + "guardrail_name": obj.get("guardrail_name"), + "missing_extra": obj.get("missing_extra"), + "multilingual": obj.get("multilingual") if obj.get("multilingual") is not None else False, + "multimodal": obj.get("multimodal") if obj.get("multimodal") is not None else False, + "optional_validate_kwargs": obj.get("optional_validate_kwargs"), + "output_shapes": obj.get("output_shapes"), + "primary_category": obj.get("primary_category"), + "required_validate_kwargs": obj.get("required_validate_kwargs"), + "requirement_groups": [RequirementGroup.from_dict(_item) for _item in obj["requirement_groups"]] if obj.get("requirement_groups") is not None else None, + "requires_api_key": obj.get("requires_api_key") if obj.get("requires_api_key") is not None else False, + "runnable": obj.get("runnable"), + "stages": obj.get("stages"), + "supports_batch": obj.get("supports_batch") if obj.get("supports_batch") is not None else False, + "validate_parameters": [GuardrailParameterSpec.from_dict(_item) for _item in obj["validate_parameters"]] if obj.get("validate_parameters") is not None else None, + "variant_licenses": obj.get("variant_licenses"), + "vendor": obj.get("vendor") + }) + return _obj + + diff --git a/src/otari/_client/models/deployment_bootstrap.py b/src/otari/_client/models/deployment_bootstrap.py index 19ce9a7f..06b3ade0 100644 --- a/src/otari/_client/models/deployment_bootstrap.py +++ b/src/otari/_client/models/deployment_bootstrap.py @@ -34,13 +34,14 @@ class DeploymentBootstrap(BaseModel): maintenance_mode: StrictBool = Field(description="Whether this deployment is refusing new dashboard sign-ins while an operator redeploys it. The sign-in screen says so rather than presenting a form whose only outcome is a 503. Sessions already issued keep working, and the management API and the data plane are unaffected. False for a hybrid gateway, which issues no session.") management_url: Optional[StrictStr] = Field(description="Where the authoritative control plane lives when it is not this deployment. Set for a hybrid gateway so its landing page can link to otari.ai; null otherwise.") oauth_providers: List[StrictStr] = Field(description="OAuth providers this deployment can sign somebody in with, sorted, one entry per provider with a client ID, a client secret and a public_base_url to build a redirect URI from. The sign-in screen renders a button per entry and none at all when the list is empty, so a provider nobody configured is absent rather than offered and then refused. Additive to sign_in_methods rather than part of it: an OAuth sign-in coexists with whichever typed credential is current, the way a passkey does. Empty for a hybrid gateway, which issues no session.") + open_signup: StrictBool = Field(description="Whether POST /api/v1/auth/signup creates an account for an address nobody has added yet, each with an organization of its own, or only lets an address an admin already put on the roster set its password. The signup page reads as registration or as claiming an invitation accordingly, and the sign-in screen links to it with the wording that matches. False for a hybrid gateway, which holds no identities.") passkeys_ready: StrictBool = Field(description="Whether this deployment can run a passkey ceremony at all: it has a relying-party ID (webauthn_rp_id, or derived from public_base_url) and an origin to serve one from. Distinct from 'passkey' in sign_in_methods, which is narrower and answers whether a registered passkey could sign somebody in *right now*: an operator with none yet needs this one, or the page that registers the first would be hidden from them. False for a hybrid gateway, which issues no session of its own.") privacy_url: Optional[StrictStr] = Field(description="Where this deployment's privacy notice lives. Set, the account menu's Data & Privacy row links to it; null, no address is configured and that row stays disabled, carrying the standing note that there is nothing to configure there yet. A link target an operator configured, validated at startup as an absolute http(s) URL carrying no credential, since this response is unauthenticated.") session_type: StrictStr = Field(description="The kind of session this deployment issues, not whether the caller holds one. 'local_operator' is the standalone operator sign-in (see sign_in_methods for which credential it currently accepts), 'hosted_user' an otari.ai account, and 'none' a deployment that issues no management session at all.") - sign_in_methods: List[StrictStr] = Field(description="How POST /api/v1/auth/session may be authenticated right now, sorted. 'master_key' is the first-boot credential and is offered until the operator identity has a password, which is what claiming the deployment means; 'password' replaces it from then on, and the master key stays the credential for the management API. 'passkey' appears alongside either one when this deployment is configured for WebAuthn and holds at least one passkey that its current relying-party ID can assert. Empty for a hybrid gateway, which issues no session. The login page renders from this rather than trying a credential to find out.") + sign_in_methods: List[StrictStr] = Field(description="How POST /api/v1/auth/session may be authenticated right now, sorted. 'master_key' is the first-boot credential and is offered until the operator identity has a password, which is what claiming the deployment means; past that it stays the credential for the management API but is no longer a dashboard login. 'password' is offered while any active identity holds one, which is not the same question and not always the later half of it: a member can hold a password on a deployment whose operator never claimed it, so both typed credentials can appear together. 'passkey' appears alongside either when this deployment is configured for WebAuthn and holds at least one passkey that its current relying-party ID can assert. Empty for a hybrid gateway, which issues no session. The login page renders from this rather than trying a credential to find out.") surfaces: List[StrictStr] = Field(description="Management API groups this deployment serves, sorted, which is what its dashboard pages gate on. Named surfaces, not capabilities: capability is otari.ai's word for the entitlement (licensing) axis, and this is the deployment (topology) axis. Empty for a hybrid gateway.") terms_url: Optional[StrictStr] = Field(description="Where this deployment's terms of service live. Set, the account menu carries a Terms of service row pointing at them; null, no address is configured and the menu carries no such row. A link target an operator configured, validated at startup as an absolute http(s) URL carrying no credential, since this response is unauthenticated.") - __properties: ClassVar[List[str]] = ["data_plane_url", "deployment_type", "docs_url", "mail_ready", "maintenance_mode", "management_url", "oauth_providers", "passkeys_ready", "privacy_url", "session_type", "sign_in_methods", "surfaces", "terms_url"] + __properties: ClassVar[List[str]] = ["data_plane_url", "deployment_type", "docs_url", "mail_ready", "maintenance_mode", "management_url", "oauth_providers", "open_signup", "passkeys_ready", "privacy_url", "session_type", "sign_in_methods", "surfaces", "terms_url"] @field_validator('deployment_type') def deployment_type_validate_enum(cls, value): @@ -147,6 +148,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "maintenance_mode": obj.get("maintenance_mode"), "management_url": obj.get("management_url"), "oauth_providers": obj.get("oauth_providers"), + "open_signup": obj.get("open_signup"), "passkeys_ready": obj.get("passkeys_ready"), "privacy_url": obj.get("privacy_url"), "session_type": obj.get("session_type"), diff --git a/src/otari/_client/models/guardrail_category.py b/src/otari/_client/models/guardrail_category.py new file mode 100644 index 00000000..721311bb --- /dev/null +++ b/src/otari/_client/models/guardrail_category.py @@ -0,0 +1,44 @@ +# 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 GuardrailCategory(str, Enum): + """ + What a guardrail is designed to detect (a guardrail may span several). + """ + + """ + allowed enum values + """ + PROMPT_INJECTION = 'prompt_injection' + CONTENT_SAFETY = 'content_safety' + TOXICITY = 'toxicity' + PII = 'pii' + HALLUCINATION = 'hallucination' + OFF_TOPIC = 'off_topic' + BIAS = 'bias' + TOOL_USE = 'tool_use' + GENERAL_JUDGE = 'general_judge' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of GuardrailCategory from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/src/otari/_client/models/guardrail_parameter_spec.py b/src/otari/_client/models/guardrail_parameter_spec.py index e9f4f279..cd88a815 100644 --- a/src/otari/_client/models/guardrail_parameter_spec.py +++ b/src/otari/_client/models/guardrail_parameter_spec.py @@ -30,11 +30,13 @@ class GuardrailParameterSpec(BaseModel): choices: Optional[List[StrictStr]] = Field(default=None, description="Allowed values for an enum parameter") default: Optional[Any] = None description: Optional[StrictStr] = Field(default=None, description="One-line help text from the guardrail's docstring") + env_var: Optional[StrictStr] = Field(default=None, description="The environment variable that supplies this parameter when no value is stored, so a form can offer that instead of demanding a credential the deployment already has") name: StrictStr = Field(description="The keyword argument's name, as it is sent in validate_kwargs") required: StrictBool = Field(description="Whether a value must be supplied for the guardrail to run. Folds together the signature having no default and upstream's effectively-required flag, which covers a parameter that defaults to a value the guardrail then refuses to run without") secret: Optional[StrictBool] = Field(default=False, description="Whether the value is a credential, so a form masks it and never echoes it back") + storable: Optional[StrictBool] = Field(default=True, description="Whether a saved value can stand in for this parameter. False for a secret whose type is json, which upstream uses for a live object (an authenticated SDK client or session) that cannot be written down. A form offers no field for one") type: StrictStr = Field(description="Value shape, so a form can render the matching control") - __properties: ClassVar[List[str]] = ["choices", "default", "description", "name", "required", "secret", "type"] + __properties: ClassVar[List[str]] = ["choices", "default", "description", "env_var", "name", "required", "secret", "storable", "type"] @field_validator('type') def type_validate_enum(cls, value): @@ -97,6 +99,11 @@ def to_dict(self) -> Dict[str, Any]: if self.description is None and "description" in self.model_fields_set: _dict['description'] = None + # set to None if env_var (nullable) is None + # and model_fields_set contains the field + if self.env_var is None and "env_var" in self.model_fields_set: + _dict['env_var'] = None + return _dict @classmethod @@ -112,9 +119,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "choices": obj.get("choices"), "default": obj.get("default"), "description": obj.get("description"), + "env_var": obj.get("env_var"), "name": obj.get("name"), "required": obj.get("required"), "secret": obj.get("secret") if obj.get("secret") is not None else False, + "storable": obj.get("storable") if obj.get("storable") is not None else True, "type": obj.get("type") }) return _obj diff --git a/src/otari/_client/models/guardrail_stage.py b/src/otari/_client/models/guardrail_stage.py new file mode 100644 index 00000000..f738f908 --- /dev/null +++ b/src/otari/_client/models/guardrail_stage.py @@ -0,0 +1,38 @@ +# 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 GuardrailStage(str, Enum): + """ + Where in a request/response flow a guardrail runs. A guardrail that screens both the prompt and the response has ``stages == {INPUT, OUTPUT}`` (there is no separate ``EITHER`` value). ``RAG_CONTEXT`` marks guardrails that additionally consume retrieved documents/context. + """ + + """ + allowed enum values + """ + INPUT = 'input' + OUTPUT = 'output' + RAG_CONTEXT = 'rag_context' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of GuardrailStage from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/src/otari/_client/models/output_shape.py b/src/otari/_client/models/output_shape.py new file mode 100644 index 00000000..44bbb891 --- /dev/null +++ b/src/otari/_client/models/output_shape.py @@ -0,0 +1,41 @@ +# 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 OutputShape(str, Enum): + """ + The decision form a guardrail produces (aligns with the populated ``GuardrailOutput`` fields). ``SCORE`` and ``RUBRIC`` are also the queryable signal for whether ``GuardrailOutput.score`` can ever be populated: a guardrail declaring **neither** always leaves ``score`` as ``None`` (it only emits a categorical/binary verdict, not a calibrated risk value). A guardrail declaring **either** populates ``score`` in the common, successfully-parsed case, but individual guardrails may still leave it ``None`` in specific edge cases (e.g. a fail-closed parse-failure path, or a guardrail that flags something but has nothing to score) — consult the guardrail's own docstring for those exceptions. + """ + + """ + allowed enum values + """ + BINARY = 'binary' + MULTI_LABEL = 'multi_label' + CATEGORICAL = 'categorical' + SCORE = 'score' + RUBRIC = 'rubric' + SPAN = 'span' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of OutputShape from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/src/otari/_client/models/requirement_group.py b/src/otari/_client/models/requirement_group.py new file mode 100644 index 00000000..98081a79 --- /dev/null +++ b/src/otari/_client/models/requirement_group.py @@ -0,0 +1,92 @@ +# 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, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RequirementGroup(BaseModel): + """ + A guardrail-level \"at least one of these must be provided\" constraint. Some guardrails require *a value* that no single parameter's :attr:`ParameterSpec.required` or :attr:`ParameterSpec.effectively_required` can express, because it can be satisfied by any of several parameters — e.g. watsonx needs a ``project_id`` *or* a ``space_id``. Each group names the interchangeable parameters (and any environment variables that also satisfy it); a config UI should require the user to supply at least one member. + """ # noqa: E501 + description: StrictStr + env_vars: Optional[List[StrictStr]] = None + parameters: List[StrictStr] + __properties: ClassVar[List[str]] = ["description", "env_vars", "parameters"] + + 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 RequirementGroup 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 RequirementGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "description": obj.get("description"), + "env_vars": obj.get("env_vars"), + "parameters": obj.get("parameters") + }) + return _obj + + diff --git a/src/otari/_client/models/signup_request.py b/src/otari/_client/models/signup_request.py index cef43e4d..aae8c1f3 100644 --- a/src/otari/_client/models/signup_request.py +++ b/src/otari/_client/models/signup_request.py @@ -26,9 +26,9 @@ class SignupRequest(BaseModel): """ - Claim an identity already on the roster by setting its password. + Set a password for an address, claiming or registering it. """ # noqa: E501 - email: Annotated[str, Field(strict=True, max_length=255)] = Field(description="The address an admin added or invited.") + email: Annotated[str, Field(strict=True, max_length=255)] = Field(description="The address to sign in with. An address an admin added or invited where this deployment keeps signup closed; any address where the bootstrap reports open_signup.") full_name: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(default=None, description="Filled in only if not already set.") password: Annotated[str, Field(min_length=8, strict=True, max_length=1024)] = Field(description="The password to sign in with once verified. At least 8 characters, at most 72 bytes.") terms_accepted: Optional[StrictBool] = Field(default=False, description="Whether the caller accepted this deployment's terms.") diff --git a/src/otari/_client/models/variant_license.py b/src/otari/_client/models/variant_license.py new file mode 100644 index 00000000..3385df05 --- /dev/null +++ b/src/otari/_client/models/variant_license.py @@ -0,0 +1,90 @@ +# 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 VariantLicense(BaseModel): + """ + License governing a single model variant of a guardrail. Used where a guardrail's ``SUPPORTED_MODELS`` span several base models with different governing licenses (e.g. Llama Guard's 3.2 / 3.1 / 4 variants, or PolyGuard's non-commercial Ministral vs Apache Qwen variants), so a single ``default_license`` string cannot capture per-variant redistribution terms. Instances are frozen, so a ``tuple`` of them keeps :class:`GuardrailMetadata` hashable. + """ # noqa: E501 + license: StrictStr + model_id: StrictStr + __properties: ClassVar[List[str]] = ["license", "model_id"] + + 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 VariantLicense 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 VariantLicense from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "license": obj.get("license"), + "model_id": obj.get("model_id") + }) + return _obj + +