rapidata 2.41.3__py3-none-any.whl → 2.42.1__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 rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +1 -5
- rapidata/api_client/__init__.py +14 -14
- rapidata/api_client/api/__init__.py +1 -0
- rapidata/api_client/api/asset_api.py +851 -0
- rapidata/api_client/api/benchmark_api.py +298 -0
- rapidata/api_client/api/customer_rapid_api.py +29 -43
- rapidata/api_client/api/dataset_api.py +163 -1143
- rapidata/api_client/api/participant_api.py +28 -74
- rapidata/api_client/api/validation_set_api.py +283 -0
- rapidata/api_client/models/__init__.py +13 -14
- rapidata/api_client/models/add_validation_rapid_model.py +3 -3
- rapidata/api_client/models/add_validation_rapid_new_model.py +152 -0
- rapidata/api_client/models/add_validation_rapid_new_model_asset.py +182 -0
- rapidata/api_client/models/compare_workflow_model.py +3 -3
- rapidata/api_client/models/create_datapoint_from_files_model.py +3 -3
- rapidata/api_client/models/create_datapoint_from_text_sources_model.py +3 -3
- rapidata/api_client/models/create_datapoint_from_urls_model.py +3 -3
- rapidata/api_client/models/create_datapoint_model.py +108 -0
- rapidata/api_client/models/create_datapoint_model_asset.py +182 -0
- rapidata/api_client/models/create_demographic_rapid_model.py +13 -2
- rapidata/api_client/models/create_demographic_rapid_model_asset.py +188 -0
- rapidata/api_client/models/create_demographic_rapid_model_new.py +119 -0
- rapidata/api_client/models/create_sample_model.py +8 -2
- rapidata/api_client/models/create_sample_model_asset.py +182 -0
- rapidata/api_client/models/create_sample_model_obsolete.py +87 -0
- rapidata/api_client/models/file_asset_input_file.py +8 -22
- rapidata/api_client/models/fork_benchmark_result.py +87 -0
- rapidata/api_client/models/form_file_wrapper.py +17 -2
- rapidata/api_client/models/get_asset_metadata_result.py +100 -0
- rapidata/api_client/models/multi_asset_input_assets_inner.py +10 -24
- rapidata/api_client/models/prompt_asset_metadata_input.py +3 -3
- rapidata/api_client/models/proxy_file_wrapper.py +17 -2
- rapidata/api_client/models/stream_file_wrapper.py +25 -3
- rapidata/api_client/models/submit_prompt_model.py +3 -3
- rapidata/api_client/models/text_metadata.py +6 -1
- rapidata/api_client/models/text_metadata_model.py +7 -2
- rapidata/api_client/models/upload_file_from_url_result.py +87 -0
- rapidata/api_client/models/upload_file_result.py +87 -0
- rapidata/api_client/models/zip_entry_file_wrapper.py +33 -2
- rapidata/api_client_README.md +28 -25
- rapidata/rapidata_client/__init__.py +0 -1
- rapidata/rapidata_client/benchmark/participant/_participant.py +25 -24
- rapidata/rapidata_client/benchmark/rapidata_benchmark.py +89 -102
- rapidata/rapidata_client/datapoints/__init__.py +0 -1
- rapidata/rapidata_client/datapoints/_asset_uploader.py +71 -0
- rapidata/rapidata_client/datapoints/_datapoint.py +58 -171
- rapidata/rapidata_client/datapoints/_datapoint_uploader.py +95 -0
- rapidata/rapidata_client/datapoints/assets/__init__.py +0 -11
- rapidata/rapidata_client/datapoints/metadata/_media_asset_metadata.py +10 -7
- rapidata/rapidata_client/demographic/demographic_manager.py +21 -8
- rapidata/rapidata_client/exceptions/failed_upload_exception.py +0 -62
- rapidata/rapidata_client/order/_rapidata_order_builder.py +0 -10
- rapidata/rapidata_client/order/dataset/_rapidata_dataset.py +65 -187
- rapidata/rapidata_client/order/rapidata_order_manager.py +62 -124
- rapidata/rapidata_client/validation/rapidata_validation_set.py +9 -5
- rapidata/rapidata_client/validation/rapids/_validation_rapid_uploader.py +101 -0
- rapidata/rapidata_client/validation/rapids/box.py +35 -11
- rapidata/rapidata_client/validation/rapids/rapids.py +26 -128
- rapidata/rapidata_client/validation/rapids/rapids_manager.py +123 -104
- rapidata/rapidata_client/validation/validation_set_manager.py +41 -38
- rapidata/rapidata_client/workflow/_ranking_workflow.py +14 -17
- rapidata/rapidata_client/workflow/_select_words_workflow.py +3 -16
- rapidata/service/openapi_service.py +8 -3
- {rapidata-2.41.3.dist-info → rapidata-2.42.1.dist-info}/METADATA +1 -1
- {rapidata-2.41.3.dist-info → rapidata-2.42.1.dist-info}/RECORD +67 -58
- {rapidata-2.41.3.dist-info → rapidata-2.42.1.dist-info}/WHEEL +1 -1
- rapidata/rapidata_client/datapoints/assets/_base_asset.py +0 -13
- rapidata/rapidata_client/datapoints/assets/_media_asset.py +0 -318
- rapidata/rapidata_client/datapoints/assets/_multi_asset.py +0 -61
- rapidata/rapidata_client/datapoints/assets/_sessions.py +0 -40
- rapidata/rapidata_client/datapoints/assets/_text_asset.py +0 -34
- rapidata/rapidata_client/datapoints/assets/data_type_enum.py +0 -8
- rapidata/rapidata_client/order/dataset/_progress_tracker.py +0 -100
- {rapidata-2.41.3.dist-info → rapidata-2.42.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from rapidata.api_client.models.add_validation_rapid_model_payload import AddValidationRapidModelPayload
|
|
23
|
+
from rapidata.api_client.models.add_validation_rapid_model_truth import AddValidationRapidModelTruth
|
|
24
|
+
from rapidata.api_client.models.add_validation_rapid_new_model_asset import AddValidationRapidNewModelAsset
|
|
25
|
+
from rapidata.api_client.models.create_datapoint_from_files_model_metadata_inner import CreateDatapointFromFilesModelMetadataInner
|
|
26
|
+
from rapidata.api_client.models.feature_flag_model import FeatureFlagModel
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
29
|
+
|
|
30
|
+
class AddValidationRapidNewModel(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
The model for adding a validation rapid with asset in JSON body.
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
asset: AddValidationRapidNewModelAsset
|
|
35
|
+
payload: AddValidationRapidModelPayload
|
|
36
|
+
metadata: Optional[List[CreateDatapointFromFilesModelMetadataInner]] = Field(default=None, description="Some metadata to attach to the rapid.")
|
|
37
|
+
truth: Optional[AddValidationRapidModelTruth] = None
|
|
38
|
+
random_correct_probability: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The probability for an answer to be correct when randomly guessing.", alias="randomCorrectProbability")
|
|
39
|
+
explanation: Optional[StrictStr] = Field(default=None, description="An explanation for the users if they answer the rapid incorrectly.")
|
|
40
|
+
feature_flags: Optional[List[FeatureFlagModel]] = Field(default=None, description="The feature flags to enable for the rapid.", alias="featureFlags")
|
|
41
|
+
__properties: ClassVar[List[str]] = ["asset", "payload", "metadata", "truth", "randomCorrectProbability", "explanation", "featureFlags"]
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of AddValidationRapidNewModel from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of asset
|
|
83
|
+
if self.asset:
|
|
84
|
+
_dict['asset'] = self.asset.to_dict()
|
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of payload
|
|
86
|
+
if self.payload:
|
|
87
|
+
_dict['payload'] = self.payload.to_dict()
|
|
88
|
+
# override the default output from pydantic by calling `to_dict()` of each item in metadata (list)
|
|
89
|
+
_items = []
|
|
90
|
+
if self.metadata:
|
|
91
|
+
for _item_metadata in self.metadata:
|
|
92
|
+
if _item_metadata:
|
|
93
|
+
_items.append(_item_metadata.to_dict())
|
|
94
|
+
_dict['metadata'] = _items
|
|
95
|
+
# override the default output from pydantic by calling `to_dict()` of truth
|
|
96
|
+
if self.truth:
|
|
97
|
+
_dict['truth'] = self.truth.to_dict()
|
|
98
|
+
# override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
|
|
99
|
+
_items = []
|
|
100
|
+
if self.feature_flags:
|
|
101
|
+
for _item_feature_flags in self.feature_flags:
|
|
102
|
+
if _item_feature_flags:
|
|
103
|
+
_items.append(_item_feature_flags.to_dict())
|
|
104
|
+
_dict['featureFlags'] = _items
|
|
105
|
+
# set to None if metadata (nullable) is None
|
|
106
|
+
# and model_fields_set contains the field
|
|
107
|
+
if self.metadata is None and "metadata" in self.model_fields_set:
|
|
108
|
+
_dict['metadata'] = None
|
|
109
|
+
|
|
110
|
+
# set to None if truth (nullable) is None
|
|
111
|
+
# and model_fields_set contains the field
|
|
112
|
+
if self.truth is None and "truth" in self.model_fields_set:
|
|
113
|
+
_dict['truth'] = None
|
|
114
|
+
|
|
115
|
+
# set to None if random_correct_probability (nullable) is None
|
|
116
|
+
# and model_fields_set contains the field
|
|
117
|
+
if self.random_correct_probability is None and "random_correct_probability" in self.model_fields_set:
|
|
118
|
+
_dict['randomCorrectProbability'] = None
|
|
119
|
+
|
|
120
|
+
# set to None if explanation (nullable) is None
|
|
121
|
+
# and model_fields_set contains the field
|
|
122
|
+
if self.explanation is None and "explanation" in self.model_fields_set:
|
|
123
|
+
_dict['explanation'] = None
|
|
124
|
+
|
|
125
|
+
# set to None if feature_flags (nullable) is None
|
|
126
|
+
# and model_fields_set contains the field
|
|
127
|
+
if self.feature_flags is None and "feature_flags" in self.model_fields_set:
|
|
128
|
+
_dict['featureFlags'] = None
|
|
129
|
+
|
|
130
|
+
return _dict
|
|
131
|
+
|
|
132
|
+
@classmethod
|
|
133
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
134
|
+
"""Create an instance of AddValidationRapidNewModel from a dict"""
|
|
135
|
+
if obj is None:
|
|
136
|
+
return None
|
|
137
|
+
|
|
138
|
+
if not isinstance(obj, dict):
|
|
139
|
+
return cls.model_validate(obj)
|
|
140
|
+
|
|
141
|
+
_obj = cls.model_validate({
|
|
142
|
+
"asset": AddValidationRapidNewModelAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
143
|
+
"payload": AddValidationRapidModelPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
|
|
144
|
+
"metadata": [CreateDatapointFromFilesModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
145
|
+
"truth": AddValidationRapidModelTruth.from_dict(obj["truth"]) if obj.get("truth") is not None else None,
|
|
146
|
+
"randomCorrectProbability": obj.get("randomCorrectProbability"),
|
|
147
|
+
"explanation": obj.get("explanation"),
|
|
148
|
+
"featureFlags": [FeatureFlagModel.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None
|
|
149
|
+
})
|
|
150
|
+
return _obj
|
|
151
|
+
|
|
152
|
+
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from rapidata.api_client.models.existing_asset_input import ExistingAssetInput
|
|
21
|
+
from rapidata.api_client.models.file_asset_input import FileAssetInput
|
|
22
|
+
from rapidata.api_client.models.multi_asset_input import MultiAssetInput
|
|
23
|
+
from rapidata.api_client.models.text_asset_input import TextAssetInput
|
|
24
|
+
from rapidata.api_client.models.url_asset_input import UrlAssetInput
|
|
25
|
+
from pydantic import StrictStr, Field
|
|
26
|
+
from typing import Union, List, Set, Optional, Dict
|
|
27
|
+
from typing_extensions import Literal, Self
|
|
28
|
+
|
|
29
|
+
ADDVALIDATIONRAPIDNEWMODELASSET_ONE_OF_SCHEMAS = ["ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput"]
|
|
30
|
+
|
|
31
|
+
class AddValidationRapidNewModelAsset(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
The asset to use for the rapid.
|
|
34
|
+
"""
|
|
35
|
+
# data type: ExistingAssetInput
|
|
36
|
+
oneof_schema_1_validator: Optional[ExistingAssetInput] = None
|
|
37
|
+
# data type: FileAssetInput
|
|
38
|
+
oneof_schema_2_validator: Optional[FileAssetInput] = None
|
|
39
|
+
# data type: MultiAssetInput
|
|
40
|
+
oneof_schema_3_validator: Optional[MultiAssetInput] = None
|
|
41
|
+
# data type: TextAssetInput
|
|
42
|
+
oneof_schema_4_validator: Optional[TextAssetInput] = None
|
|
43
|
+
# data type: UrlAssetInput
|
|
44
|
+
oneof_schema_5_validator: Optional[UrlAssetInput] = None
|
|
45
|
+
actual_instance: Optional[Union[ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]] = None
|
|
46
|
+
one_of_schemas: Set[str] = { "ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput" }
|
|
47
|
+
|
|
48
|
+
model_config = ConfigDict(
|
|
49
|
+
validate_assignment=True,
|
|
50
|
+
protected_namespaces=(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
58
|
+
if args:
|
|
59
|
+
if len(args) > 1:
|
|
60
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
61
|
+
if kwargs:
|
|
62
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
63
|
+
super().__init__(actual_instance=args[0])
|
|
64
|
+
else:
|
|
65
|
+
super().__init__(**kwargs)
|
|
66
|
+
|
|
67
|
+
@field_validator('actual_instance')
|
|
68
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
69
|
+
instance = AddValidationRapidNewModelAsset.model_construct()
|
|
70
|
+
error_messages = []
|
|
71
|
+
match = 0
|
|
72
|
+
# validate data type: ExistingAssetInput
|
|
73
|
+
if not isinstance(v, ExistingAssetInput):
|
|
74
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ExistingAssetInput`")
|
|
75
|
+
else:
|
|
76
|
+
match += 1
|
|
77
|
+
# validate data type: FileAssetInput
|
|
78
|
+
if not isinstance(v, FileAssetInput):
|
|
79
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FileAssetInput`")
|
|
80
|
+
else:
|
|
81
|
+
match += 1
|
|
82
|
+
# validate data type: MultiAssetInput
|
|
83
|
+
if not isinstance(v, MultiAssetInput):
|
|
84
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAssetInput`")
|
|
85
|
+
else:
|
|
86
|
+
match += 1
|
|
87
|
+
# validate data type: TextAssetInput
|
|
88
|
+
if not isinstance(v, TextAssetInput):
|
|
89
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextAssetInput`")
|
|
90
|
+
else:
|
|
91
|
+
match += 1
|
|
92
|
+
# validate data type: UrlAssetInput
|
|
93
|
+
if not isinstance(v, UrlAssetInput):
|
|
94
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `UrlAssetInput`")
|
|
95
|
+
else:
|
|
96
|
+
match += 1
|
|
97
|
+
if match > 1:
|
|
98
|
+
# more than 1 match
|
|
99
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in AddValidationRapidNewModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
100
|
+
elif match == 0:
|
|
101
|
+
# no match
|
|
102
|
+
raise ValueError("No match found when setting `actual_instance` in AddValidationRapidNewModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
103
|
+
else:
|
|
104
|
+
return v
|
|
105
|
+
|
|
106
|
+
@classmethod
|
|
107
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
108
|
+
return cls.from_json(json.dumps(obj))
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def from_json(cls, json_str: str) -> Self:
|
|
112
|
+
"""Returns the object represented by the json string"""
|
|
113
|
+
instance = cls.model_construct()
|
|
114
|
+
error_messages = []
|
|
115
|
+
match = 0
|
|
116
|
+
|
|
117
|
+
# deserialize data into ExistingAssetInput
|
|
118
|
+
try:
|
|
119
|
+
instance.actual_instance = ExistingAssetInput.from_json(json_str)
|
|
120
|
+
match += 1
|
|
121
|
+
except (ValidationError, ValueError) as e:
|
|
122
|
+
error_messages.append(str(e))
|
|
123
|
+
# deserialize data into FileAssetInput
|
|
124
|
+
try:
|
|
125
|
+
instance.actual_instance = FileAssetInput.from_json(json_str)
|
|
126
|
+
match += 1
|
|
127
|
+
except (ValidationError, ValueError) as e:
|
|
128
|
+
error_messages.append(str(e))
|
|
129
|
+
# deserialize data into MultiAssetInput
|
|
130
|
+
try:
|
|
131
|
+
instance.actual_instance = MultiAssetInput.from_json(json_str)
|
|
132
|
+
match += 1
|
|
133
|
+
except (ValidationError, ValueError) as e:
|
|
134
|
+
error_messages.append(str(e))
|
|
135
|
+
# deserialize data into TextAssetInput
|
|
136
|
+
try:
|
|
137
|
+
instance.actual_instance = TextAssetInput.from_json(json_str)
|
|
138
|
+
match += 1
|
|
139
|
+
except (ValidationError, ValueError) as e:
|
|
140
|
+
error_messages.append(str(e))
|
|
141
|
+
# deserialize data into UrlAssetInput
|
|
142
|
+
try:
|
|
143
|
+
instance.actual_instance = UrlAssetInput.from_json(json_str)
|
|
144
|
+
match += 1
|
|
145
|
+
except (ValidationError, ValueError) as e:
|
|
146
|
+
error_messages.append(str(e))
|
|
147
|
+
|
|
148
|
+
if match > 1:
|
|
149
|
+
# more than 1 match
|
|
150
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into AddValidationRapidNewModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
151
|
+
elif match == 0:
|
|
152
|
+
# no match
|
|
153
|
+
raise ValueError("No match found when deserializing the JSON string into AddValidationRapidNewModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
154
|
+
else:
|
|
155
|
+
return instance
|
|
156
|
+
|
|
157
|
+
def to_json(self) -> str:
|
|
158
|
+
"""Returns the JSON representation of the actual instance"""
|
|
159
|
+
if self.actual_instance is None:
|
|
160
|
+
return "null"
|
|
161
|
+
|
|
162
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
163
|
+
return self.actual_instance.to_json()
|
|
164
|
+
else:
|
|
165
|
+
return json.dumps(self.actual_instance)
|
|
166
|
+
|
|
167
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]]:
|
|
168
|
+
"""Returns the dict representation of the actual instance"""
|
|
169
|
+
if self.actual_instance is None:
|
|
170
|
+
return None
|
|
171
|
+
|
|
172
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
173
|
+
return self.actual_instance.to_dict()
|
|
174
|
+
else:
|
|
175
|
+
# primitive type
|
|
176
|
+
return self.actual_instance
|
|
177
|
+
|
|
178
|
+
def to_str(self) -> str:
|
|
179
|
+
"""Returns the string representation of the actual instance"""
|
|
180
|
+
return pprint.pformat(self.model_dump())
|
|
181
|
+
|
|
182
|
+
|
|
@@ -20,7 +20,7 @@ import json
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from rapidata.api_client.models.compare_workflow_model_pair_maker_config import CompareWorkflowModelPairMakerConfig
|
|
23
|
-
from rapidata.api_client.models.
|
|
23
|
+
from rapidata.api_client.models.create_datapoint_from_files_model_metadata_inner import CreateDatapointFromFilesModelMetadataInner
|
|
24
24
|
from rapidata.api_client.models.elo_config_model import EloConfigModel
|
|
25
25
|
from rapidata.api_client.models.feature_flag import FeatureFlag
|
|
26
26
|
from typing import Optional, Set
|
|
@@ -34,7 +34,7 @@ class CompareWorkflowModel(BaseModel):
|
|
|
34
34
|
criteria: StrictStr
|
|
35
35
|
pair_maker_config: Optional[CompareWorkflowModelPairMakerConfig] = Field(default=None, alias="pairMakerConfig")
|
|
36
36
|
elo_config: Optional[EloConfigModel] = Field(default=None, alias="eloConfig")
|
|
37
|
-
metadata: Optional[List[
|
|
37
|
+
metadata: Optional[List[CreateDatapointFromFilesModelMetadataInner]] = None
|
|
38
38
|
feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
|
|
39
39
|
__properties: ClassVar[List[str]] = ["_t", "criteria", "pairMakerConfig", "eloConfig", "metadata", "featureFlags"]
|
|
40
40
|
|
|
@@ -125,7 +125,7 @@ class CompareWorkflowModel(BaseModel):
|
|
|
125
125
|
"criteria": obj.get("criteria"),
|
|
126
126
|
"pairMakerConfig": CompareWorkflowModelPairMakerConfig.from_dict(obj["pairMakerConfig"]) if obj.get("pairMakerConfig") is not None else None,
|
|
127
127
|
"eloConfig": EloConfigModel.from_dict(obj["eloConfig"]) if obj.get("eloConfig") is not None else None,
|
|
128
|
-
"metadata": [
|
|
128
|
+
"metadata": [CreateDatapointFromFilesModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
129
129
|
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None
|
|
130
130
|
})
|
|
131
131
|
return _obj
|
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.create_datapoint_from_files_model_metadata_inner import CreateDatapointFromFilesModelMetadataInner
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -27,7 +27,7 @@ class CreateDatapointFromFilesModel(BaseModel):
|
|
|
27
27
|
"""
|
|
28
28
|
The form request for creating a datapoint from files. Needs to be encoded as a json string in the form request.
|
|
29
29
|
""" # noqa: E501
|
|
30
|
-
metadata: List[
|
|
30
|
+
metadata: List[CreateDatapointFromFilesModelMetadataInner] = Field(description="The metadata of the datapoint.")
|
|
31
31
|
sort_index: Optional[StrictInt] = Field(default=None, description="The index will be used to keep the datapoints in order. Useful if upload is parallelized", alias="sortIndex")
|
|
32
32
|
__properties: ClassVar[List[str]] = ["metadata", "sortIndex"]
|
|
33
33
|
|
|
@@ -94,7 +94,7 @@ class CreateDatapointFromFilesModel(BaseModel):
|
|
|
94
94
|
return cls.model_validate(obj)
|
|
95
95
|
|
|
96
96
|
_obj = cls.model_validate({
|
|
97
|
-
"metadata": [
|
|
97
|
+
"metadata": [CreateDatapointFromFilesModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
98
98
|
"sortIndex": obj.get("sortIndex")
|
|
99
99
|
})
|
|
100
100
|
return _obj
|
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.create_datapoint_from_files_model_metadata_inner import CreateDatapointFromFilesModelMetadataInner
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ class CreateDatapointFromTextSourcesModel(BaseModel):
|
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
text_sources: List[StrictStr] = Field(description="The text sources to upload.", alias="textSources")
|
|
31
31
|
sort_index: Optional[StrictInt] = Field(default=None, description="The index will be used to keep the datapoints in order. Useful if upload is parallelized", alias="sortIndex")
|
|
32
|
-
metadata: Optional[List[
|
|
32
|
+
metadata: Optional[List[CreateDatapointFromFilesModelMetadataInner]] = Field(default=None, description="Additional metadata to attach to the datapoint. Most commonly used to add a prompt to the datapoint using the Rapidata.Shared.Assets.Abstraction.Models.Metadata.Input.PromptMetadataInput.")
|
|
33
33
|
__properties: ClassVar[List[str]] = ["textSources", "sortIndex", "metadata"]
|
|
34
34
|
|
|
35
35
|
model_config = ConfigDict(
|
|
@@ -102,7 +102,7 @@ class CreateDatapointFromTextSourcesModel(BaseModel):
|
|
|
102
102
|
_obj = cls.model_validate({
|
|
103
103
|
"textSources": obj.get("textSources"),
|
|
104
104
|
"sortIndex": obj.get("sortIndex"),
|
|
105
|
-
"metadata": [
|
|
105
|
+
"metadata": [CreateDatapointFromFilesModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None
|
|
106
106
|
})
|
|
107
107
|
return _obj
|
|
108
108
|
|
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.create_datapoint_from_files_model_metadata_inner import CreateDatapointFromFilesModelMetadataInner
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ class CreateDatapointFromUrlsModel(BaseModel):
|
|
|
28
28
|
The body request for creating a datapoint from urls.
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
urls: List[StrictStr] = Field(description="The urls to fetch the assets from. The urls must be publicly accessible. A HEAD request will be made to each url to check if it is accessible.")
|
|
31
|
-
metadata: Optional[List[
|
|
31
|
+
metadata: Optional[List[CreateDatapointFromFilesModelMetadataInner]] = Field(default=None, description="Additional metadata to attach to the datapoint. Most commonly used to add a prompt to the datapoint using the Rapidata.Shared.Assets.Abstraction.Models.Metadata.Input.PromptMetadataInput.")
|
|
32
32
|
sort_index: Optional[StrictInt] = Field(default=None, description="The index will be used to keep the datapoints in order. Useful if upload is parallelized", alias="sortIndex")
|
|
33
33
|
__properties: ClassVar[List[str]] = ["urls", "metadata", "sortIndex"]
|
|
34
34
|
|
|
@@ -101,7 +101,7 @@ class CreateDatapointFromUrlsModel(BaseModel):
|
|
|
101
101
|
|
|
102
102
|
_obj = cls.model_validate({
|
|
103
103
|
"urls": obj.get("urls"),
|
|
104
|
-
"metadata": [
|
|
104
|
+
"metadata": [CreateDatapointFromFilesModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
105
105
|
"sortIndex": obj.get("sortIndex")
|
|
106
106
|
})
|
|
107
107
|
return _obj
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.create_datapoint_from_files_model_metadata_inner import CreateDatapointFromFilesModelMetadataInner
|
|
23
|
+
from rapidata.api_client.models.create_datapoint_model_asset import CreateDatapointModelAsset
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class CreateDatapointModel(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
The body request for creating a new datapoint
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
asset: CreateDatapointModelAsset
|
|
32
|
+
metadata: List[CreateDatapointFromFilesModelMetadataInner] = Field(description="The metadata of the datapoint")
|
|
33
|
+
sort_index: Optional[StrictInt] = Field(default=None, description="The sort index represents the order of the datapoint in the dataset", alias="sortIndex")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["asset", "metadata", "sortIndex"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
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 CreateDatapointModel 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
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of asset
|
|
76
|
+
if self.asset:
|
|
77
|
+
_dict['asset'] = self.asset.to_dict()
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of each item in metadata (list)
|
|
79
|
+
_items = []
|
|
80
|
+
if self.metadata:
|
|
81
|
+
for _item_metadata in self.metadata:
|
|
82
|
+
if _item_metadata:
|
|
83
|
+
_items.append(_item_metadata.to_dict())
|
|
84
|
+
_dict['metadata'] = _items
|
|
85
|
+
# set to None if sort_index (nullable) is None
|
|
86
|
+
# and model_fields_set contains the field
|
|
87
|
+
if self.sort_index is None and "sort_index" in self.model_fields_set:
|
|
88
|
+
_dict['sortIndex'] = None
|
|
89
|
+
|
|
90
|
+
return _dict
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
94
|
+
"""Create an instance of CreateDatapointModel from a dict"""
|
|
95
|
+
if obj is None:
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
if not isinstance(obj, dict):
|
|
99
|
+
return cls.model_validate(obj)
|
|
100
|
+
|
|
101
|
+
_obj = cls.model_validate({
|
|
102
|
+
"asset": CreateDatapointModelAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
103
|
+
"metadata": [CreateDatapointFromFilesModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
104
|
+
"sortIndex": obj.get("sortIndex")
|
|
105
|
+
})
|
|
106
|
+
return _obj
|
|
107
|
+
|
|
108
|
+
|