scorable 1.6.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of scorable might be problematic. Click here for more details.
- root/__about__.py +4 -0
- root/__init__.py +17 -0
- root/client.py +207 -0
- root/datasets.py +231 -0
- root/execution_logs.py +162 -0
- root/generated/__init__.py +0 -0
- root/generated/openapi_aclient/__init__.py +1 -0
- root/generated/openapi_aclient/api/__init__.py +1 -0
- root/generated/openapi_aclient/api/datasets_api.py +1274 -0
- root/generated/openapi_aclient/api/evaluators_api.py +3641 -0
- root/generated/openapi_aclient/api/execution_logs_api.py +751 -0
- root/generated/openapi_aclient/api/judges_api.py +3794 -0
- root/generated/openapi_aclient/api/models_api.py +1473 -0
- root/generated/openapi_aclient/api/objectives_api.py +1767 -0
- root/generated/openapi_aclient/api_client.py +662 -0
- root/generated/openapi_aclient/api_response.py +22 -0
- root/generated/openapi_aclient/configuration.py +470 -0
- root/generated/openapi_aclient/exceptions.py +197 -0
- root/generated/openapi_aclient/models/__init__.py +122 -0
- root/generated/openapi_aclient/models/data_set_create.py +118 -0
- root/generated/openapi_aclient/models/data_set_create_request.py +105 -0
- root/generated/openapi_aclient/models/data_set_list.py +129 -0
- root/generated/openapi_aclient/models/data_set_type.py +36 -0
- root/generated/openapi_aclient/models/dataset_range_request.py +93 -0
- root/generated/openapi_aclient/models/evaluator.py +273 -0
- root/generated/openapi_aclient/models/evaluator_calibration_output.py +101 -0
- root/generated/openapi_aclient/models/evaluator_calibration_result.py +134 -0
- root/generated/openapi_aclient/models/evaluator_demonstrations.py +107 -0
- root/generated/openapi_aclient/models/evaluator_demonstrations_request.py +107 -0
- root/generated/openapi_aclient/models/evaluator_execution_function_parameter_property_request.py +86 -0
- root/generated/openapi_aclient/models/evaluator_execution_function_parameter_request.py +109 -0
- root/generated/openapi_aclient/models/evaluator_execution_function_parameter_type_enum.py +35 -0
- root/generated/openapi_aclient/models/evaluator_execution_function_request.py +99 -0
- root/generated/openapi_aclient/models/evaluator_execution_functions_request.py +98 -0
- root/generated/openapi_aclient/models/evaluator_execution_functions_type_enum.py +35 -0
- root/generated/openapi_aclient/models/evaluator_execution_request.py +134 -0
- root/generated/openapi_aclient/models/evaluator_execution_result.py +114 -0
- root/generated/openapi_aclient/models/evaluator_inputs_value.py +100 -0
- root/generated/openapi_aclient/models/evaluator_inputs_value_items.py +89 -0
- root/generated/openapi_aclient/models/evaluator_list_output.py +198 -0
- root/generated/openapi_aclient/models/evaluator_reference.py +90 -0
- root/generated/openapi_aclient/models/evaluator_reference_request.py +90 -0
- root/generated/openapi_aclient/models/evaluator_request.py +194 -0
- root/generated/openapi_aclient/models/evaluator_result.py +110 -0
- root/generated/openapi_aclient/models/execution_log_details.py +291 -0
- root/generated/openapi_aclient/models/execution_log_details_evaluation_context.py +83 -0
- root/generated/openapi_aclient/models/execution_log_details_evaluator_latencies_inner.py +83 -0
- root/generated/openapi_aclient/models/execution_log_list.py +217 -0
- root/generated/openapi_aclient/models/execution_log_list_evaluation_context.py +83 -0
- root/generated/openapi_aclient/models/generation_model_params_request.py +93 -0
- root/generated/openapi_aclient/models/id.py +87 -0
- root/generated/openapi_aclient/models/input_variable.py +121 -0
- root/generated/openapi_aclient/models/input_variable_request.py +82 -0
- root/generated/openapi_aclient/models/judge.py +178 -0
- root/generated/openapi_aclient/models/judge_execution_request.py +114 -0
- root/generated/openapi_aclient/models/judge_execution_response.py +97 -0
- root/generated/openapi_aclient/models/judge_files_inner.py +84 -0
- root/generated/openapi_aclient/models/judge_generator_request.py +142 -0
- root/generated/openapi_aclient/models/judge_generator_response.py +88 -0
- root/generated/openapi_aclient/models/judge_invite_request.py +87 -0
- root/generated/openapi_aclient/models/judge_list.py +156 -0
- root/generated/openapi_aclient/models/judge_rectifier_request_request.py +114 -0
- root/generated/openapi_aclient/models/judge_rectifier_response.py +121 -0
- root/generated/openapi_aclient/models/judge_request.py +108 -0
- root/generated/openapi_aclient/models/model.py +126 -0
- root/generated/openapi_aclient/models/model_list.py +115 -0
- root/generated/openapi_aclient/models/model_params.py +89 -0
- root/generated/openapi_aclient/models/model_params_request.py +89 -0
- root/generated/openapi_aclient/models/model_request.py +118 -0
- root/generated/openapi_aclient/models/nested_evaluator.py +110 -0
- root/generated/openapi_aclient/models/nested_evaluator_objective.py +87 -0
- root/generated/openapi_aclient/models/nested_evaluator_request.py +92 -0
- root/generated/openapi_aclient/models/nested_objective_evaluator.py +105 -0
- root/generated/openapi_aclient/models/nested_objective_evaluator_request.py +92 -0
- root/generated/openapi_aclient/models/nested_objective_list.py +111 -0
- root/generated/openapi_aclient/models/nested_user_details.py +88 -0
- root/generated/openapi_aclient/models/nested_user_details_request.py +82 -0
- root/generated/openapi_aclient/models/nested_vector_objective.py +88 -0
- root/generated/openapi_aclient/models/nested_vector_objective_request.py +82 -0
- root/generated/openapi_aclient/models/objective.py +157 -0
- root/generated/openapi_aclient/models/objective_list.py +128 -0
- root/generated/openapi_aclient/models/objective_request.py +113 -0
- root/generated/openapi_aclient/models/objective_validator.py +100 -0
- root/generated/openapi_aclient/models/objective_validator_request.py +90 -0
- root/generated/openapi_aclient/models/paginated_data_set_list_list.py +111 -0
- root/generated/openapi_aclient/models/paginated_evaluator_list.py +111 -0
- root/generated/openapi_aclient/models/paginated_evaluator_list_output_list.py +111 -0
- root/generated/openapi_aclient/models/paginated_execution_log_list_list.py +111 -0
- root/generated/openapi_aclient/models/paginated_judge_list_list.py +111 -0
- root/generated/openapi_aclient/models/paginated_model_list_list.py +111 -0
- root/generated/openapi_aclient/models/paginated_objective_list.py +111 -0
- root/generated/openapi_aclient/models/paginated_objective_list_list.py +111 -0
- root/generated/openapi_aclient/models/patched_evaluator_request.py +194 -0
- root/generated/openapi_aclient/models/patched_judge_request.py +110 -0
- root/generated/openapi_aclient/models/patched_model_request.py +118 -0
- root/generated/openapi_aclient/models/patched_objective_request.py +113 -0
- root/generated/openapi_aclient/models/provider.py +99 -0
- root/generated/openapi_aclient/models/reference_variable.py +123 -0
- root/generated/openapi_aclient/models/reference_variable_request.py +83 -0
- root/generated/openapi_aclient/models/skill_execution_validator_result.py +130 -0
- root/generated/openapi_aclient/models/skill_test_data_request.py +107 -0
- root/generated/openapi_aclient/models/skill_test_data_request_dataset_range.py +93 -0
- root/generated/openapi_aclient/models/skill_test_input_request.py +171 -0
- root/generated/openapi_aclient/models/skill_type_enum.py +36 -0
- root/generated/openapi_aclient/models/status_change.py +84 -0
- root/generated/openapi_aclient/models/status_change_request.py +84 -0
- root/generated/openapi_aclient/models/status_change_status_enum.py +36 -0
- root/generated/openapi_aclient/models/status_enum.py +38 -0
- root/generated/openapi_aclient/models/validation_result_status.py +36 -0
- root/generated/openapi_aclient/models/visibility_enum.py +38 -0
- root/generated/openapi_aclient/rest.py +166 -0
- root/generated/openapi_aclient_README.md +239 -0
- root/generated/openapi_client/__init__.py +1 -0
- root/generated/openapi_client/api/__init__.py +1 -0
- root/generated/openapi_client/api/datasets_api.py +1274 -0
- root/generated/openapi_client/api/evaluators_api.py +3641 -0
- root/generated/openapi_client/api/execution_logs_api.py +751 -0
- root/generated/openapi_client/api/judges_api.py +3794 -0
- root/generated/openapi_client/api/models_api.py +1473 -0
- root/generated/openapi_client/api/objectives_api.py +1767 -0
- root/generated/openapi_client/api_client.py +659 -0
- root/generated/openapi_client/api_response.py +22 -0
- root/generated/openapi_client/configuration.py +474 -0
- root/generated/openapi_client/exceptions.py +197 -0
- root/generated/openapi_client/models/__init__.py +120 -0
- root/generated/openapi_client/models/data_set_create.py +118 -0
- root/generated/openapi_client/models/data_set_create_request.py +105 -0
- root/generated/openapi_client/models/data_set_list.py +129 -0
- root/generated/openapi_client/models/data_set_type.py +36 -0
- root/generated/openapi_client/models/dataset_range_request.py +93 -0
- root/generated/openapi_client/models/evaluator.py +273 -0
- root/generated/openapi_client/models/evaluator_calibration_output.py +101 -0
- root/generated/openapi_client/models/evaluator_calibration_result.py +134 -0
- root/generated/openapi_client/models/evaluator_demonstrations.py +107 -0
- root/generated/openapi_client/models/evaluator_demonstrations_request.py +107 -0
- root/generated/openapi_client/models/evaluator_execution_function_parameter_property_request.py +86 -0
- root/generated/openapi_client/models/evaluator_execution_function_parameter_request.py +109 -0
- root/generated/openapi_client/models/evaluator_execution_function_parameter_type_enum.py +35 -0
- root/generated/openapi_client/models/evaluator_execution_function_request.py +99 -0
- root/generated/openapi_client/models/evaluator_execution_functions_request.py +98 -0
- root/generated/openapi_client/models/evaluator_execution_functions_type_enum.py +35 -0
- root/generated/openapi_client/models/evaluator_execution_request.py +134 -0
- root/generated/openapi_client/models/evaluator_execution_result.py +114 -0
- root/generated/openapi_client/models/evaluator_inputs_value.py +100 -0
- root/generated/openapi_client/models/evaluator_inputs_value_items.py +89 -0
- root/generated/openapi_client/models/evaluator_list_output.py +198 -0
- root/generated/openapi_client/models/evaluator_reference.py +90 -0
- root/generated/openapi_client/models/evaluator_reference_request.py +90 -0
- root/generated/openapi_client/models/evaluator_request.py +194 -0
- root/generated/openapi_client/models/evaluator_result.py +110 -0
- root/generated/openapi_client/models/execution_log_details.py +291 -0
- root/generated/openapi_client/models/execution_log_details_evaluation_context.py +83 -0
- root/generated/openapi_client/models/execution_log_details_evaluator_latencies_inner.py +83 -0
- root/generated/openapi_client/models/execution_log_list.py +215 -0
- root/generated/openapi_client/models/execution_log_list_evaluation_context.py +83 -0
- root/generated/openapi_client/models/generation_model_params_request.py +93 -0
- root/generated/openapi_client/models/id.py +87 -0
- root/generated/openapi_client/models/input_variable.py +121 -0
- root/generated/openapi_client/models/input_variable_request.py +82 -0
- root/generated/openapi_client/models/judge.py +178 -0
- root/generated/openapi_client/models/judge_execution_request.py +114 -0
- root/generated/openapi_client/models/judge_execution_response.py +97 -0
- root/generated/openapi_client/models/judge_files_inner.py +84 -0
- root/generated/openapi_client/models/judge_generator_request.py +142 -0
- root/generated/openapi_client/models/judge_generator_response.py +88 -0
- root/generated/openapi_client/models/judge_invite_request.py +87 -0
- root/generated/openapi_client/models/judge_list.py +156 -0
- root/generated/openapi_client/models/judge_rectifier_request_request.py +114 -0
- root/generated/openapi_client/models/judge_rectifier_response.py +121 -0
- root/generated/openapi_client/models/judge_request.py +108 -0
- root/generated/openapi_client/models/model.py +126 -0
- root/generated/openapi_client/models/model_list.py +115 -0
- root/generated/openapi_client/models/model_params.py +89 -0
- root/generated/openapi_client/models/model_params_request.py +89 -0
- root/generated/openapi_client/models/model_request.py +118 -0
- root/generated/openapi_client/models/nested_evaluator.py +110 -0
- root/generated/openapi_client/models/nested_evaluator_objective.py +87 -0
- root/generated/openapi_client/models/nested_evaluator_request.py +92 -0
- root/generated/openapi_client/models/nested_objective_evaluator.py +105 -0
- root/generated/openapi_client/models/nested_objective_evaluator_request.py +92 -0
- root/generated/openapi_client/models/nested_objective_list.py +111 -0
- root/generated/openapi_client/models/nested_user_details.py +88 -0
- root/generated/openapi_client/models/nested_user_details_request.py +82 -0
- root/generated/openapi_client/models/nested_vector_objective.py +88 -0
- root/generated/openapi_client/models/nested_vector_objective_request.py +82 -0
- root/generated/openapi_client/models/objective.py +157 -0
- root/generated/openapi_client/models/objective_list.py +128 -0
- root/generated/openapi_client/models/objective_request.py +113 -0
- root/generated/openapi_client/models/objective_validator.py +100 -0
- root/generated/openapi_client/models/objective_validator_request.py +90 -0
- root/generated/openapi_client/models/paginated_data_set_list_list.py +111 -0
- root/generated/openapi_client/models/paginated_evaluator_list.py +111 -0
- root/generated/openapi_client/models/paginated_evaluator_list_output_list.py +111 -0
- root/generated/openapi_client/models/paginated_execution_log_list_list.py +111 -0
- root/generated/openapi_client/models/paginated_judge_list_list.py +111 -0
- root/generated/openapi_client/models/paginated_model_list_list.py +111 -0
- root/generated/openapi_client/models/paginated_objective_list.py +111 -0
- root/generated/openapi_client/models/paginated_objective_list_list.py +111 -0
- root/generated/openapi_client/models/patched_evaluator_request.py +194 -0
- root/generated/openapi_client/models/patched_judge_request.py +110 -0
- root/generated/openapi_client/models/patched_model_request.py +118 -0
- root/generated/openapi_client/models/patched_objective_request.py +113 -0
- root/generated/openapi_client/models/provider.py +99 -0
- root/generated/openapi_client/models/reference_variable.py +123 -0
- root/generated/openapi_client/models/reference_variable_request.py +83 -0
- root/generated/openapi_client/models/skill_execution_validator_result.py +130 -0
- root/generated/openapi_client/models/skill_test_data_request.py +107 -0
- root/generated/openapi_client/models/skill_test_data_request_dataset_range.py +93 -0
- root/generated/openapi_client/models/skill_test_input_request.py +171 -0
- root/generated/openapi_client/models/skill_type_enum.py +36 -0
- root/generated/openapi_client/models/status_change.py +84 -0
- root/generated/openapi_client/models/status_change_request.py +84 -0
- root/generated/openapi_client/models/status_change_status_enum.py +36 -0
- root/generated/openapi_client/models/status_enum.py +38 -0
- root/generated/openapi_client/models/validation_result_status.py +36 -0
- root/generated/openapi_client/models/visibility_enum.py +38 -0
- root/generated/openapi_client/rest.py +203 -0
- root/generated/openapi_client_README.md +238 -0
- root/judges.py +681 -0
- root/models.py +197 -0
- root/objectives.py +343 -0
- root/py.typed +0 -0
- root/skills.py +1707 -0
- root/utils.py +90 -0
- scorable-1.6.4.dist-info/METADATA +395 -0
- scorable-1.6.4.dist-info/RECORD +228 -0
- scorable-1.6.4.dist-info/WHEEL +4 -0
- scorable-1.6.4.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Root Signals API
|
|
5
|
+
|
|
6
|
+
Root Signals JSON API provides a way to access Root Signals using provisioned API token
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0 (latest)
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from root.generated.openapi_client.models.objective_list import ObjectiveList
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PaginatedObjectiveListList(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PaginatedObjectiveListList
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
|
|
32
|
+
next: Optional[StrictStr] = None
|
|
33
|
+
previous: Optional[StrictStr] = None
|
|
34
|
+
results: List[ObjectiveList]
|
|
35
|
+
__properties: ClassVar[List[str]] = ["next", "previous", "results"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
populate_by_name=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of PaginatedObjectiveListList from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.results:
|
|
77
|
+
for _item in self.results:
|
|
78
|
+
if _item:
|
|
79
|
+
_items.append(_item.to_dict())
|
|
80
|
+
_dict["results"] = _items
|
|
81
|
+
# set to None if next (nullable) is None
|
|
82
|
+
# and model_fields_set contains the field
|
|
83
|
+
if self.next is None and "next" in self.model_fields_set:
|
|
84
|
+
_dict["next"] = None
|
|
85
|
+
|
|
86
|
+
# set to None if previous (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.previous is None and "previous" in self.model_fields_set:
|
|
89
|
+
_dict["previous"] = None
|
|
90
|
+
|
|
91
|
+
return _dict
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
95
|
+
"""Create an instance of PaginatedObjectiveListList from a dict"""
|
|
96
|
+
if obj is None:
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
if not isinstance(obj, dict):
|
|
100
|
+
return cls.model_validate(obj)
|
|
101
|
+
|
|
102
|
+
_obj = cls.model_validate(
|
|
103
|
+
{
|
|
104
|
+
"next": obj.get("next"),
|
|
105
|
+
"previous": obj.get("previous"),
|
|
106
|
+
"results": [ObjectiveList.from_dict(_item) for _item in obj["results"]]
|
|
107
|
+
if obj.get("results") is not None
|
|
108
|
+
else None,
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
return _obj
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Root Signals API
|
|
5
|
+
|
|
6
|
+
Root Signals JSON API provides a way to access Root Signals using provisioned API token
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0 (latest)
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
22
|
+
from typing_extensions import Annotated, Self
|
|
23
|
+
|
|
24
|
+
from root.generated.openapi_client.models.evaluator_demonstrations_request import EvaluatorDemonstrationsRequest
|
|
25
|
+
from root.generated.openapi_client.models.input_variable_request import InputVariableRequest
|
|
26
|
+
from root.generated.openapi_client.models.model_params_request import ModelParamsRequest
|
|
27
|
+
from root.generated.openapi_client.models.reference_variable_request import ReferenceVariableRequest
|
|
28
|
+
from root.generated.openapi_client.models.status_enum import StatusEnum
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class PatchedEvaluatorRequest(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
PatchedEvaluatorRequest
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
|
|
36
|
+
change_note: Optional[StrictStr] = None
|
|
37
|
+
evaluator_demonstrations: Optional[List[EvaluatorDemonstrationsRequest]] = None
|
|
38
|
+
input_variables: Optional[List[InputVariableRequest]] = None
|
|
39
|
+
model_params: Optional[ModelParamsRequest] = None
|
|
40
|
+
models: Optional[List[Annotated[str, Field(min_length=1, strict=True)]]] = Field(
|
|
41
|
+
default=None,
|
|
42
|
+
description="Primary model (index 0) and an optional list of fallback models to use if the primary model is not available. If not provided, a default model will be used.",
|
|
43
|
+
)
|
|
44
|
+
name: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=1000)]] = None
|
|
45
|
+
objective_id: Optional[StrictStr] = None
|
|
46
|
+
objective_version_id: Optional[StrictStr] = Field(
|
|
47
|
+
default=None,
|
|
48
|
+
description="Optionally pin the Skill to a specific version of an Objective. If not provided, the latest version of the objective will be used and followed.",
|
|
49
|
+
)
|
|
50
|
+
overwrite: Optional[StrictBool] = Field(
|
|
51
|
+
default=False, description="Overwrite existing skill with the same name. Only for POST requests."
|
|
52
|
+
)
|
|
53
|
+
prompt: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=100000)]] = None
|
|
54
|
+
reference_variables: Optional[List[ReferenceVariableRequest]] = None
|
|
55
|
+
status: Optional[StatusEnum] = None
|
|
56
|
+
system_message: Optional[StrictStr] = None
|
|
57
|
+
__properties: ClassVar[List[str]] = [
|
|
58
|
+
"change_note",
|
|
59
|
+
"evaluator_demonstrations",
|
|
60
|
+
"input_variables",
|
|
61
|
+
"model_params",
|
|
62
|
+
"models",
|
|
63
|
+
"name",
|
|
64
|
+
"objective_id",
|
|
65
|
+
"objective_version_id",
|
|
66
|
+
"overwrite",
|
|
67
|
+
"prompt",
|
|
68
|
+
"reference_variables",
|
|
69
|
+
"status",
|
|
70
|
+
"system_message",
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
model_config = ConfigDict(
|
|
74
|
+
populate_by_name=True,
|
|
75
|
+
validate_assignment=True,
|
|
76
|
+
protected_namespaces=(),
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
def to_str(self) -> str:
|
|
80
|
+
"""Returns the string representation of the model using alias"""
|
|
81
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
82
|
+
|
|
83
|
+
def to_json(self) -> str:
|
|
84
|
+
"""Returns the JSON representation of the model using alias"""
|
|
85
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
86
|
+
return json.dumps(self.to_dict())
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of PatchedEvaluatorRequest from a JSON string"""
|
|
91
|
+
return cls.from_dict(json.loads(json_str))
|
|
92
|
+
|
|
93
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
94
|
+
"""Return the dictionary representation of the model using alias.
|
|
95
|
+
|
|
96
|
+
This has the following differences from calling pydantic's
|
|
97
|
+
`self.model_dump(by_alias=True)`:
|
|
98
|
+
|
|
99
|
+
* `None` is only added to the output dict for nullable fields that
|
|
100
|
+
were set at model initialization. Other fields with value `None`
|
|
101
|
+
are ignored.
|
|
102
|
+
"""
|
|
103
|
+
excluded_fields: Set[str] = set([])
|
|
104
|
+
|
|
105
|
+
_dict = self.model_dump(
|
|
106
|
+
by_alias=True,
|
|
107
|
+
exclude=excluded_fields,
|
|
108
|
+
exclude_none=True,
|
|
109
|
+
)
|
|
110
|
+
# override the default output from pydantic by calling `to_dict()` of each item in evaluator_demonstrations (list)
|
|
111
|
+
_items = []
|
|
112
|
+
if self.evaluator_demonstrations:
|
|
113
|
+
for _item in self.evaluator_demonstrations:
|
|
114
|
+
if _item:
|
|
115
|
+
_items.append(_item.to_dict())
|
|
116
|
+
_dict["evaluator_demonstrations"] = _items
|
|
117
|
+
# override the default output from pydantic by calling `to_dict()` of each item in input_variables (list)
|
|
118
|
+
_items = []
|
|
119
|
+
if self.input_variables:
|
|
120
|
+
for _item in self.input_variables:
|
|
121
|
+
if _item:
|
|
122
|
+
_items.append(_item.to_dict())
|
|
123
|
+
_dict["input_variables"] = _items
|
|
124
|
+
# override the default output from pydantic by calling `to_dict()` of model_params
|
|
125
|
+
if self.model_params:
|
|
126
|
+
_dict["model_params"] = self.model_params.to_dict()
|
|
127
|
+
# override the default output from pydantic by calling `to_dict()` of each item in reference_variables (list)
|
|
128
|
+
_items = []
|
|
129
|
+
if self.reference_variables:
|
|
130
|
+
for _item in self.reference_variables:
|
|
131
|
+
if _item:
|
|
132
|
+
_items.append(_item.to_dict())
|
|
133
|
+
_dict["reference_variables"] = _items
|
|
134
|
+
# set to None if change_note (nullable) is None
|
|
135
|
+
# and model_fields_set contains the field
|
|
136
|
+
if self.change_note is None and "change_note" in self.model_fields_set:
|
|
137
|
+
_dict["change_note"] = None
|
|
138
|
+
|
|
139
|
+
# set to None if evaluator_demonstrations (nullable) is None
|
|
140
|
+
# and model_fields_set contains the field
|
|
141
|
+
if self.evaluator_demonstrations is None and "evaluator_demonstrations" in self.model_fields_set:
|
|
142
|
+
_dict["evaluator_demonstrations"] = None
|
|
143
|
+
|
|
144
|
+
# set to None if model_params (nullable) is None
|
|
145
|
+
# and model_fields_set contains the field
|
|
146
|
+
if self.model_params is None and "model_params" in self.model_fields_set:
|
|
147
|
+
_dict["model_params"] = None
|
|
148
|
+
|
|
149
|
+
# set to None if objective_version_id (nullable) is None
|
|
150
|
+
# and model_fields_set contains the field
|
|
151
|
+
if self.objective_version_id is None and "objective_version_id" in self.model_fields_set:
|
|
152
|
+
_dict["objective_version_id"] = None
|
|
153
|
+
|
|
154
|
+
return _dict
|
|
155
|
+
|
|
156
|
+
@classmethod
|
|
157
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
158
|
+
"""Create an instance of PatchedEvaluatorRequest from a dict"""
|
|
159
|
+
if obj is None:
|
|
160
|
+
return None
|
|
161
|
+
|
|
162
|
+
if not isinstance(obj, dict):
|
|
163
|
+
return cls.model_validate(obj)
|
|
164
|
+
|
|
165
|
+
_obj = cls.model_validate(
|
|
166
|
+
{
|
|
167
|
+
"change_note": obj.get("change_note"),
|
|
168
|
+
"evaluator_demonstrations": [
|
|
169
|
+
EvaluatorDemonstrationsRequest.from_dict(_item) for _item in obj["evaluator_demonstrations"]
|
|
170
|
+
]
|
|
171
|
+
if obj.get("evaluator_demonstrations") is not None
|
|
172
|
+
else None,
|
|
173
|
+
"input_variables": [InputVariableRequest.from_dict(_item) for _item in obj["input_variables"]]
|
|
174
|
+
if obj.get("input_variables") is not None
|
|
175
|
+
else None,
|
|
176
|
+
"model_params": ModelParamsRequest.from_dict(obj["model_params"])
|
|
177
|
+
if obj.get("model_params") is not None
|
|
178
|
+
else None,
|
|
179
|
+
"models": obj.get("models"),
|
|
180
|
+
"name": obj.get("name"),
|
|
181
|
+
"objective_id": obj.get("objective_id"),
|
|
182
|
+
"objective_version_id": obj.get("objective_version_id"),
|
|
183
|
+
"overwrite": obj.get("overwrite") if obj.get("overwrite") is not None else False,
|
|
184
|
+
"prompt": obj.get("prompt"),
|
|
185
|
+
"reference_variables": [
|
|
186
|
+
ReferenceVariableRequest.from_dict(_item) for _item in obj["reference_variables"]
|
|
187
|
+
]
|
|
188
|
+
if obj.get("reference_variables") is not None
|
|
189
|
+
else None,
|
|
190
|
+
"status": obj.get("status"),
|
|
191
|
+
"system_message": obj.get("system_message"),
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
return _obj
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Root Signals API
|
|
5
|
+
|
|
6
|
+
Root Signals JSON API provides a way to access Root Signals using provisioned API token
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0 (latest)
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
+
from typing_extensions import Annotated, Self
|
|
23
|
+
|
|
24
|
+
from root.generated.openapi_client.models.evaluator_reference_request import EvaluatorReferenceRequest
|
|
25
|
+
from root.generated.openapi_client.models.status_enum import StatusEnum
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class PatchedJudgeRequest(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
PatchedJudgeRequest
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
evaluator_references: Optional[List[EvaluatorReferenceRequest]] = None
|
|
34
|
+
intent: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(
|
|
35
|
+
default=None, description="Intent for the judge"
|
|
36
|
+
)
|
|
37
|
+
name: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=512)]] = None
|
|
38
|
+
stage: Optional[Annotated[str, Field(strict=True, max_length=255)]] = None
|
|
39
|
+
status: Optional[StatusEnum] = None
|
|
40
|
+
__properties: ClassVar[List[str]] = ["evaluator_references", "intent", "name", "stage", "status"]
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
populate_by_name=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of PatchedJudgeRequest from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of each item in evaluator_references (list)
|
|
80
|
+
_items = []
|
|
81
|
+
if self.evaluator_references:
|
|
82
|
+
for _item in self.evaluator_references:
|
|
83
|
+
if _item:
|
|
84
|
+
_items.append(_item.to_dict())
|
|
85
|
+
_dict["evaluator_references"] = _items
|
|
86
|
+
return _dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of PatchedJudgeRequest from a dict"""
|
|
91
|
+
if obj is None:
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
if not isinstance(obj, dict):
|
|
95
|
+
return cls.model_validate(obj)
|
|
96
|
+
|
|
97
|
+
_obj = cls.model_validate(
|
|
98
|
+
{
|
|
99
|
+
"evaluator_references": [
|
|
100
|
+
EvaluatorReferenceRequest.from_dict(_item) for _item in obj["evaluator_references"]
|
|
101
|
+
]
|
|
102
|
+
if obj.get("evaluator_references") is not None
|
|
103
|
+
else None,
|
|
104
|
+
"intent": obj.get("intent"),
|
|
105
|
+
"name": obj.get("name"),
|
|
106
|
+
"stage": obj.get("stage"),
|
|
107
|
+
"status": obj.get("status"),
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
return _obj
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Root Signals API
|
|
5
|
+
|
|
6
|
+
Root Signals JSON API provides a way to access Root Signals using provisioned API token
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0 (latest)
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
+
from typing_extensions import Annotated, Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class PatchedModelRequest(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
PatchedModelRequest
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
default_key: Optional[Annotated[str, Field(strict=True, max_length=4000)]] = None
|
|
31
|
+
max_output_token_count: Optional[Annotated[int, Field(strict=True, ge=800)]] = None
|
|
32
|
+
max_token_count: Optional[Annotated[int, Field(le=2147483647, strict=True, ge=0)]] = None
|
|
33
|
+
model: Optional[Annotated[str, Field(min_length=1, strict=True)]] = None
|
|
34
|
+
name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=100)]] = None
|
|
35
|
+
url: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = None
|
|
36
|
+
__properties: ClassVar[List[str]] = [
|
|
37
|
+
"default_key",
|
|
38
|
+
"max_output_token_count",
|
|
39
|
+
"max_token_count",
|
|
40
|
+
"model",
|
|
41
|
+
"name",
|
|
42
|
+
"url",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
model_config = ConfigDict(
|
|
46
|
+
populate_by_name=True,
|
|
47
|
+
validate_assignment=True,
|
|
48
|
+
protected_namespaces=(),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
def to_str(self) -> str:
|
|
52
|
+
"""Returns the string representation of the model using alias"""
|
|
53
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
54
|
+
|
|
55
|
+
def to_json(self) -> str:
|
|
56
|
+
"""Returns the JSON representation of the model using alias"""
|
|
57
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
58
|
+
return json.dumps(self.to_dict())
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
|
+
"""Create an instance of PatchedModelRequest from a JSON string"""
|
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
|
64
|
+
|
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
|
67
|
+
|
|
68
|
+
This has the following differences from calling pydantic's
|
|
69
|
+
`self.model_dump(by_alias=True)`:
|
|
70
|
+
|
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
|
72
|
+
were set at model initialization. Other fields with value `None`
|
|
73
|
+
are ignored.
|
|
74
|
+
"""
|
|
75
|
+
excluded_fields: Set[str] = set([])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
# set to None if default_key (nullable) is None
|
|
83
|
+
# and model_fields_set contains the field
|
|
84
|
+
if self.default_key is None and "default_key" in self.model_fields_set:
|
|
85
|
+
_dict["default_key"] = None
|
|
86
|
+
|
|
87
|
+
# set to None if max_token_count (nullable) is None
|
|
88
|
+
# and model_fields_set contains the field
|
|
89
|
+
if self.max_token_count is None and "max_token_count" in self.model_fields_set:
|
|
90
|
+
_dict["max_token_count"] = None
|
|
91
|
+
|
|
92
|
+
# set to None if url (nullable) is None
|
|
93
|
+
# and model_fields_set contains the field
|
|
94
|
+
if self.url is None and "url" in self.model_fields_set:
|
|
95
|
+
_dict["url"] = None
|
|
96
|
+
|
|
97
|
+
return _dict
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
101
|
+
"""Create an instance of PatchedModelRequest from a dict"""
|
|
102
|
+
if obj is None:
|
|
103
|
+
return None
|
|
104
|
+
|
|
105
|
+
if not isinstance(obj, dict):
|
|
106
|
+
return cls.model_validate(obj)
|
|
107
|
+
|
|
108
|
+
_obj = cls.model_validate(
|
|
109
|
+
{
|
|
110
|
+
"default_key": obj.get("default_key"),
|
|
111
|
+
"max_output_token_count": obj.get("max_output_token_count"),
|
|
112
|
+
"max_token_count": obj.get("max_token_count"),
|
|
113
|
+
"model": obj.get("model"),
|
|
114
|
+
"name": obj.get("name"),
|
|
115
|
+
"url": obj.get("url"),
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
return _obj
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Root Signals API
|
|
5
|
+
|
|
6
|
+
Root Signals JSON API provides a way to access Root Signals using provisioned API token
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0 (latest)
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
22
|
+
from typing_extensions import Annotated, Self
|
|
23
|
+
|
|
24
|
+
from root.generated.openapi_client.models.objective_validator_request import ObjectiveValidatorRequest
|
|
25
|
+
from root.generated.openapi_client.models.status_enum import StatusEnum
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class PatchedObjectiveRequest(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
PatchedObjectiveRequest
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
intent: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=100000)]] = None
|
|
34
|
+
status: Optional[StatusEnum] = None
|
|
35
|
+
validators: Optional[List[ObjectiveValidatorRequest]] = None
|
|
36
|
+
force_create: Optional[StrictBool] = Field(
|
|
37
|
+
default=None, description="Force creation of a new objective. Applies only to PUT requests."
|
|
38
|
+
)
|
|
39
|
+
test_dataset_id: Optional[StrictStr] = None
|
|
40
|
+
__properties: ClassVar[List[str]] = ["intent", "status", "validators", "force_create", "test_dataset_id"]
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
populate_by_name=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of PatchedObjectiveRequest from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of each item in validators (list)
|
|
80
|
+
_items = []
|
|
81
|
+
if self.validators:
|
|
82
|
+
for _item in self.validators:
|
|
83
|
+
if _item:
|
|
84
|
+
_items.append(_item.to_dict())
|
|
85
|
+
_dict["validators"] = _items
|
|
86
|
+
# set to None if test_dataset_id (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.test_dataset_id is None and "test_dataset_id" in self.model_fields_set:
|
|
89
|
+
_dict["test_dataset_id"] = None
|
|
90
|
+
|
|
91
|
+
return _dict
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
95
|
+
"""Create an instance of PatchedObjectiveRequest from a dict"""
|
|
96
|
+
if obj is None:
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
if not isinstance(obj, dict):
|
|
100
|
+
return cls.model_validate(obj)
|
|
101
|
+
|
|
102
|
+
_obj = cls.model_validate(
|
|
103
|
+
{
|
|
104
|
+
"intent": obj.get("intent"),
|
|
105
|
+
"status": obj.get("status"),
|
|
106
|
+
"validators": [ObjectiveValidatorRequest.from_dict(_item) for _item in obj["validators"]]
|
|
107
|
+
if obj.get("validators") is not None
|
|
108
|
+
else None,
|
|
109
|
+
"force_create": obj.get("force_create"),
|
|
110
|
+
"test_dataset_id": obj.get("test_dataset_id"),
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
return _obj
|