rapidata 2.13.1__py3-none-any.whl → 2.14.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/api_client/__init__.py +18 -4
- rapidata/api_client/api/__init__.py +1 -0
- rapidata/api_client/api/dataset_api.py +265 -0
- rapidata/api_client/api/rapid_api.py +262 -0
- rapidata/api_client/api/workflow_api.py +298 -1
- rapidata/api_client/models/__init__.py +17 -4
- rapidata/api_client/models/add_campaign_model.py +3 -3
- rapidata/api_client/models/add_validation_rapid_model.py +3 -3
- rapidata/api_client/models/add_validation_text_rapid_model.py +3 -3
- rapidata/api_client/models/classification_metadata.py +2 -4
- rapidata/api_client/models/compare_workflow_config.py +17 -2
- rapidata/api_client/models/compare_workflow_config_metadata_value.py +238 -0
- rapidata/api_client/models/compare_workflow_config_model.py +17 -2
- rapidata/api_client/models/compare_workflow_model.py +17 -2
- rapidata/api_client/models/count_metadata.py +1 -3
- rapidata/api_client/models/create_datapoint_from_urls_model.py +26 -4
- rapidata/api_client/models/create_datapoint_from_urls_model_metadata_inner.py +168 -0
- rapidata/api_client/models/create_datapoint_result.py +5 -3
- rapidata/api_client/models/datapoint.py +7 -30
- rapidata/api_client/models/datapoint_asset.py +40 -40
- rapidata/api_client/models/datapoint_metadata_model.py +3 -3
- rapidata/api_client/models/datapoint_model.py +3 -3
- rapidata/api_client/models/early_stopping_referee_model.py +1 -1
- rapidata/api_client/models/get_compare_workflow_results_result.py +3 -3
- rapidata/api_client/models/get_datapoint_by_id_result.py +3 -3
- rapidata/api_client/models/get_failed_datapoints_result.py +95 -0
- rapidata/api_client/models/get_rapid_responses_result.py +112 -0
- rapidata/api_client/models/get_responses_result.py +95 -0
- rapidata/api_client/models/get_simple_workflow_results_result.py +10 -4
- rapidata/api_client/models/image_dimension_metadata.py +1 -3
- rapidata/api_client/models/location_metadata.py +2 -4
- rapidata/api_client/models/metadata_visibilities.py +1 -0
- rapidata/api_client/models/multi_asset_model.py +3 -3
- rapidata/api_client/models/original_filename_metadata.py +2 -4
- rapidata/api_client/models/prompt_metadata.py +1 -3
- rapidata/api_client/models/scrub_result.py +4 -4
- rapidata/api_client/models/source_url_metadata.py +98 -0
- rapidata/api_client/models/text_metadata.py +3 -5
- rapidata/api_client/models/transcription_metadata.py +1 -3
- rapidata/api_client/models/upload_text_sources_to_dataset_model.py +17 -2
- rapidata/api_client_README.md +21 -4
- rapidata/rapidata_client/assets/_media_asset.py +5 -1
- rapidata/rapidata_client/assets/_multi_asset.py +6 -1
- rapidata/rapidata_client/filter/country_filter.py +1 -1
- rapidata/rapidata_client/filter/rapidata_filters.py +10 -2
- rapidata/rapidata_client/order/_rapidata_dataset.py +311 -108
- rapidata/rapidata_client/order/_rapidata_order_builder.py +5 -5
- rapidata/rapidata_client/order/rapidata_order.py +2 -2
- rapidata/rapidata_client/order/rapidata_order_manager.py +55 -6
- rapidata/rapidata_client/order/rapidata_results.py +2 -1
- rapidata/rapidata_client/rapidata_client.py +4 -0
- rapidata/rapidata_client/selection/rapidata_selections.py +10 -9
- rapidata/rapidata_client/settings/no_shuffle.py +2 -2
- rapidata/rapidata_client/settings/rapidata_settings.py +8 -0
- rapidata/rapidata_client/validation/rapids/rapids.py +4 -5
- rapidata/rapidata_client/workflow/__init__.py +1 -0
- rapidata/rapidata_client/workflow/_ranking_workflow.py +51 -0
- rapidata/service/credential_manager.py +7 -0
- rapidata/service/openapi_service.py +6 -6
- {rapidata-2.13.1.dist-info → rapidata-2.14.1.dist-info}/METADATA +1 -1
- {rapidata-2.13.1.dist-info → rapidata-2.14.1.dist-info}/RECORD +63 -56
- {rapidata-2.13.1.dist-info → rapidata-2.14.1.dist-info}/LICENSE +0 -0
- {rapidata-2.13.1.dist-info → rapidata-2.14.1.dist-info}/WHEEL +0 -0
|
@@ -17,8 +17,9 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
-
from typing import Any, ClassVar, Dict, List
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.create_datapoint_from_urls_model_metadata_inner import CreateDatapointFromUrlsModelMetadataInner
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -27,7 +28,9 @@ class CreateDatapointFromUrlsModel(BaseModel):
|
|
|
27
28
|
The model for creating a datapoint from urls.
|
|
28
29
|
""" # noqa: E501
|
|
29
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.")
|
|
30
|
-
|
|
31
|
+
metadata: Optional[List[CreateDatapointFromUrlsModelMetadataInner]] = 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
|
+
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
|
+
__properties: ClassVar[List[str]] = ["urls", "metadata", "sortIndex"]
|
|
31
34
|
|
|
32
35
|
model_config = ConfigDict(
|
|
33
36
|
populate_by_name=True,
|
|
@@ -68,6 +71,23 @@ class CreateDatapointFromUrlsModel(BaseModel):
|
|
|
68
71
|
exclude=excluded_fields,
|
|
69
72
|
exclude_none=True,
|
|
70
73
|
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in metadata (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.metadata:
|
|
77
|
+
for _item_metadata in self.metadata:
|
|
78
|
+
if _item_metadata:
|
|
79
|
+
_items.append(_item_metadata.to_dict())
|
|
80
|
+
_dict['metadata'] = _items
|
|
81
|
+
# set to None if metadata (nullable) is None
|
|
82
|
+
# and model_fields_set contains the field
|
|
83
|
+
if self.metadata is None and "metadata" in self.model_fields_set:
|
|
84
|
+
_dict['metadata'] = None
|
|
85
|
+
|
|
86
|
+
# set to None if sort_index (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.sort_index is None and "sort_index" in self.model_fields_set:
|
|
89
|
+
_dict['sortIndex'] = None
|
|
90
|
+
|
|
71
91
|
return _dict
|
|
72
92
|
|
|
73
93
|
@classmethod
|
|
@@ -80,7 +100,9 @@ class CreateDatapointFromUrlsModel(BaseModel):
|
|
|
80
100
|
return cls.model_validate(obj)
|
|
81
101
|
|
|
82
102
|
_obj = cls.model_validate({
|
|
83
|
-
"urls": obj.get("urls")
|
|
103
|
+
"urls": obj.get("urls"),
|
|
104
|
+
"metadata": [CreateDatapointFromUrlsModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
105
|
+
"sortIndex": obj.get("sortIndex")
|
|
84
106
|
})
|
|
85
107
|
return _obj
|
|
86
108
|
|
|
@@ -0,0 +1,168 @@
|
|
|
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.private_text_metadata_input import PrivateTextMetadataInput
|
|
21
|
+
from rapidata.api_client.models.prompt_metadata_input import PromptMetadataInput
|
|
22
|
+
from rapidata.api_client.models.public_text_metadata_input import PublicTextMetadataInput
|
|
23
|
+
from rapidata.api_client.models.transcription_metadata_input import TranscriptionMetadataInput
|
|
24
|
+
from pydantic import StrictStr, Field
|
|
25
|
+
from typing import Union, List, Set, Optional, Dict
|
|
26
|
+
from typing_extensions import Literal, Self
|
|
27
|
+
|
|
28
|
+
CREATEDATAPOINTFROMURLSMODELMETADATAINNER_ONE_OF_SCHEMAS = ["PrivateTextMetadataInput", "PromptMetadataInput", "PublicTextMetadataInput", "TranscriptionMetadataInput"]
|
|
29
|
+
|
|
30
|
+
class CreateDatapointFromUrlsModelMetadataInner(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
CreateDatapointFromUrlsModelMetadataInner
|
|
33
|
+
"""
|
|
34
|
+
# data type: PrivateTextMetadataInput
|
|
35
|
+
oneof_schema_1_validator: Optional[PrivateTextMetadataInput] = None
|
|
36
|
+
# data type: PromptMetadataInput
|
|
37
|
+
oneof_schema_2_validator: Optional[PromptMetadataInput] = None
|
|
38
|
+
# data type: PublicTextMetadataInput
|
|
39
|
+
oneof_schema_3_validator: Optional[PublicTextMetadataInput] = None
|
|
40
|
+
# data type: TranscriptionMetadataInput
|
|
41
|
+
oneof_schema_4_validator: Optional[TranscriptionMetadataInput] = None
|
|
42
|
+
actual_instance: Optional[Union[PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput]] = None
|
|
43
|
+
one_of_schemas: Set[str] = { "PrivateTextMetadataInput", "PromptMetadataInput", "PublicTextMetadataInput", "TranscriptionMetadataInput" }
|
|
44
|
+
|
|
45
|
+
model_config = ConfigDict(
|
|
46
|
+
validate_assignment=True,
|
|
47
|
+
protected_namespaces=(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
55
|
+
if args:
|
|
56
|
+
if len(args) > 1:
|
|
57
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
58
|
+
if kwargs:
|
|
59
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
60
|
+
super().__init__(actual_instance=args[0])
|
|
61
|
+
else:
|
|
62
|
+
super().__init__(**kwargs)
|
|
63
|
+
|
|
64
|
+
@field_validator('actual_instance')
|
|
65
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
66
|
+
instance = CreateDatapointFromUrlsModelMetadataInner.model_construct()
|
|
67
|
+
error_messages = []
|
|
68
|
+
match = 0
|
|
69
|
+
# validate data type: PrivateTextMetadataInput
|
|
70
|
+
if not isinstance(v, PrivateTextMetadataInput):
|
|
71
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PrivateTextMetadataInput`")
|
|
72
|
+
else:
|
|
73
|
+
match += 1
|
|
74
|
+
# validate data type: PromptMetadataInput
|
|
75
|
+
if not isinstance(v, PromptMetadataInput):
|
|
76
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PromptMetadataInput`")
|
|
77
|
+
else:
|
|
78
|
+
match += 1
|
|
79
|
+
# validate data type: PublicTextMetadataInput
|
|
80
|
+
if not isinstance(v, PublicTextMetadataInput):
|
|
81
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PublicTextMetadataInput`")
|
|
82
|
+
else:
|
|
83
|
+
match += 1
|
|
84
|
+
# validate data type: TranscriptionMetadataInput
|
|
85
|
+
if not isinstance(v, TranscriptionMetadataInput):
|
|
86
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionMetadataInput`")
|
|
87
|
+
else:
|
|
88
|
+
match += 1
|
|
89
|
+
if match > 1:
|
|
90
|
+
# more than 1 match
|
|
91
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CreateDatapointFromUrlsModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
92
|
+
elif match == 0:
|
|
93
|
+
# no match
|
|
94
|
+
raise ValueError("No match found when setting `actual_instance` in CreateDatapointFromUrlsModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
95
|
+
else:
|
|
96
|
+
return v
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
100
|
+
return cls.from_json(json.dumps(obj))
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_json(cls, json_str: str) -> Self:
|
|
104
|
+
"""Returns the object represented by the json string"""
|
|
105
|
+
instance = cls.model_construct()
|
|
106
|
+
error_messages = []
|
|
107
|
+
match = 0
|
|
108
|
+
|
|
109
|
+
# deserialize data into PrivateTextMetadataInput
|
|
110
|
+
try:
|
|
111
|
+
instance.actual_instance = PrivateTextMetadataInput.from_json(json_str)
|
|
112
|
+
match += 1
|
|
113
|
+
except (ValidationError, ValueError) as e:
|
|
114
|
+
error_messages.append(str(e))
|
|
115
|
+
# deserialize data into PromptMetadataInput
|
|
116
|
+
try:
|
|
117
|
+
instance.actual_instance = PromptMetadataInput.from_json(json_str)
|
|
118
|
+
match += 1
|
|
119
|
+
except (ValidationError, ValueError) as e:
|
|
120
|
+
error_messages.append(str(e))
|
|
121
|
+
# deserialize data into PublicTextMetadataInput
|
|
122
|
+
try:
|
|
123
|
+
instance.actual_instance = PublicTextMetadataInput.from_json(json_str)
|
|
124
|
+
match += 1
|
|
125
|
+
except (ValidationError, ValueError) as e:
|
|
126
|
+
error_messages.append(str(e))
|
|
127
|
+
# deserialize data into TranscriptionMetadataInput
|
|
128
|
+
try:
|
|
129
|
+
instance.actual_instance = TranscriptionMetadataInput.from_json(json_str)
|
|
130
|
+
match += 1
|
|
131
|
+
except (ValidationError, ValueError) as e:
|
|
132
|
+
error_messages.append(str(e))
|
|
133
|
+
|
|
134
|
+
if match > 1:
|
|
135
|
+
# more than 1 match
|
|
136
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CreateDatapointFromUrlsModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
137
|
+
elif match == 0:
|
|
138
|
+
# no match
|
|
139
|
+
raise ValueError("No match found when deserializing the JSON string into CreateDatapointFromUrlsModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
140
|
+
else:
|
|
141
|
+
return instance
|
|
142
|
+
|
|
143
|
+
def to_json(self) -> str:
|
|
144
|
+
"""Returns the JSON representation of the actual instance"""
|
|
145
|
+
if self.actual_instance is None:
|
|
146
|
+
return "null"
|
|
147
|
+
|
|
148
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
149
|
+
return self.actual_instance.to_json()
|
|
150
|
+
else:
|
|
151
|
+
return json.dumps(self.actual_instance)
|
|
152
|
+
|
|
153
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput]]:
|
|
154
|
+
"""Returns the dict representation of the actual instance"""
|
|
155
|
+
if self.actual_instance is None:
|
|
156
|
+
return None
|
|
157
|
+
|
|
158
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
159
|
+
return self.actual_instance.to_dict()
|
|
160
|
+
else:
|
|
161
|
+
# primitive type
|
|
162
|
+
return self.actual_instance
|
|
163
|
+
|
|
164
|
+
def to_str(self) -> str:
|
|
165
|
+
"""Returns the string representation of the actual instance"""
|
|
166
|
+
return pprint.pformat(self.model_dump())
|
|
167
|
+
|
|
168
|
+
|
|
@@ -17,7 +17,7 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from rapidata.api_client.models.base_error import BaseError
|
|
23
23
|
from typing import Optional, Set
|
|
@@ -29,7 +29,8 @@ class CreateDatapointResult(BaseModel):
|
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
datapoint_id: StrictStr = Field(alias="datapointId")
|
|
31
31
|
errors: Optional[List[BaseError]] = None
|
|
32
|
-
|
|
32
|
+
created_count: Optional[StrictInt] = Field(default=None, alias="createdCount")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["datapointId", "errors", "createdCount"]
|
|
33
34
|
|
|
34
35
|
model_config = ConfigDict(
|
|
35
36
|
populate_by_name=True,
|
|
@@ -90,7 +91,8 @@ class CreateDatapointResult(BaseModel):
|
|
|
90
91
|
|
|
91
92
|
_obj = cls.model_validate({
|
|
92
93
|
"datapointId": obj.get("datapointId"),
|
|
93
|
-
"errors": [BaseError.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None
|
|
94
|
+
"errors": [BaseError.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None,
|
|
95
|
+
"createdCount": obj.get("createdCount")
|
|
94
96
|
})
|
|
95
97
|
return _obj
|
|
96
98
|
|
|
@@ -18,7 +18,7 @@ import re # noqa: F401
|
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
20
|
from datetime import datetime
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from rapidata.api_client.models.datapoint_asset import DatapointAsset
|
|
24
24
|
from typing import Optional, Set
|
|
@@ -28,22 +28,12 @@ class Datapoint(BaseModel):
|
|
|
28
28
|
"""
|
|
29
29
|
Datapoint
|
|
30
30
|
""" # noqa: E501
|
|
31
|
-
|
|
31
|
+
id: StrictStr
|
|
32
|
+
dataset_id: StrictStr = Field(alias="datasetId")
|
|
32
33
|
sort_index: Optional[StrictInt] = Field(default=None, alias="sortIndex")
|
|
33
34
|
asset: DatapointAsset
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
deletion_date: Optional[datetime] = Field(default=None, alias="deletionDate")
|
|
37
|
-
deleter_id: Optional[StrictStr] = Field(default=None, alias="deleterId")
|
|
38
|
-
created_at: Optional[datetime] = Field(default=None, alias="createdAt")
|
|
39
|
-
__properties: ClassVar[List[str]] = ["_t", "sortIndex", "asset", "datasetId", "id", "deletionDate", "deleterId", "createdAt"]
|
|
40
|
-
|
|
41
|
-
@field_validator('t')
|
|
42
|
-
def t_validate_enum(cls, value):
|
|
43
|
-
"""Validates the enum"""
|
|
44
|
-
if value not in set(['Datapoint']):
|
|
45
|
-
raise ValueError("must be one of enum values ('Datapoint')")
|
|
46
|
-
return value
|
|
35
|
+
created_at: datetime = Field(alias="createdAt")
|
|
36
|
+
__properties: ClassVar[List[str]] = ["id", "datasetId", "sortIndex", "asset", "createdAt"]
|
|
47
37
|
|
|
48
38
|
model_config = ConfigDict(
|
|
49
39
|
populate_by_name=True,
|
|
@@ -92,16 +82,6 @@ class Datapoint(BaseModel):
|
|
|
92
82
|
if self.sort_index is None and "sort_index" in self.model_fields_set:
|
|
93
83
|
_dict['sortIndex'] = None
|
|
94
84
|
|
|
95
|
-
# set to None if deletion_date (nullable) is None
|
|
96
|
-
# and model_fields_set contains the field
|
|
97
|
-
if self.deletion_date is None and "deletion_date" in self.model_fields_set:
|
|
98
|
-
_dict['deletionDate'] = None
|
|
99
|
-
|
|
100
|
-
# set to None if deleter_id (nullable) is None
|
|
101
|
-
# and model_fields_set contains the field
|
|
102
|
-
if self.deleter_id is None and "deleter_id" in self.model_fields_set:
|
|
103
|
-
_dict['deleterId'] = None
|
|
104
|
-
|
|
105
85
|
return _dict
|
|
106
86
|
|
|
107
87
|
@classmethod
|
|
@@ -114,13 +94,10 @@ class Datapoint(BaseModel):
|
|
|
114
94
|
return cls.model_validate(obj)
|
|
115
95
|
|
|
116
96
|
_obj = cls.model_validate({
|
|
117
|
-
"
|
|
97
|
+
"id": obj.get("id"),
|
|
98
|
+
"datasetId": obj.get("datasetId"),
|
|
118
99
|
"sortIndex": obj.get("sortIndex"),
|
|
119
100
|
"asset": DatapointAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
120
|
-
"datasetId": obj.get("datasetId"),
|
|
121
|
-
"id": obj.get("id"),
|
|
122
|
-
"deletionDate": obj.get("deletionDate"),
|
|
123
|
-
"deleterId": obj.get("deleterId"),
|
|
124
101
|
"createdAt": obj.get("createdAt")
|
|
125
102
|
})
|
|
126
103
|
return _obj
|
|
@@ -17,29 +17,29 @@ import json
|
|
|
17
17
|
import pprint
|
|
18
18
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
19
|
from typing import Any, List, Optional
|
|
20
|
-
from rapidata.api_client.models.
|
|
21
|
-
from rapidata.api_client.models.
|
|
22
|
-
from rapidata.api_client.models.
|
|
20
|
+
from rapidata.api_client.models.file_asset_model import FileAssetModel
|
|
21
|
+
from rapidata.api_client.models.null_asset_model import NullAssetModel
|
|
22
|
+
from rapidata.api_client.models.text_asset_model import TextAssetModel
|
|
23
23
|
from pydantic import StrictStr, Field
|
|
24
24
|
from typing import Union, List, Set, Optional, Dict
|
|
25
25
|
from typing_extensions import Literal, Self
|
|
26
26
|
|
|
27
|
-
DATAPOINTASSET_ONE_OF_SCHEMAS = ["
|
|
27
|
+
DATAPOINTASSET_ONE_OF_SCHEMAS = ["FileAssetModel", "MultiAssetModel", "NullAssetModel", "TextAssetModel"]
|
|
28
28
|
|
|
29
29
|
class DatapointAsset(BaseModel):
|
|
30
30
|
"""
|
|
31
31
|
DatapointAsset
|
|
32
32
|
"""
|
|
33
|
-
# data type:
|
|
34
|
-
oneof_schema_1_validator: Optional[
|
|
35
|
-
# data type:
|
|
36
|
-
oneof_schema_2_validator: Optional[
|
|
37
|
-
# data type:
|
|
38
|
-
oneof_schema_3_validator: Optional[
|
|
39
|
-
# data type:
|
|
40
|
-
oneof_schema_4_validator: Optional[
|
|
41
|
-
actual_instance: Optional[Union[
|
|
42
|
-
one_of_schemas: Set[str] = { "
|
|
33
|
+
# data type: FileAssetModel
|
|
34
|
+
oneof_schema_1_validator: Optional[FileAssetModel] = None
|
|
35
|
+
# data type: MultiAssetModel
|
|
36
|
+
oneof_schema_2_validator: Optional[MultiAssetModel] = None
|
|
37
|
+
# data type: NullAssetModel
|
|
38
|
+
oneof_schema_3_validator: Optional[NullAssetModel] = None
|
|
39
|
+
# data type: TextAssetModel
|
|
40
|
+
oneof_schema_4_validator: Optional[TextAssetModel] = None
|
|
41
|
+
actual_instance: Optional[Union[FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel]] = None
|
|
42
|
+
one_of_schemas: Set[str] = { "FileAssetModel", "MultiAssetModel", "NullAssetModel", "TextAssetModel" }
|
|
43
43
|
|
|
44
44
|
model_config = ConfigDict(
|
|
45
45
|
validate_assignment=True,
|
|
@@ -65,32 +65,32 @@ class DatapointAsset(BaseModel):
|
|
|
65
65
|
instance = DatapointAsset.model_construct()
|
|
66
66
|
error_messages = []
|
|
67
67
|
match = 0
|
|
68
|
-
# validate data type:
|
|
69
|
-
if not isinstance(v,
|
|
70
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `
|
|
68
|
+
# validate data type: FileAssetModel
|
|
69
|
+
if not isinstance(v, FileAssetModel):
|
|
70
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FileAssetModel`")
|
|
71
71
|
else:
|
|
72
72
|
match += 1
|
|
73
|
-
# validate data type:
|
|
74
|
-
if not isinstance(v,
|
|
75
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `
|
|
73
|
+
# validate data type: MultiAssetModel
|
|
74
|
+
if not isinstance(v, MultiAssetModel):
|
|
75
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAssetModel`")
|
|
76
76
|
else:
|
|
77
77
|
match += 1
|
|
78
|
-
# validate data type:
|
|
79
|
-
if not isinstance(v,
|
|
80
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `
|
|
78
|
+
# validate data type: NullAssetModel
|
|
79
|
+
if not isinstance(v, NullAssetModel):
|
|
80
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NullAssetModel`")
|
|
81
81
|
else:
|
|
82
82
|
match += 1
|
|
83
|
-
# validate data type:
|
|
84
|
-
if not isinstance(v,
|
|
85
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `
|
|
83
|
+
# validate data type: TextAssetModel
|
|
84
|
+
if not isinstance(v, TextAssetModel):
|
|
85
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextAssetModel`")
|
|
86
86
|
else:
|
|
87
87
|
match += 1
|
|
88
88
|
if match > 1:
|
|
89
89
|
# more than 1 match
|
|
90
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in DatapointAsset with oneOf schemas:
|
|
90
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in DatapointAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
|
|
91
91
|
elif match == 0:
|
|
92
92
|
# no match
|
|
93
|
-
raise ValueError("No match found when setting `actual_instance` in DatapointAsset with oneOf schemas:
|
|
93
|
+
raise ValueError("No match found when setting `actual_instance` in DatapointAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
|
|
94
94
|
else:
|
|
95
95
|
return v
|
|
96
96
|
|
|
@@ -105,37 +105,37 @@ class DatapointAsset(BaseModel):
|
|
|
105
105
|
error_messages = []
|
|
106
106
|
match = 0
|
|
107
107
|
|
|
108
|
-
# deserialize data into
|
|
108
|
+
# deserialize data into FileAssetModel
|
|
109
109
|
try:
|
|
110
|
-
instance.actual_instance =
|
|
110
|
+
instance.actual_instance = FileAssetModel.from_json(json_str)
|
|
111
111
|
match += 1
|
|
112
112
|
except (ValidationError, ValueError) as e:
|
|
113
113
|
error_messages.append(str(e))
|
|
114
|
-
# deserialize data into
|
|
114
|
+
# deserialize data into MultiAssetModel
|
|
115
115
|
try:
|
|
116
|
-
instance.actual_instance =
|
|
116
|
+
instance.actual_instance = MultiAssetModel.from_json(json_str)
|
|
117
117
|
match += 1
|
|
118
118
|
except (ValidationError, ValueError) as e:
|
|
119
119
|
error_messages.append(str(e))
|
|
120
|
-
# deserialize data into
|
|
120
|
+
# deserialize data into NullAssetModel
|
|
121
121
|
try:
|
|
122
|
-
instance.actual_instance =
|
|
122
|
+
instance.actual_instance = NullAssetModel.from_json(json_str)
|
|
123
123
|
match += 1
|
|
124
124
|
except (ValidationError, ValueError) as e:
|
|
125
125
|
error_messages.append(str(e))
|
|
126
|
-
# deserialize data into
|
|
126
|
+
# deserialize data into TextAssetModel
|
|
127
127
|
try:
|
|
128
|
-
instance.actual_instance =
|
|
128
|
+
instance.actual_instance = TextAssetModel.from_json(json_str)
|
|
129
129
|
match += 1
|
|
130
130
|
except (ValidationError, ValueError) as e:
|
|
131
131
|
error_messages.append(str(e))
|
|
132
132
|
|
|
133
133
|
if match > 1:
|
|
134
134
|
# more than 1 match
|
|
135
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into DatapointAsset with oneOf schemas:
|
|
135
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into DatapointAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
|
|
136
136
|
elif match == 0:
|
|
137
137
|
# no match
|
|
138
|
-
raise ValueError("No match found when deserializing the JSON string into DatapointAsset with oneOf schemas:
|
|
138
|
+
raise ValueError("No match found when deserializing the JSON string into DatapointAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
|
|
139
139
|
else:
|
|
140
140
|
return instance
|
|
141
141
|
|
|
@@ -149,7 +149,7 @@ class DatapointAsset(BaseModel):
|
|
|
149
149
|
else:
|
|
150
150
|
return json.dumps(self.actual_instance)
|
|
151
151
|
|
|
152
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any],
|
|
152
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel]]:
|
|
153
153
|
"""Returns the dict representation of the actual instance"""
|
|
154
154
|
if self.actual_instance is None:
|
|
155
155
|
return None
|
|
@@ -164,7 +164,7 @@ class DatapointAsset(BaseModel):
|
|
|
164
164
|
"""Returns the string representation of the actual instance"""
|
|
165
165
|
return pprint.pformat(self.model_dump())
|
|
166
166
|
|
|
167
|
-
from rapidata.api_client.models.
|
|
167
|
+
from rapidata.api_client.models.multi_asset_model import MultiAssetModel
|
|
168
168
|
# TODO: Rewrite to not use raise_errors
|
|
169
169
|
DatapointAsset.model_rebuild(raise_errors=False)
|
|
170
170
|
|
|
@@ -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_urls_model_metadata_inner import CreateDatapointFromUrlsModelMetadataInner
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ class DatapointMetadataModel(BaseModel):
|
|
|
28
28
|
The model for creating a datapoint.
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
dataset_id: StrictStr = Field(description="The id of the dataset to create the datapoint in.", alias="datasetId")
|
|
31
|
-
metadata: List[
|
|
31
|
+
metadata: List[CreateDatapointFromUrlsModelMetadataInner] = Field(description="The metadata of the datapoint.")
|
|
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]] = ["datasetId", "metadata", "sortIndex"]
|
|
34
34
|
|
|
@@ -96,7 +96,7 @@ class DatapointMetadataModel(BaseModel):
|
|
|
96
96
|
|
|
97
97
|
_obj = cls.model_validate({
|
|
98
98
|
"datasetId": obj.get("datasetId"),
|
|
99
|
-
"metadata": [
|
|
99
|
+
"metadata": [CreateDatapointFromUrlsModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
100
100
|
"sortIndex": obj.get("sortIndex")
|
|
101
101
|
})
|
|
102
102
|
return _obj
|
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.datapoint_asset import DatapointAsset
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ class DatapointModel(BaseModel):
|
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
id: StrictStr
|
|
31
31
|
dataset_id: StrictStr = Field(alias="datasetId")
|
|
32
|
-
asset:
|
|
32
|
+
asset: DatapointAsset
|
|
33
33
|
__properties: ClassVar[List[str]] = ["id", "datasetId", "asset"]
|
|
34
34
|
|
|
35
35
|
model_config = ConfigDict(
|
|
@@ -88,7 +88,7 @@ class DatapointModel(BaseModel):
|
|
|
88
88
|
_obj = cls.model_validate({
|
|
89
89
|
"id": obj.get("id"),
|
|
90
90
|
"datasetId": obj.get("datasetId"),
|
|
91
|
-
"asset":
|
|
91
|
+
"asset": DatapointAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None
|
|
92
92
|
})
|
|
93
93
|
return _obj
|
|
94
94
|
|
|
@@ -24,7 +24,7 @@ from typing_extensions import Self
|
|
|
24
24
|
|
|
25
25
|
class EarlyStoppingRefereeModel(BaseModel):
|
|
26
26
|
"""
|
|
27
|
-
The Early Stopping Referee can currently only be used for classification tasks and will stop once a certain
|
|
27
|
+
The Early Stopping Referee can currently only be used for classification tasks and will stop once a certain threshold is reached or the maximum number of votes is collected.
|
|
28
28
|
""" # noqa: E501
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for EarlyStoppingReferee", alias="_t")
|
|
30
30
|
max_votes: StrictInt = Field(description="The upper limit of votes that will be collected for each task.", alias="maxVotes")
|
|
@@ -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
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.datapoint_asset import DatapointAsset
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ class GetCompareWorkflowResultsResult(BaseModel):
|
|
|
28
28
|
GetCompareWorkflowResultsResult
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
workflow_datapoint_id: StrictStr = Field(alias="workflowDatapointId")
|
|
31
|
-
asset:
|
|
31
|
+
asset: DatapointAsset
|
|
32
32
|
elo: StrictInt
|
|
33
33
|
__properties: ClassVar[List[str]] = ["workflowDatapointId", "asset", "elo"]
|
|
34
34
|
|
|
@@ -87,7 +87,7 @@ class GetCompareWorkflowResultsResult(BaseModel):
|
|
|
87
87
|
|
|
88
88
|
_obj = cls.model_validate({
|
|
89
89
|
"workflowDatapointId": obj.get("workflowDatapointId"),
|
|
90
|
-
"asset":
|
|
90
|
+
"asset": DatapointAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
91
91
|
"elo": obj.get("elo")
|
|
92
92
|
})
|
|
93
93
|
return _obj
|
|
@@ -20,7 +20,7 @@ import json
|
|
|
20
20
|
from datetime import datetime
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from rapidata.api_client.models.
|
|
23
|
+
from rapidata.api_client.models.datapoint_asset import DatapointAsset
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
26
26
|
|
|
@@ -32,7 +32,7 @@ class GetDatapointByIdResult(BaseModel):
|
|
|
32
32
|
dataset_id: StrictStr = Field(alias="datasetId")
|
|
33
33
|
state: StrictStr
|
|
34
34
|
sort_index: Optional[StrictInt] = Field(default=None, alias="sortIndex")
|
|
35
|
-
asset:
|
|
35
|
+
asset: DatapointAsset
|
|
36
36
|
created_at: datetime = Field(alias="createdAt")
|
|
37
37
|
__properties: ClassVar[List[str]] = ["id", "datasetId", "state", "sortIndex", "asset", "createdAt"]
|
|
38
38
|
|
|
@@ -106,7 +106,7 @@ class GetDatapointByIdResult(BaseModel):
|
|
|
106
106
|
"datasetId": obj.get("datasetId"),
|
|
107
107
|
"state": obj.get("state"),
|
|
108
108
|
"sortIndex": obj.get("sortIndex"),
|
|
109
|
-
"asset":
|
|
109
|
+
"asset": DatapointAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
110
110
|
"createdAt": obj.get("createdAt")
|
|
111
111
|
})
|
|
112
112
|
return _obj
|