client: regenerate from hanzo-inc/cloud@1e531e42c6 (8.5.655)

Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
2026-10-05 16:15:26 +00:00
co-authored by Hanzo Dev
parent 40850a752c
commit 4ffcf2bb1a
29 changed files with 5762 additions and 18 deletions
+38
View File
@@ -268,6 +268,7 @@ __all__ = [
"AiDecisionSides",
"AiDecisionsAction",
"AiDecisionsAnswer",
"AiDecisionsBoolean",
"AiDecisionsChoice",
"AiDecisionsNoul",
"AiDecisionsQuestion",
@@ -569,6 +570,7 @@ __all__ = [
"CaptureBatch",
"CaptureEvent",
"CaptureResult",
"Captured",
"Cart",
"CartItem",
"CartItemSet",
@@ -733,6 +735,9 @@ __all__ = [
"ContentTransitionIn",
"ContentTransitionResult",
"CookieAck",
"CorrectIn",
"Correction",
"Corrections",
"Count",
"CrawlCrawlDocument",
"CrawlCrawlRequest",
@@ -3004,12 +3009,20 @@ __all__ = [
"TrainArtifactsOut",
"TrainAssignment",
"TrainBudget",
"TrainCapabilitiesOut",
"TrainCapability",
"TrainCapture",
"TrainCaptureIn",
"TrainCatalog",
"TrainChose",
"TrainClaimIn",
"TrainClaimed",
"TrainClientList",
"TrainCorrection",
"TrainCorrectionGroup",
"TrainCorrectionsOut",
"TrainCreateClientIn",
"TrainCreateIn",
"TrainDataset",
"TrainDeletedOut",
"TrainDownload",
@@ -3020,6 +3033,7 @@ __all__ = [
"TrainForwardIn",
"TrainJob",
"TrainJobsOut",
"TrainLive",
"TrainMetricsOut",
"TrainObject",
"TrainObjective",
@@ -3030,7 +3044,9 @@ __all__ = [
"TrainPart",
"TrainProjection",
"TrainProtect",
"TrainPublishCapIn",
"TrainPublishIn",
"TrainQuestion",
"TrainRegisterIn",
"TrainRegisterOut",
"TrainReportIn",
@@ -3045,9 +3061,12 @@ __all__ = [
"TrainSupports",
"TrainTaskView",
"TrainTerm",
"TrainTrainIn",
"TrainUnmadeOut",
"TrainUpload",
"TrainUploadIn",
"TrainUsage",
"TrainVersion",
"TranslateMemoryEntry",
"TranslateMemoryPage",
"TranslateReviewRequest",
@@ -3401,6 +3420,7 @@ from hanzoai.cloud.models.ai_decision import AiDecision as AiDecision
from hanzoai.cloud.models.ai_decision_sides import AiDecisionSides as AiDecisionSides
from hanzoai.cloud.models.ai_decisions_action import AiDecisionsAction as AiDecisionsAction
from hanzoai.cloud.models.ai_decisions_answer import AiDecisionsAnswer as AiDecisionsAnswer
from hanzoai.cloud.models.ai_decisions_boolean import AiDecisionsBoolean as AiDecisionsBoolean
from hanzoai.cloud.models.ai_decisions_choice import AiDecisionsChoice as AiDecisionsChoice
from hanzoai.cloud.models.ai_decisions_noul import AiDecisionsNoul as AiDecisionsNoul
from hanzoai.cloud.models.ai_decisions_question import AiDecisionsQuestion as AiDecisionsQuestion
@@ -3702,6 +3722,7 @@ from hanzoai.cloud.models.captable_captable_updated import CaptableCaptableUpdat
from hanzoai.cloud.models.capture_batch import CaptureBatch as CaptureBatch
from hanzoai.cloud.models.capture_event import CaptureEvent as CaptureEvent
from hanzoai.cloud.models.capture_result import CaptureResult as CaptureResult
from hanzoai.cloud.models.captured import Captured as Captured
from hanzoai.cloud.models.cart import Cart as Cart
from hanzoai.cloud.models.cart_item import CartItem as CartItem
from hanzoai.cloud.models.cart_item_set import CartItemSet as CartItemSet
@@ -3866,6 +3887,9 @@ from hanzoai.cloud.models.content_storefront_result import ContentStorefrontResu
from hanzoai.cloud.models.content_transition_in import ContentTransitionIn as ContentTransitionIn
from hanzoai.cloud.models.content_transition_result import ContentTransitionResult as ContentTransitionResult
from hanzoai.cloud.models.cookie_ack import CookieAck as CookieAck
from hanzoai.cloud.models.correct_in import CorrectIn as CorrectIn
from hanzoai.cloud.models.correction import Correction as Correction
from hanzoai.cloud.models.corrections import Corrections as Corrections
from hanzoai.cloud.models.count import Count as Count
from hanzoai.cloud.models.crawl_crawl_document import CrawlCrawlDocument as CrawlCrawlDocument
from hanzoai.cloud.models.crawl_crawl_request import CrawlCrawlRequest as CrawlCrawlRequest
@@ -6137,12 +6161,20 @@ from hanzoai.cloud.models.train_artifact import TrainArtifact as TrainArtifact
from hanzoai.cloud.models.train_artifacts_out import TrainArtifactsOut as TrainArtifactsOut
from hanzoai.cloud.models.train_assignment import TrainAssignment as TrainAssignment
from hanzoai.cloud.models.train_budget import TrainBudget as TrainBudget
from hanzoai.cloud.models.train_capabilities_out import TrainCapabilitiesOut as TrainCapabilitiesOut
from hanzoai.cloud.models.train_capability import TrainCapability as TrainCapability
from hanzoai.cloud.models.train_capture import TrainCapture as TrainCapture
from hanzoai.cloud.models.train_capture_in import TrainCaptureIn as TrainCaptureIn
from hanzoai.cloud.models.train_catalog import TrainCatalog as TrainCatalog
from hanzoai.cloud.models.train_chose import TrainChose as TrainChose
from hanzoai.cloud.models.train_claim_in import TrainClaimIn as TrainClaimIn
from hanzoai.cloud.models.train_claimed import TrainClaimed as TrainClaimed
from hanzoai.cloud.models.train_client_list import TrainClientList as TrainClientList
from hanzoai.cloud.models.train_correction import TrainCorrection as TrainCorrection
from hanzoai.cloud.models.train_correction_group import TrainCorrectionGroup as TrainCorrectionGroup
from hanzoai.cloud.models.train_corrections_out import TrainCorrectionsOut as TrainCorrectionsOut
from hanzoai.cloud.models.train_create_client_in import TrainCreateClientIn as TrainCreateClientIn
from hanzoai.cloud.models.train_create_in import TrainCreateIn as TrainCreateIn
from hanzoai.cloud.models.train_dataset import TrainDataset as TrainDataset
from hanzoai.cloud.models.train_deleted_out import TrainDeletedOut as TrainDeletedOut
from hanzoai.cloud.models.train_download import TrainDownload as TrainDownload
@@ -6153,6 +6185,7 @@ from hanzoai.cloud.models.train_family import TrainFamily as TrainFamily
from hanzoai.cloud.models.train_forward_in import TrainForwardIn as TrainForwardIn
from hanzoai.cloud.models.train_job import TrainJob as TrainJob
from hanzoai.cloud.models.train_jobs_out import TrainJobsOut as TrainJobsOut
from hanzoai.cloud.models.train_live import TrainLive as TrainLive
from hanzoai.cloud.models.train_metrics_out import TrainMetricsOut as TrainMetricsOut
from hanzoai.cloud.models.train_object import TrainObject as TrainObject
from hanzoai.cloud.models.train_objective import TrainObjective as TrainObjective
@@ -6163,7 +6196,9 @@ from hanzoai.cloud.models.train_output import TrainOutput as TrainOutput
from hanzoai.cloud.models.train_part import TrainPart as TrainPart
from hanzoai.cloud.models.train_projection import TrainProjection as TrainProjection
from hanzoai.cloud.models.train_protect import TrainProtect as TrainProtect
from hanzoai.cloud.models.train_publish_cap_in import TrainPublishCapIn as TrainPublishCapIn
from hanzoai.cloud.models.train_publish_in import TrainPublishIn as TrainPublishIn
from hanzoai.cloud.models.train_question import TrainQuestion as TrainQuestion
from hanzoai.cloud.models.train_register_in import TrainRegisterIn as TrainRegisterIn
from hanzoai.cloud.models.train_register_out import TrainRegisterOut as TrainRegisterOut
from hanzoai.cloud.models.train_report_in import TrainReportIn as TrainReportIn
@@ -6178,9 +6213,12 @@ from hanzoai.cloud.models.train_spec import TrainSpec as TrainSpec
from hanzoai.cloud.models.train_supports import TrainSupports as TrainSupports
from hanzoai.cloud.models.train_task_view import TrainTaskView as TrainTaskView
from hanzoai.cloud.models.train_term import TrainTerm as TrainTerm
from hanzoai.cloud.models.train_train_in import TrainTrainIn as TrainTrainIn
from hanzoai.cloud.models.train_unmade_out import TrainUnmadeOut as TrainUnmadeOut
from hanzoai.cloud.models.train_upload import TrainUpload as TrainUpload
from hanzoai.cloud.models.train_upload_in import TrainUploadIn as TrainUploadIn
from hanzoai.cloud.models.train_usage import TrainUsage as TrainUsage
from hanzoai.cloud.models.train_version import TrainVersion as TrainVersion
from hanzoai.cloud.models.translate_memory_entry import TranslateMemoryEntry as TranslateMemoryEntry
from hanzoai.cloud.models.translate_memory_page import TranslateMemoryPage as TranslateMemoryPage
from hanzoai.cloud.models.translate_review_request import TranslateReviewRequest as TranslateReviewRequest
+831
View File
@@ -38,6 +38,9 @@ from hanzoai.cloud.models.ai_routing_edit import AiRoutingEdit
from hanzoai.cloud.models.ai_routing_reward_request import AiRoutingRewardRequest
from hanzoai.cloud.models.ai_token_count import AiTokenCount
from hanzoai.cloud.models.ai_video_status import AiVideoStatus
from hanzoai.cloud.models.correct_in import CorrectIn
from hanzoai.cloud.models.correction import Correction
from hanzoai.cloud.models.corrections import Corrections
from hanzoai.cloud.models.doc_search_result import DocSearchResult
from hanzoai.cloud.models.envelope import Envelope
from hanzoai.cloud.models.get_ai_activities200_response import GetAiActivities200Response
@@ -1809,6 +1812,834 @@ class AiApi:
@validate_call
def decisions_correct(
self,
decision: Annotated[StrictStr, Field(description="Decision is the decision's id.")],
correct_in: CorrectIn,
_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,
) -> Correction:
"""Files a correction of one question of one of the org's Kai decisions: the right answer, which must be one of that question's options and not what Kai answered, and why.
Files a correction of one question of one of the org's Kai decisions: the right answer, which must be one of that question's options and not what Kai answered, and why. A decision Kai captured can teach a capability of its question (/v1/capabilities); one made with capture off is kept with state missing and cannot. The org's first correction turns capture on, so its next decisions can teach. Refused: 409 not_wrong when the answer is Kai's own, 409 corrected when the question already has a correction, 404 when the decision captured no such question.
:param decision: Decision is the decision's id. (required)
:type decision: str
:param correct_in: (required)
:type correct_in: CorrectIn
: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._decisions_correct_serialize(
decision=decision,
correct_in=correct_in,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'201': "Correction",
}
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 decisions_correct_with_http_info(
self,
decision: Annotated[StrictStr, Field(description="Decision is the decision's id.")],
correct_in: CorrectIn,
_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[Correction]:
"""Files a correction of one question of one of the org's Kai decisions: the right answer, which must be one of that question's options and not what Kai answered, and why.
Files a correction of one question of one of the org's Kai decisions: the right answer, which must be one of that question's options and not what Kai answered, and why. A decision Kai captured can teach a capability of its question (/v1/capabilities); one made with capture off is kept with state missing and cannot. The org's first correction turns capture on, so its next decisions can teach. Refused: 409 not_wrong when the answer is Kai's own, 409 corrected when the question already has a correction, 404 when the decision captured no such question.
:param decision: Decision is the decision's id. (required)
:type decision: str
:param correct_in: (required)
:type correct_in: CorrectIn
: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._decisions_correct_serialize(
decision=decision,
correct_in=correct_in,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'201': "Correction",
}
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 decisions_correct_without_preload_content(
self,
decision: Annotated[StrictStr, Field(description="Decision is the decision's id.")],
correct_in: CorrectIn,
_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:
"""Files a correction of one question of one of the org's Kai decisions: the right answer, which must be one of that question's options and not what Kai answered, and why.
Files a correction of one question of one of the org's Kai decisions: the right answer, which must be one of that question's options and not what Kai answered, and why. A decision Kai captured can teach a capability of its question (/v1/capabilities); one made with capture off is kept with state missing and cannot. The org's first correction turns capture on, so its next decisions can teach. Refused: 409 not_wrong when the answer is Kai's own, 409 corrected when the question already has a correction, 404 when the decision captured no such question.
:param decision: Decision is the decision's id. (required)
:type decision: str
:param correct_in: (required)
:type correct_in: CorrectIn
: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._decisions_correct_serialize(
decision=decision,
correct_in=correct_in,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'201': "Correction",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _decisions_correct_serialize(
self,
decision,
correct_in,
_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
if decision is not None:
_path_params['decision'] = decision
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
if correct_in is not None:
_body_params = correct_in
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json',
'application/problem+json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
'bearer'
]
return self.api_client.param_serialize(
method='POST',
resource_path='/v1/decisions/{decision}/corrections',
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 decisions_corrections(
self,
decision: StrictStr,
_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,
) -> Corrections:
"""Answers one of the org's decisions' corrections, each captured (it can teach) or missing (the decision was made with capture off).
Answers one of the org's decisions' corrections, each captured (it can teach) or missing (the decision was made with capture off).
:param decision: (required)
:type decision: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(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._decisions_corrections_serialize(
decision=decision,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "Corrections",
}
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 decisions_corrections_with_http_info(
self,
decision: StrictStr,
_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[Corrections]:
"""Answers one of the org's decisions' corrections, each captured (it can teach) or missing (the decision was made with capture off).
Answers one of the org's decisions' corrections, each captured (it can teach) or missing (the decision was made with capture off).
:param decision: (required)
:type decision: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(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._decisions_corrections_serialize(
decision=decision,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "Corrections",
}
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 decisions_corrections_without_preload_content(
self,
decision: StrictStr,
_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:
"""Answers one of the org's decisions' corrections, each captured (it can teach) or missing (the decision was made with capture off).
Answers one of the org's decisions' corrections, each captured (it can teach) or missing (the decision was made with capture off).
:param decision: (required)
:type decision: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(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._decisions_corrections_serialize(
decision=decision,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "Corrections",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _decisions_corrections_serialize(
self,
decision,
_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
if decision is not None:
_path_params['decision'] = decision
# 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',
'application/problem+json'
]
)
# authentication setting
_auth_settings: List[str] = [
'bearer'
]
return self.api_client.param_serialize(
method='GET',
resource_path='/v1/decisions/{decision}/corrections',
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 decisions_uncorrect(
self,
decision: StrictStr,
id: StrictStr,
_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,
) -> None:
"""Deletes one correction of one of the org's decisions.
Deletes one correction of one of the org's decisions. A capability already taught from it keeps its versions.
:param decision: (required)
:type decision: str
:param id: (required)
:type id: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(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._decisions_uncorrect_serialize(
decision=decision,
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
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 decisions_uncorrect_with_http_info(
self,
decision: StrictStr,
id: StrictStr,
_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[None]:
"""Deletes one correction of one of the org's decisions.
Deletes one correction of one of the org's decisions. A capability already taught from it keeps its versions.
:param decision: (required)
:type decision: str
:param id: (required)
:type id: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(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._decisions_uncorrect_serialize(
decision=decision,
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
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 decisions_uncorrect_without_preload_content(
self,
decision: StrictStr,
id: StrictStr,
_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:
"""Deletes one correction of one of the org's decisions.
Deletes one correction of one of the org's decisions. A capability already taught from it keeps its versions.
:param decision: (required)
:type decision: str
:param id: (required)
:type id: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(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._decisions_uncorrect_serialize(
decision=decision,
id=id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'204': None,
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _decisions_uncorrect_serialize(
self,
decision,
id,
_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
if decision is not None:
_path_params['decision'] = decision
if id is not None:
_path_params['id'] = id
# 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/problem+json'
]
)
# authentication setting
_auth_settings: List[str] = [
'bearer'
]
return self.api_client.param_serialize(
method='DELETE',
resource_path='/v1/decisions/{decision}/corrections/{id}',
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 delete_ai_articles_by_owner_by_name(
self,
File diff suppressed because it is too large Load Diff
+19
View File
@@ -130,6 +130,7 @@ from hanzoai.cloud.models.ai_decision import AiDecision
from hanzoai.cloud.models.ai_decision_sides import AiDecisionSides
from hanzoai.cloud.models.ai_decisions_action import AiDecisionsAction
from hanzoai.cloud.models.ai_decisions_answer import AiDecisionsAnswer
from hanzoai.cloud.models.ai_decisions_boolean import AiDecisionsBoolean
from hanzoai.cloud.models.ai_decisions_choice import AiDecisionsChoice
from hanzoai.cloud.models.ai_decisions_noul import AiDecisionsNoul
from hanzoai.cloud.models.ai_decisions_question import AiDecisionsQuestion
@@ -431,6 +432,7 @@ from hanzoai.cloud.models.captable_captable_updated import CaptableCaptableUpdat
from hanzoai.cloud.models.capture_batch import CaptureBatch
from hanzoai.cloud.models.capture_event import CaptureEvent
from hanzoai.cloud.models.capture_result import CaptureResult
from hanzoai.cloud.models.captured import Captured
from hanzoai.cloud.models.cart import Cart
from hanzoai.cloud.models.cart_item import CartItem
from hanzoai.cloud.models.cart_item_set import CartItemSet
@@ -595,6 +597,9 @@ from hanzoai.cloud.models.content_storefront_result import ContentStorefrontResu
from hanzoai.cloud.models.content_transition_in import ContentTransitionIn
from hanzoai.cloud.models.content_transition_result import ContentTransitionResult
from hanzoai.cloud.models.cookie_ack import CookieAck
from hanzoai.cloud.models.correct_in import CorrectIn
from hanzoai.cloud.models.correction import Correction
from hanzoai.cloud.models.corrections import Corrections
from hanzoai.cloud.models.count import Count
from hanzoai.cloud.models.crawl_crawl_document import CrawlCrawlDocument
from hanzoai.cloud.models.crawl_crawl_request import CrawlCrawlRequest
@@ -2866,12 +2871,20 @@ from hanzoai.cloud.models.train_artifact import TrainArtifact
from hanzoai.cloud.models.train_artifacts_out import TrainArtifactsOut
from hanzoai.cloud.models.train_assignment import TrainAssignment
from hanzoai.cloud.models.train_budget import TrainBudget
from hanzoai.cloud.models.train_capabilities_out import TrainCapabilitiesOut
from hanzoai.cloud.models.train_capability import TrainCapability
from hanzoai.cloud.models.train_capture import TrainCapture
from hanzoai.cloud.models.train_capture_in import TrainCaptureIn
from hanzoai.cloud.models.train_catalog import TrainCatalog
from hanzoai.cloud.models.train_chose import TrainChose
from hanzoai.cloud.models.train_claim_in import TrainClaimIn
from hanzoai.cloud.models.train_claimed import TrainClaimed
from hanzoai.cloud.models.train_client_list import TrainClientList
from hanzoai.cloud.models.train_correction import TrainCorrection
from hanzoai.cloud.models.train_correction_group import TrainCorrectionGroup
from hanzoai.cloud.models.train_corrections_out import TrainCorrectionsOut
from hanzoai.cloud.models.train_create_client_in import TrainCreateClientIn
from hanzoai.cloud.models.train_create_in import TrainCreateIn
from hanzoai.cloud.models.train_dataset import TrainDataset
from hanzoai.cloud.models.train_deleted_out import TrainDeletedOut
from hanzoai.cloud.models.train_download import TrainDownload
@@ -2882,6 +2895,7 @@ from hanzoai.cloud.models.train_family import TrainFamily
from hanzoai.cloud.models.train_forward_in import TrainForwardIn
from hanzoai.cloud.models.train_job import TrainJob
from hanzoai.cloud.models.train_jobs_out import TrainJobsOut
from hanzoai.cloud.models.train_live import TrainLive
from hanzoai.cloud.models.train_metrics_out import TrainMetricsOut
from hanzoai.cloud.models.train_object import TrainObject
from hanzoai.cloud.models.train_objective import TrainObjective
@@ -2892,7 +2906,9 @@ from hanzoai.cloud.models.train_output import TrainOutput
from hanzoai.cloud.models.train_part import TrainPart
from hanzoai.cloud.models.train_projection import TrainProjection
from hanzoai.cloud.models.train_protect import TrainProtect
from hanzoai.cloud.models.train_publish_cap_in import TrainPublishCapIn
from hanzoai.cloud.models.train_publish_in import TrainPublishIn
from hanzoai.cloud.models.train_question import TrainQuestion
from hanzoai.cloud.models.train_register_in import TrainRegisterIn
from hanzoai.cloud.models.train_register_out import TrainRegisterOut
from hanzoai.cloud.models.train_report_in import TrainReportIn
@@ -2907,9 +2923,12 @@ from hanzoai.cloud.models.train_spec import TrainSpec
from hanzoai.cloud.models.train_supports import TrainSupports
from hanzoai.cloud.models.train_task_view import TrainTaskView
from hanzoai.cloud.models.train_term import TrainTerm
from hanzoai.cloud.models.train_train_in import TrainTrainIn
from hanzoai.cloud.models.train_unmade_out import TrainUnmadeOut
from hanzoai.cloud.models.train_upload import TrainUpload
from hanzoai.cloud.models.train_upload_in import TrainUploadIn
from hanzoai.cloud.models.train_usage import TrainUsage
from hanzoai.cloud.models.train_version import TrainVersion
from hanzoai.cloud.models.translate_memory_entry import TranslateMemoryEntry
from hanzoai.cloud.models.translate_memory_page import TranslateMemoryPage
from hanzoai.cloud.models.translate_review_request import TranslateReviewRequest
@@ -34,15 +34,16 @@ class AiDecisionsAnswer(BaseModel):
legend: Optional[Dict[str, Any]] = None
noul: Optional[Union[StrictFloat, StrictInt]] = None
probabilities: Optional[Dict[str, Union[StrictFloat, StrictInt]]] = None
probability: Optional[Union[StrictFloat, StrictInt]] = None
score: Optional[Union[StrictFloat, StrictInt]] = None
type: StrictStr
__properties: ClassVar[List[str]] = ["action", "answer_confidence", "choice", "confidence", "legend", "noul", "probabilities", "score", "type"]
__properties: ClassVar[List[str]] = ["action", "answer_confidence", "choice", "confidence", "legend", "noul", "probabilities", "probability", "score", "type"]
@field_validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(['noul', 'choice', 'score']):
raise ValueError("must be one of enum values ('noul', 'choice', 'score')")
if value not in set(['boolean', 'noul', 'choice', 'score']):
raise ValueError("must be one of enum values ('boolean', 'noul', 'choice', 'score')")
return value
model_config = ConfigDict(
@@ -106,6 +107,7 @@ class AiDecisionsAnswer(BaseModel):
"legend": obj.get("legend"),
"noul": obj.get("noul"),
"probabilities": obj.get("probabilities"),
"probability": obj.get("probability"),
"score": obj.get("score"),
"type": obj.get("type")
})
@@ -0,0 +1,109 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from hanzoai.cloud.models.ai_decision_sides import AiDecisionSides
from typing import Optional, Set
from typing_extensions import Self
class AiDecisionsBoolean(BaseModel):
"""
AiDecisionsBoolean
""" # noqa: E501
criteria: Optional[AiDecisionSides] = None
instructions: Optional[Any] = None
labels: Optional[Dict[str, StrictStr]] = None
type: StrictStr
__properties: ClassVar[List[str]] = ["criteria", "instructions", "labels", "type"]
@field_validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(['boolean']):
raise ValueError("must be one of enum values ('boolean')")
return value
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of AiDecisionsBoolean 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 criteria
if self.criteria:
_dict['criteria'] = self.criteria.to_dict()
# set to None if instructions (nullable) is None
# and model_fields_set contains the field
if self.instructions is None and "instructions" in self.model_fields_set:
_dict['instructions'] = None
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of AiDecisionsBoolean from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"criteria": AiDecisionSides.from_dict(obj["criteria"]) if obj.get("criteria") is not None else None,
"instructions": obj.get("instructions"),
"labels": obj.get("labels"),
"type": obj.get("type")
})
return _obj
@@ -17,6 +17,7 @@ import json
import pprint
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
from typing import Any, List, Optional
from hanzoai.cloud.models.ai_decisions_boolean import AiDecisionsBoolean
from hanzoai.cloud.models.ai_decisions_choice import AiDecisionsChoice
from hanzoai.cloud.models.ai_decisions_noul import AiDecisionsNoul
from hanzoai.cloud.models.ai_decisions_score import AiDecisionsScore
@@ -24,20 +25,22 @@ from pydantic import BaseModel, StrictStr, Field, model_validator
from typing import Any, Union, List, Set, Optional, Dict
from typing_extensions import Literal, Self
AIDECISIONSQUESTION_ONE_OF_SCHEMAS = ["AiDecisionsChoice", "AiDecisionsNoul", "AiDecisionsScore"]
AIDECISIONSQUESTION_ONE_OF_SCHEMAS = ["AiDecisionsBoolean", "AiDecisionsChoice", "AiDecisionsNoul", "AiDecisionsScore"]
class AiDecisionsQuestion(BaseModel):
"""
AiDecisionsQuestion
"""
# data type: AiDecisionsBoolean
oneof_schema_1_validator: Optional[AiDecisionsBoolean] = None
# data type: AiDecisionsNoul
oneof_schema_1_validator: Optional[AiDecisionsNoul] = None
oneof_schema_2_validator: Optional[AiDecisionsNoul] = None
# data type: AiDecisionsChoice
oneof_schema_2_validator: Optional[AiDecisionsChoice] = None
oneof_schema_3_validator: Optional[AiDecisionsChoice] = None
# data type: AiDecisionsScore
oneof_schema_3_validator: Optional[AiDecisionsScore] = None
actual_instance: Optional[Union[AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore]] = None
one_of_schemas: Set[str] = { "AiDecisionsChoice", "AiDecisionsNoul", "AiDecisionsScore" }
oneof_schema_4_validator: Optional[AiDecisionsScore] = None
actual_instance: Optional[Union[AiDecisionsBoolean, AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore]] = None
one_of_schemas: Set[str] = { "AiDecisionsBoolean", "AiDecisionsChoice", "AiDecisionsNoul", "AiDecisionsScore" }
model_config = ConfigDict(
validate_assignment=True,
@@ -79,6 +82,11 @@ class AiDecisionsQuestion(BaseModel):
instance = AiDecisionsQuestion.model_construct()
error_messages = []
match = 0
# validate data type: AiDecisionsBoolean
if not isinstance(v, AiDecisionsBoolean):
error_messages.append(f"Error! Input type `{type(v)}` is not `AiDecisionsBoolean`")
else:
match += 1
# validate data type: AiDecisionsNoul
if not isinstance(v, AiDecisionsNoul):
error_messages.append(f"Error! Input type `{type(v)}` is not `AiDecisionsNoul`")
@@ -96,10 +104,10 @@ class AiDecisionsQuestion(BaseModel):
match += 1
if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when setting `actual_instance` in AiDecisionsQuestion with oneOf schemas: AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore. Details: " + ", ".join(error_messages))
raise ValueError("Multiple matches found when setting `actual_instance` in AiDecisionsQuestion with oneOf schemas: AiDecisionsBoolean, AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore. Details: " + ", ".join(error_messages))
elif match == 0:
# no match
raise ValueError("No match found when setting `actual_instance` in AiDecisionsQuestion with oneOf schemas: AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore. Details: " + ", ".join(error_messages))
raise ValueError("No match found when setting `actual_instance` in AiDecisionsQuestion with oneOf schemas: AiDecisionsBoolean, AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore. Details: " + ", ".join(error_messages))
else:
return v
@@ -114,6 +122,12 @@ class AiDecisionsQuestion(BaseModel):
error_messages = []
match = 0
# deserialize data into AiDecisionsBoolean
try:
instance.actual_instance = AiDecisionsBoolean.from_json(json_str)
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# deserialize data into AiDecisionsNoul
try:
instance.actual_instance = AiDecisionsNoul.from_json(json_str)
@@ -135,10 +149,10 @@ class AiDecisionsQuestion(BaseModel):
if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when deserializing the JSON string into AiDecisionsQuestion with oneOf schemas: AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore. Details: " + ", ".join(error_messages))
raise ValueError("Multiple matches found when deserializing the JSON string into AiDecisionsQuestion with oneOf schemas: AiDecisionsBoolean, AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore. Details: " + ", ".join(error_messages))
elif match == 0:
# no match
raise ValueError("No match found when deserializing the JSON string into AiDecisionsQuestion with oneOf schemas: AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore. Details: " + ", ".join(error_messages))
raise ValueError("No match found when deserializing the JSON string into AiDecisionsQuestion with oneOf schemas: AiDecisionsBoolean, AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore. Details: " + ", ".join(error_messages))
else:
return instance
@@ -152,7 +166,7 @@ class AiDecisionsQuestion(BaseModel):
else:
return json.dumps(self.actual_instance)
def to_dict(self) -> Optional[Union[Dict[str, Any], AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore]]:
def to_dict(self) -> Optional[Union[Dict[str, Any], AiDecisionsBoolean, AiDecisionsChoice, AiDecisionsNoul, AiDecisionsScore]]:
"""Returns the dict representation of the actual instance"""
if self.actual_instance is None:
return None
+93
View File
@@ -0,0 +1,93 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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
class Captured(BaseModel):
"""
Captured
""" # noqa: E501
answered: Optional[StrictStr] = Field(default=None, description="Answered is the label the caller was answered: the org's capability's when one answered, else Kai's own.")
key: Optional[StrictStr] = None
labels: Optional[List[StrictStr]] = None
type: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["answered", "key", "labels", "type"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of Captured 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 Captured from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"answered": obj.get("answered"),
"key": obj.get("key"),
"labels": obj.get("labels"),
"type": obj.get("type")
})
return _obj
+95
View File
@@ -0,0 +1,95 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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
class CorrectIn(BaseModel):
"""
CorrectIn
""" # noqa: E501
answer: Optional[StrictStr] = Field(default=None, description="Answer is the right option label; a score's level may be named by its index.")
cohort: Optional[StrictStr] = Field(default=None, description="Cohort groups corrections the org files together.")
decision: Optional[StrictStr] = Field(default=None, description="Decision is the decision's id.")
note: Optional[StrictStr] = Field(default=None, description="Note says why, for the person reading it later.")
question: Optional[StrictStr] = Field(default=None, description="Question is the question's key.")
__properties: ClassVar[List[str]] = ["answer", "cohort", "decision", "note", "question"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of CorrectIn 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 CorrectIn from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"answer": obj.get("answer"),
"cohort": obj.get("cohort"),
"decision": obj.get("decision"),
"note": obj.get("note"),
"question": obj.get("question")
})
return _obj
+109
View File
@@ -0,0 +1,109 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class Correction(BaseModel):
"""
Correction
""" # noqa: E501
answer: Optional[StrictStr] = Field(default=None, description="Answer is the right answer; Base what Kai answered.")
at: Optional[StrictInt] = None
base: Optional[StrictStr] = None
by: Optional[StrictStr] = None
cohort: Optional[StrictStr] = None
decision: Optional[StrictStr] = None
id: Optional[StrictStr] = None
labels: Optional[List[StrictStr]] = None
note: Optional[StrictStr] = None
question: Optional[StrictStr] = None
state: Optional[StrictStr] = Field(default=None, description="State is captured when the decision's state is held and the correction can teach, missing when the decision was made with capture off.")
type: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["answer", "at", "base", "by", "cohort", "decision", "id", "labels", "note", "question", "state", "type"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of Correction 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 Correction from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"answer": obj.get("answer"),
"at": obj.get("at"),
"base": obj.get("base"),
"by": obj.get("by"),
"cohort": obj.get("cohort"),
"decision": obj.get("decision"),
"id": obj.get("id"),
"labels": obj.get("labels"),
"note": obj.get("note"),
"question": obj.get("question"),
"state": obj.get("state"),
"type": obj.get("type")
})
return _obj
+105
View File
@@ -0,0 +1,105 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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, Optional
from hanzoai.cloud.models.captured import Captured
from hanzoai.cloud.models.correction import Correction
from typing import Optional, Set
from typing_extensions import Self
class Corrections(BaseModel):
"""
Corrections
""" # noqa: E501
data: Optional[List[Correction]] = None
questions: Optional[List[Captured]] = Field(default=None, description="Questions are the decision's captured questions, by key; none when it was made with capture off.")
__properties: ClassVar[List[str]] = ["data", "questions"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of Corrections 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 data (list)
_items = []
if self.data:
for _item_data in self.data:
if _item_data:
_items.append(_item_data.to_dict())
_dict['data'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in questions (list)
_items = []
if self.questions:
for _item_questions in self.questions:
if _item_questions:
_items.append(_item_questions.to_dict())
_dict['questions'] = _items
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of Corrections from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"data": [Correction.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
"questions": [Captured.from_dict(_item) for _item in obj["questions"]] if obj.get("questions") is not None else None
})
return _obj
@@ -0,0 +1,95 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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 hanzoai.cloud.models.train_capability import TrainCapability
from typing import Optional, Set
from typing_extensions import Self
class TrainCapabilitiesOut(BaseModel):
"""
TrainCapabilitiesOut
""" # noqa: E501
data: Optional[List[TrainCapability]] = None
__properties: ClassVar[List[str]] = ["data"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainCapabilitiesOut 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 data (list)
_items = []
if self.data:
for _item_data in self.data:
if _item_data:
_items.append(_item_data.to_dict())
_dict['data'] = _items
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of TrainCapabilitiesOut from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"data": [TrainCapability.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None
})
return _obj
@@ -0,0 +1,123 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from hanzoai.cloud.models.train_live import TrainLive
from hanzoai.cloud.models.train_question import TrainQuestion
from hanzoai.cloud.models.train_version import TrainVersion
from typing import Optional, Set
from typing_extensions import Self
class TrainCapability(BaseModel):
"""
TrainCapability
""" # noqa: E501
by: Optional[StrictStr] = None
corrections: Optional[List[StrictStr]] = Field(default=None, description="Corrections are the corrections it is taught from.")
created: Optional[StrictInt] = None
installed: Optional[StrictInt] = Field(default=None, description="Installed is the version in the org's published set, 0 when none.")
live: Optional[TrainLive] = Field(default=None, description="Live is what its installed version did since it went in.")
name: Optional[StrictStr] = Field(default=None, description="Name is its name, one per org; it is the name its versions install under.")
question: Optional[TrainQuestion] = Field(default=None, description="Question is what it answers: the route it is installed behind.")
state: Optional[StrictStr] = Field(default=None, description="State is where it is in its life: draft, trained, evaluated, publishable, installed, active, disabled or needs_validation.")
updated: Optional[StrictInt] = None
version: Optional[StrictInt] = Field(default=None, description="Version is its latest version, 0 in draft.")
versions: Optional[List[TrainVersion]] = Field(default=None, description="Versions are its versions, newest first (one capability read).")
__properties: ClassVar[List[str]] = ["by", "corrections", "created", "installed", "live", "name", "question", "state", "updated", "version", "versions"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainCapability 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 live
if self.live:
_dict['live'] = self.live.to_dict()
# override the default output from pydantic by calling `to_dict()` of question
if self.question:
_dict['question'] = self.question.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in versions (list)
_items = []
if self.versions:
for _item_versions in self.versions:
if _item_versions:
_items.append(_item_versions.to_dict())
_dict['versions'] = _items
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of TrainCapability from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"by": obj.get("by"),
"corrections": obj.get("corrections"),
"created": obj.get("created"),
"installed": obj.get("installed"),
"live": TrainLive.from_dict(obj["live"]) if obj.get("live") is not None else None,
"name": obj.get("name"),
"question": TrainQuestion.from_dict(obj["question"]) if obj.get("question") is not None else None,
"state": obj.get("state"),
"updated": obj.get("updated"),
"version": obj.get("version"),
"versions": [TrainVersion.from_dict(_item) for _item in obj["versions"]] if obj.get("versions") is not None else None
})
return _obj
+89
View File
@@ -0,0 +1,89 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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, StrictInt
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TrainCapture(BaseModel):
"""
TrainCapture
""" # noqa: E501
on: Optional[StrictBool] = None
retention_days: Optional[StrictInt] = Field(default=None, description="RetentionDays is how long a decision's states are kept unless a correction names it.")
__properties: ClassVar[List[str]] = ["on", "retention_days"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainCapture 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 TrainCapture from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"on": obj.get("on"),
"retention_days": obj.get("retention_days")
})
return _obj
@@ -0,0 +1,87 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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, StrictBool
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TrainCaptureIn(BaseModel):
"""
TrainCaptureIn
""" # noqa: E501
on: Optional[StrictBool] = None
__properties: ClassVar[List[str]] = ["on"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainCaptureIn 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 TrainCaptureIn from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"on": obj.get("on")
})
return _obj
@@ -0,0 +1,109 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TrainCorrection(BaseModel):
"""
TrainCorrection
""" # noqa: E501
answer: Optional[StrictStr] = None
at: Optional[StrictInt] = None
base: Optional[StrictStr] = None
by: Optional[StrictStr] = None
cohort: Optional[StrictStr] = None
decision: Optional[StrictStr] = None
id: Optional[StrictStr] = None
labels: Optional[List[StrictStr]] = None
note: Optional[StrictStr] = None
question: Optional[StrictStr] = None
state: Optional[StrictStr] = None
type: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["answer", "at", "base", "by", "cohort", "decision", "id", "labels", "note", "question", "state", "type"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainCorrection 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 TrainCorrection from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"answer": obj.get("answer"),
"at": obj.get("at"),
"base": obj.get("base"),
"by": obj.get("by"),
"cohort": obj.get("cohort"),
"decision": obj.get("decision"),
"id": obj.get("id"),
"labels": obj.get("labels"),
"note": obj.get("note"),
"question": obj.get("question"),
"state": obj.get("state"),
"type": obj.get("type")
})
return _obj
@@ -0,0 +1,93 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TrainCorrectionGroup(BaseModel):
"""
TrainCorrectionGroup
""" # noqa: E501
corrections: Optional[StrictInt] = None
key: Optional[StrictStr] = None
labels: Optional[List[StrictStr]] = None
type: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["corrections", "key", "labels", "type"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainCorrectionGroup 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 TrainCorrectionGroup from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"corrections": obj.get("corrections"),
"key": obj.get("key"),
"labels": obj.get("labels"),
"type": obj.get("type")
})
return _obj
@@ -0,0 +1,105 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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 hanzoai.cloud.models.train_correction import TrainCorrection
from hanzoai.cloud.models.train_correction_group import TrainCorrectionGroup
from typing import Optional, Set
from typing_extensions import Self
class TrainCorrectionsOut(BaseModel):
"""
TrainCorrectionsOut
""" # noqa: E501
data: Optional[List[TrainCorrection]] = None
questions: Optional[List[TrainCorrectionGroup]] = None
__properties: ClassVar[List[str]] = ["data", "questions"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainCorrectionsOut 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 data (list)
_items = []
if self.data:
for _item_data in self.data:
if _item_data:
_items.append(_item_data.to_dict())
_dict['data'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in questions (list)
_items = []
if self.questions:
for _item_questions in self.questions:
if _item_questions:
_items.append(_item_questions.to_dict())
_dict['questions'] = _items
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of TrainCorrectionsOut from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"data": [TrainCorrection.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
"questions": [TrainCorrectionGroup.from_dict(_item) for _item in obj["questions"]] if obj.get("questions") is not None else None
})
return _obj
@@ -0,0 +1,89 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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
class TrainCreateIn(BaseModel):
"""
TrainCreateIn
""" # noqa: E501
corrections: Optional[List[StrictStr]] = Field(default=None, description="Corrections are the corrections it is taught from: captured corrections of one question, which becomes its route.")
name: Optional[StrictStr] = Field(default=None, description="Name is its name: lowercase words joined by hyphens, at most 64.")
__properties: ClassVar[List[str]] = ["corrections", "name"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainCreateIn 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 TrainCreateIn from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"corrections": obj.get("corrections"),
"name": obj.get("name")
})
return _obj
+101
View File
@@ -0,0 +1,101 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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, StrictFloat, StrictInt
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
class TrainLive(BaseModel):
"""
TrainLive
""" # noqa: E501
damage: Optional[StrictInt] = None
damage_rate: Optional[Union[StrictFloat, StrictInt]] = None
fires: Optional[StrictInt] = Field(default=None, description="Fires counts decisions it answered otherwise than the base would have.")
last_fired: Optional[StrictInt] = Field(default=None, description="LastFired is when it last fired, unix seconds; 0 never.")
neutral: Optional[StrictInt] = None
repair_rate: Optional[Union[StrictFloat, StrictInt]] = None
repairs: Optional[StrictInt] = Field(default=None, description="Repairs are fires that changed the label and no correction contradicts; Damage, fires whose label a correction put back to the base's; Neutral, fires that kept the base's label.")
version: Optional[StrictInt] = None
__properties: ClassVar[List[str]] = ["damage", "damage_rate", "fires", "last_fired", "neutral", "repair_rate", "repairs", "version"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainLive 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 TrainLive from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"damage": obj.get("damage"),
"damage_rate": obj.get("damage_rate"),
"fires": obj.get("fires"),
"last_fired": obj.get("last_fired"),
"neutral": obj.get("neutral"),
"repair_rate": obj.get("repair_rate"),
"repairs": obj.get("repairs"),
"version": obj.get("version")
})
return _obj
@@ -0,0 +1,89 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TrainPublishCapIn(BaseModel):
"""
TrainPublishCapIn
""" # noqa: E501
name: Optional[StrictStr] = None
version: Optional[StrictInt] = Field(default=None, description="Version is the version to install; the newest that passed when absent.")
__properties: ClassVar[List[str]] = ["name", "version"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainPublishCapIn 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 TrainPublishCapIn from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"name": obj.get("name"),
"version": obj.get("version")
})
return _obj
@@ -0,0 +1,91 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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
class TrainQuestion(BaseModel):
"""
TrainQuestion
""" # noqa: E501
key: Optional[StrictStr] = None
labels: Optional[List[StrictStr]] = None
type: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["key", "labels", "type"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainQuestion 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 TrainQuestion from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"key": obj.get("key"),
"labels": obj.get("labels"),
"type": obj.get("type")
})
return _obj
@@ -0,0 +1,89 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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
class TrainTrainIn(BaseModel):
"""
TrainTrainIn
""" # noqa: E501
corrections: Optional[List[StrictStr]] = Field(default=None, description="Corrections, when given, replace the corrections it is taught from: captured corrections of its question.")
name: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["corrections", "name"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainTrainIn 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 TrainTrainIn from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"corrections": obj.get("corrections"),
"name": obj.get("name")
})
return _obj
@@ -0,0 +1,89 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TrainUnmadeOut(BaseModel):
"""
TrainUnmadeOut
""" # noqa: E501
deleted: Optional[StrictBool] = None
name: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["deleted", "name"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainUnmadeOut 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 TrainUnmadeOut from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"deleted": obj.get("deleted"),
"name": obj.get("name")
})
return _obj
+116
View File
@@ -0,0 +1,116 @@
# coding: utf-8
"""
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
The version of the OpenAPI document: v1
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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class TrainVersion(BaseModel):
"""
TrainVersion
""" # noqa: E501
at: Optional[StrictInt] = None
base_sha256: Optional[StrictStr] = Field(default=None, description="BaseSHA256 is Kai's weights it was taught over.")
by: Optional[StrictStr] = None
bytes: Optional[StrictInt] = Field(default=None, description="Bytes is its artifact's size.")
corrections: Optional[List[StrictStr]] = Field(default=None, description="Corrections are the corrections it was taught from.")
evaluation: Optional[Any] = None
form: Optional[StrictStr] = Field(default=None, description="Form is calibration, head or pair; Rank its place, 1 the smallest.")
passed: Optional[StrictBool] = Field(default=None, description="Passed says its evaluation passed the gate: it is publishable.")
questions: Optional[List[StrictStr]] = Field(default=None, description="Questions are the question keys it answers.")
rank: Optional[StrictInt] = None
representation: Optional[StrictStr] = Field(default=None, description="Representation is what it reads of Kai (the weights, tokenizer, layout and pooling, hashed): the only Kai it serves on, whatever the release.")
sha256: Optional[StrictStr] = Field(default=None, description="SHA256 is its artifact's: the tar the decision service installs.")
version: Optional[StrictInt] = None
__properties: ClassVar[List[str]] = ["at", "base_sha256", "by", "bytes", "corrections", "evaluation", "form", "passed", "questions", "rank", "representation", "sha256", "version"]
model_config = ConfigDict(
populate_by_name=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"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TrainVersion 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 evaluation (nullable) is None
# and model_fields_set contains the field
if self.evaluation is None and "evaluation" in self.model_fields_set:
_dict['evaluation'] = None
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of TrainVersion from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"at": obj.get("at"),
"base_sha256": obj.get("base_sha256"),
"by": obj.get("by"),
"bytes": obj.get("bytes"),
"corrections": obj.get("corrections"),
"evaluation": obj.get("evaluation"),
"form": obj.get("form"),
"passed": obj.get("passed"),
"questions": obj.get("questions"),
"rank": obj.get("rank"),
"representation": obj.get("representation"),
"sha256": obj.get("sha256"),
"version": obj.get("version")
})
return _obj