rapidata 2.13.1__py3-none-any.whl → 2.14.0__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 +6 -4
- rapidata/api_client/api/__init__.py +1 -0
- rapidata/api_client/api/dataset_api.py +265 -0
- rapidata/api_client/api/workflow_api.py +298 -1
- rapidata/api_client/models/__init__.py +5 -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/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/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_responses_result.py +95 -0
- rapidata/api_client/models/get_simple_workflow_results_result.py +3 -3
- rapidata/api_client/models/multi_asset_model.py +3 -3
- rapidata/api_client/models/upload_text_sources_to_dataset_model.py +17 -2
- rapidata/api_client_README.md +8 -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/order/_rapidata_dataset.py +311 -108
- rapidata/rapidata_client/order/rapidata_order_manager.py +64 -6
- rapidata/rapidata_client/validation/rapids/rapids.py +4 -5
- rapidata/rapidata_client/workflow/__init__.py +1 -0
- rapidata/rapidata_client/workflow/_ranking_workflow.py +40 -0
- {rapidata-2.13.1.dist-info → rapidata-2.14.0.dist-info}/METADATA +1 -1
- {rapidata-2.13.1.dist-info → rapidata-2.14.0.dist-info}/RECORD +35 -31
- {rapidata-2.13.1.dist-info → rapidata-2.14.0.dist-info}/LICENSE +0 -0
- {rapidata-2.13.1.dist-info → rapidata-2.14.0.dist-info}/WHEEL +0 -0
|
@@ -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
|
|
|
@@ -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
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.datapoint import Datapoint
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class GetFailedDatapointsResult(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
GetFailedDatapointsResult
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
datapoints: List[Datapoint]
|
|
31
|
+
__properties: ClassVar[List[str]] = ["datapoints"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of GetFailedDatapointsResult from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
# override the default output from pydantic by calling `to_dict()` of each item in datapoints (list)
|
|
73
|
+
_items = []
|
|
74
|
+
if self.datapoints:
|
|
75
|
+
for _item_datapoints in self.datapoints:
|
|
76
|
+
if _item_datapoints:
|
|
77
|
+
_items.append(_item_datapoints.to_dict())
|
|
78
|
+
_dict['datapoints'] = _items
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of GetFailedDatapointsResult from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"datapoints": [Datapoint.from_dict(_item) for _item in obj["datapoints"]] if obj.get("datapoints") is not None else None
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.rapid_response import RapidResponse
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class GetResponsesResult(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
GetResponsesResult
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
responses: List[RapidResponse]
|
|
31
|
+
__properties: ClassVar[List[str]] = ["responses"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of GetResponsesResult from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
# override the default output from pydantic by calling `to_dict()` of each item in responses (list)
|
|
73
|
+
_items = []
|
|
74
|
+
if self.responses:
|
|
75
|
+
for _item_responses in self.responses:
|
|
76
|
+
if _item_responses:
|
|
77
|
+
_items.append(_item_responses.to_dict())
|
|
78
|
+
_dict['responses'] = _items
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of GetResponsesResult from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"responses": [RapidResponse.from_dict(_item) for _item in obj["responses"]] if obj.get("responses") is not None else None
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
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 rapidata.api_client.models.rapid_response import RapidResponse
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
@@ -29,7 +29,7 @@ class GetSimpleWorkflowResultsResult(BaseModel):
|
|
|
29
29
|
GetSimpleWorkflowResultsResult
|
|
30
30
|
""" # noqa: E501
|
|
31
31
|
rapid_id: StrictStr = Field(alias="rapidId")
|
|
32
|
-
asset:
|
|
32
|
+
asset: DatapointAsset
|
|
33
33
|
responses: List[RapidResponse]
|
|
34
34
|
state: StrictStr
|
|
35
35
|
__properties: ClassVar[List[str]] = ["rapidId", "asset", "responses", "state"]
|
|
@@ -103,7 +103,7 @@ class GetSimpleWorkflowResultsResult(BaseModel):
|
|
|
103
103
|
|
|
104
104
|
_obj = cls.model_validate({
|
|
105
105
|
"rapidId": obj.get("rapidId"),
|
|
106
|
-
"asset":
|
|
106
|
+
"asset": DatapointAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
107
107
|
"responses": [RapidResponse.from_dict(_item) for _item in obj["responses"]] if obj.get("responses") is not None else None,
|
|
108
108
|
"state": obj.get("state")
|
|
109
109
|
})
|
|
@@ -28,7 +28,7 @@ class MultiAssetModel(BaseModel):
|
|
|
28
28
|
MultiAssetModel
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
t: StrictStr = Field(description="Discriminator value for MultiAsset", alias="_t")
|
|
31
|
-
assets: List[
|
|
31
|
+
assets: List[DatapointAsset]
|
|
32
32
|
metadata: Dict[str, FileAssetModelMetadataValue]
|
|
33
33
|
identifier: StrictStr
|
|
34
34
|
__properties: ClassVar[List[str]] = ["_t", "assets", "metadata", "identifier"]
|
|
@@ -106,7 +106,7 @@ class MultiAssetModel(BaseModel):
|
|
|
106
106
|
|
|
107
107
|
_obj = cls.model_validate({
|
|
108
108
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'MultiAsset',
|
|
109
|
-
"assets": [
|
|
109
|
+
"assets": [DatapointAsset.from_dict(_item) for _item in obj["assets"]] if obj.get("assets") is not None else None,
|
|
110
110
|
"metadata": dict(
|
|
111
111
|
(_k, FileAssetModelMetadataValue.from_dict(_v))
|
|
112
112
|
for _k, _v in obj["metadata"].items()
|
|
@@ -117,7 +117,7 @@ class MultiAssetModel(BaseModel):
|
|
|
117
117
|
})
|
|
118
118
|
return _obj
|
|
119
119
|
|
|
120
|
-
from rapidata.api_client.models.
|
|
120
|
+
from rapidata.api_client.models.datapoint_asset import DatapointAsset
|
|
121
121
|
# TODO: Rewrite to not use raise_errors
|
|
122
122
|
MultiAssetModel.model_rebuild(raise_errors=False)
|
|
123
123
|
|
|
@@ -19,6 +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.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
|
|
|
@@ -29,7 +30,8 @@ class UploadTextSourcesToDatasetModel(BaseModel):
|
|
|
29
30
|
dataset_id: StrictStr = Field(description="The id of the dataset to upload the text sources to.", alias="datasetId")
|
|
30
31
|
text_sources: List[StrictStr] = Field(description="The text sources to upload.", alias="textSources")
|
|
31
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")
|
|
32
|
-
|
|
33
|
+
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.")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["datasetId", "textSources", "sortIndex", "metadata"]
|
|
33
35
|
|
|
34
36
|
model_config = ConfigDict(
|
|
35
37
|
populate_by_name=True,
|
|
@@ -70,11 +72,23 @@ class UploadTextSourcesToDatasetModel(BaseModel):
|
|
|
70
72
|
exclude=excluded_fields,
|
|
71
73
|
exclude_none=True,
|
|
72
74
|
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in metadata (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.metadata:
|
|
78
|
+
for _item_metadata in self.metadata:
|
|
79
|
+
if _item_metadata:
|
|
80
|
+
_items.append(_item_metadata.to_dict())
|
|
81
|
+
_dict['metadata'] = _items
|
|
73
82
|
# set to None if sort_index (nullable) is None
|
|
74
83
|
# and model_fields_set contains the field
|
|
75
84
|
if self.sort_index is None and "sort_index" in self.model_fields_set:
|
|
76
85
|
_dict['sortIndex'] = None
|
|
77
86
|
|
|
87
|
+
# set to None if metadata (nullable) is None
|
|
88
|
+
# and model_fields_set contains the field
|
|
89
|
+
if self.metadata is None and "metadata" in self.model_fields_set:
|
|
90
|
+
_dict['metadata'] = None
|
|
91
|
+
|
|
78
92
|
return _dict
|
|
79
93
|
|
|
80
94
|
@classmethod
|
|
@@ -89,7 +103,8 @@ class UploadTextSourcesToDatasetModel(BaseModel):
|
|
|
89
103
|
_obj = cls.model_validate({
|
|
90
104
|
"datasetId": obj.get("datasetId"),
|
|
91
105
|
"textSources": obj.get("textSources"),
|
|
92
|
-
"sortIndex": obj.get("sortIndex")
|
|
106
|
+
"sortIndex": obj.get("sortIndex"),
|
|
107
|
+
"metadata": [CreateDatapointFromUrlsModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None
|
|
93
108
|
})
|
|
94
109
|
return _obj
|
|
95
110
|
|
rapidata/api_client_README.md
CHANGED
|
@@ -87,6 +87,7 @@ Class | Method | HTTP request | Description
|
|
|
87
87
|
*DatapointApi* | [**datapoint_get_by_id_get**](rapidata/api_client/docs/DatapointApi.md#datapoint_get_by_id_get) | **GET** /Datapoint/GetById | Get a datapoint by its id.
|
|
88
88
|
*DatasetApi* | [**dataset_creat_text_datapoint_post**](rapidata/api_client/docs/DatasetApi.md#dataset_creat_text_datapoint_post) | **POST** /Dataset/CreatTextDatapoint | Creates new datapoints from text sources.
|
|
89
89
|
*DatasetApi* | [**dataset_create_datapoint_post**](rapidata/api_client/docs/DatasetApi.md#dataset_create_datapoint_post) | **POST** /Dataset/CreateDatapoint | Creates a single datapoint.
|
|
90
|
+
*DatasetApi* | [**dataset_dataset_id_datapoints_failed_get**](rapidata/api_client/docs/DatasetApi.md#dataset_dataset_id_datapoints_failed_get) | **GET** /dataset/{datasetId}/datapoints/failed | Gets a list of all datapoints that failed to upload.
|
|
90
91
|
*DatasetApi* | [**dataset_dataset_id_datapoints_urls_post**](rapidata/api_client/docs/DatasetApi.md#dataset_dataset_id_datapoints_urls_post) | **POST** /dataset/{datasetId}/datapoints/urls | Creates new datapoint where the assets are fetched from the specified urls.
|
|
91
92
|
*DatasetApi* | [**dataset_dataset_id_progress_get**](rapidata/api_client/docs/DatasetApi.md#dataset_dataset_id_progress_get) | **GET** /dataset/{datasetId}/progress | Gets the upload progress of a dataset.
|
|
92
93
|
*DatasetApi* | [**dataset_get_by_id_get**](rapidata/api_client/docs/DatasetApi.md#dataset_get_by_id_get) | **GET** /Dataset/GetById | Gets a dataset by its id.
|
|
@@ -135,6 +136,7 @@ Class | Method | HTTP request | Description
|
|
|
135
136
|
*RapidApi* | [**rapid_skip_user_guess_post**](rapidata/api_client/docs/RapidApi.md#rapid_skip_user_guess_post) | **POST** /Rapid/SkipUserGuess | Skips a Rapid for the user.
|
|
136
137
|
*RapidApi* | [**rapid_validate_current_rapid_bag_get**](rapidata/api_client/docs/RapidApi.md#rapid_validate_current_rapid_bag_get) | **GET** /Rapid/ValidateCurrentRapidBag | Validates that the rapids associated with the current user are active.
|
|
137
138
|
*RapidApi* | [**rapid_validation_rapid_id_put**](rapidata/api_client/docs/RapidApi.md#rapid_validation_rapid_id_put) | **PUT** /rapid/validation/{rapidId} | Updates the validation information of a rapid.
|
|
139
|
+
*RapidataIdentityAPIApi* | [**root_get**](rapidata/api_client/docs/RapidataIdentityAPIApi.md#root_get) | **GET** / |
|
|
138
140
|
*SimpleWorkflowApi* | [**workflow_simple_id_results_get**](rapidata/api_client/docs/SimpleWorkflowApi.md#workflow_simple_id_results_get) | **GET** /workflow/simple/{id}/results | Get the result overview for a simple workflow.
|
|
139
141
|
*UserInfoApi* | [**connect_userinfo_get**](rapidata/api_client/docs/UserInfoApi.md#connect_userinfo_get) | **GET** /connect/userinfo | Retrieves information about the authenticated user.
|
|
140
142
|
*ValidationApi* | [**validation_add_validation_rapid_post**](rapidata/api_client/docs/ValidationApi.md#validation_add_validation_rapid_post) | **POST** /Validation/AddValidationRapid | Adds a new validation rapid to the specified validation set.
|
|
@@ -149,6 +151,7 @@ Class | Method | HTTP request | Description
|
|
|
149
151
|
*WorkflowApi* | [**workflow_get_by_id_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_get_by_id_get) | **GET** /Workflow/GetById | Get a workflow by its ID.
|
|
150
152
|
*WorkflowApi* | [**workflow_get_progress_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_get_progress_get) | **GET** /Workflow/GetProgress | Get the progress of a workflow.
|
|
151
153
|
*WorkflowApi* | [**workflow_id_compare_ab_summary_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_id_compare_ab_summary_get) | **GET** /workflow/{id}/compare-ab-summary | Calculates a summary of the results for a simple compare workflow. The summary includes the number of times an asset at each index was the winner.
|
|
154
|
+
*WorkflowApi* | [**workflow_id_responses_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_id_responses_get) | **GET** /workflow/{id}/responses | Gets the !:limit most recent or oldest responses for a workflow. The responses are not guaranteed to be of any specific rapid. Instead, this endpoint returns all responses to any rapid in the workflow.
|
|
152
155
|
*WorkflowApi* | [**workflow_query_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_query_get) | **GET** /Workflow/Query | Queries workflows based on the provided filter, page, and sort criteria.
|
|
153
156
|
|
|
154
157
|
|
|
@@ -158,7 +161,6 @@ Class | Method | HTTP request | Description
|
|
|
158
161
|
- [AbTestSelectionAInner](rapidata/api_client/docs/AbTestSelectionAInner.md)
|
|
159
162
|
- [AddCampaignArtifactResult](rapidata/api_client/docs/AddCampaignArtifactResult.md)
|
|
160
163
|
- [AddCampaignModel](rapidata/api_client/docs/AddCampaignModel.md)
|
|
161
|
-
- [AddCampaignModelUserFiltersInner](rapidata/api_client/docs/AddCampaignModelUserFiltersInner.md)
|
|
162
164
|
- [AddValidationRapidModel](rapidata/api_client/docs/AddValidationRapidModel.md)
|
|
163
165
|
- [AddValidationRapidModelPayload](rapidata/api_client/docs/AddValidationRapidModelPayload.md)
|
|
164
166
|
- [AddValidationRapidModelTruth](rapidata/api_client/docs/AddValidationRapidModelTruth.md)
|
|
@@ -215,6 +217,7 @@ Class | Method | HTTP request | Description
|
|
|
215
217
|
- [CreateComplexOrderModelPipeline](rapidata/api_client/docs/CreateComplexOrderModelPipeline.md)
|
|
216
218
|
- [CreateComplexOrderResult](rapidata/api_client/docs/CreateComplexOrderResult.md)
|
|
217
219
|
- [CreateDatapointFromUrlsModel](rapidata/api_client/docs/CreateDatapointFromUrlsModel.md)
|
|
220
|
+
- [CreateDatapointFromUrlsModelMetadataInner](rapidata/api_client/docs/CreateDatapointFromUrlsModelMetadataInner.md)
|
|
218
221
|
- [CreateDatapointResult](rapidata/api_client/docs/CreateDatapointResult.md)
|
|
219
222
|
- [CreateDatasetArtifactModel](rapidata/api_client/docs/CreateDatasetArtifactModel.md)
|
|
220
223
|
- [CreateDatasetArtifactModelDataset](rapidata/api_client/docs/CreateDatasetArtifactModelDataset.md)
|
|
@@ -230,10 +233,10 @@ Class | Method | HTTP request | Description
|
|
|
230
233
|
- [CreateSimplePipelineModelPipelineStepsInner](rapidata/api_client/docs/CreateSimplePipelineModelPipelineStepsInner.md)
|
|
231
234
|
- [CreateUnsupportedOrderModel](rapidata/api_client/docs/CreateUnsupportedOrderModel.md)
|
|
232
235
|
- [CustomUserFilterModel](rapidata/api_client/docs/CustomUserFilterModel.md)
|
|
236
|
+
- [Datapoint](rapidata/api_client/docs/Datapoint.md)
|
|
237
|
+
- [DatapointAsset](rapidata/api_client/docs/DatapointAsset.md)
|
|
233
238
|
- [DatapointMetadataModel](rapidata/api_client/docs/DatapointMetadataModel.md)
|
|
234
|
-
- [DatapointMetadataModelMetadataInner](rapidata/api_client/docs/DatapointMetadataModelMetadataInner.md)
|
|
235
239
|
- [DatapointModel](rapidata/api_client/docs/DatapointModel.md)
|
|
236
|
-
- [DatapointModelAsset](rapidata/api_client/docs/DatapointModelAsset.md)
|
|
237
240
|
- [DatapointState](rapidata/api_client/docs/DatapointState.md)
|
|
238
241
|
- [DatasetArtifactModel](rapidata/api_client/docs/DatasetArtifactModel.md)
|
|
239
242
|
- [DatasetEvaluationStepModel](rapidata/api_client/docs/DatasetEvaluationStepModel.md)
|
|
@@ -268,10 +271,12 @@ Class | Method | HTTP request | Description
|
|
|
268
271
|
- [GetDatapointsByDatasetIdResult](rapidata/api_client/docs/GetDatapointsByDatasetIdResult.md)
|
|
269
272
|
- [GetDatasetByIdResult](rapidata/api_client/docs/GetDatasetByIdResult.md)
|
|
270
273
|
- [GetDatasetProgressResult](rapidata/api_client/docs/GetDatasetProgressResult.md)
|
|
274
|
+
- [GetFailedDatapointsResult](rapidata/api_client/docs/GetFailedDatapointsResult.md)
|
|
271
275
|
- [GetOrderByIdResult](rapidata/api_client/docs/GetOrderByIdResult.md)
|
|
272
276
|
- [GetPipelineByIdResult](rapidata/api_client/docs/GetPipelineByIdResult.md)
|
|
273
277
|
- [GetPipelineByIdResultArtifactsValue](rapidata/api_client/docs/GetPipelineByIdResultArtifactsValue.md)
|
|
274
278
|
- [GetPublicOrdersResult](rapidata/api_client/docs/GetPublicOrdersResult.md)
|
|
279
|
+
- [GetResponsesResult](rapidata/api_client/docs/GetResponsesResult.md)
|
|
275
280
|
- [GetSimpleWorkflowResultsModel](rapidata/api_client/docs/GetSimpleWorkflowResultsModel.md)
|
|
276
281
|
- [GetSimpleWorkflowResultsResult](rapidata/api_client/docs/GetSimpleWorkflowResultsResult.md)
|
|
277
282
|
- [GetSimpleWorkflowResultsResultPagedResult](rapidata/api_client/docs/GetSimpleWorkflowResultsResultPagedResult.md)
|
|
@@ -311,7 +316,6 @@ Class | Method | HTTP request | Description
|
|
|
311
316
|
- [NamedEntityTruth](rapidata/api_client/docs/NamedEntityTruth.md)
|
|
312
317
|
- [NeverEndingRefereeConfig](rapidata/api_client/docs/NeverEndingRefereeConfig.md)
|
|
313
318
|
- [NewUserFilterModel](rapidata/api_client/docs/NewUserFilterModel.md)
|
|
314
|
-
- [NewUserFilterModel1](rapidata/api_client/docs/NewUserFilterModel1.md)
|
|
315
319
|
- [NewsletterModel](rapidata/api_client/docs/NewsletterModel.md)
|
|
316
320
|
- [NotAvailableYetResult](rapidata/api_client/docs/NotAvailableYetResult.md)
|
|
317
321
|
- [NullAssetModel](rapidata/api_client/docs/NullAssetModel.md)
|
|
@@ -84,7 +84,7 @@ class MediaAsset(BaseAsset):
|
|
|
84
84
|
self._url = path
|
|
85
85
|
self.name = path.split('/')[-1]
|
|
86
86
|
self.name = self.__check_name_ending(self.name)
|
|
87
|
-
self.path =
|
|
87
|
+
self.path = path
|
|
88
88
|
return
|
|
89
89
|
|
|
90
90
|
if not os.path.exists(path):
|
|
@@ -287,6 +287,10 @@ class MediaAsset(BaseAsset):
|
|
|
287
287
|
self._logger.error(error_msg)
|
|
288
288
|
raise ValueError(error_msg)
|
|
289
289
|
|
|
290
|
+
def is_local(self) -> bool:
|
|
291
|
+
"""Check if the media asset is a local file."""
|
|
292
|
+
return self._url is None
|
|
293
|
+
|
|
290
294
|
def to_file(self) -> StrictStr | tuple[StrictStr, StrictBytes] | StrictBytes:
|
|
291
295
|
"""Convert the media asset to a file representation."""
|
|
292
296
|
if self._url is None:
|
|
@@ -5,7 +5,7 @@ Defines the MultiAsset class for handling multiple BaseAsset instances.
|
|
|
5
5
|
|
|
6
6
|
from rapidata.rapidata_client.assets._base_asset import BaseAsset
|
|
7
7
|
from rapidata.rapidata_client.assets import MediaAsset, TextAsset
|
|
8
|
-
from typing import Iterator, Sequence
|
|
8
|
+
from typing import Iterator, Sequence, cast
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class MultiAsset(BaseAsset):
|
|
@@ -34,6 +34,11 @@ class MultiAsset(BaseAsset):
|
|
|
34
34
|
if not all(isinstance(asset, type(assets[0])) for asset in assets):
|
|
35
35
|
raise ValueError("All assets must be of the same type.")
|
|
36
36
|
|
|
37
|
+
if isinstance(assets[0], MediaAsset):
|
|
38
|
+
local = [asset.is_local() for asset in cast(Sequence[MediaAsset], assets)]
|
|
39
|
+
if not all(loc == local[0] for loc in local):
|
|
40
|
+
raise ValueError("A datapoint with multiple assets can either have both assets be local paths or both be URLs. not a mix of both.")
|
|
41
|
+
|
|
37
42
|
self.assets = assets
|
|
38
43
|
|
|
39
44
|
def __len__(self) -> int:
|
|
@@ -9,7 +9,7 @@ class CountryFilter(RapidataFilter):
|
|
|
9
9
|
Can be used to filter who to target based on country codes.
|
|
10
10
|
|
|
11
11
|
Args:
|
|
12
|
-
country_codes (list[str]): List of country codes (
|
|
12
|
+
country_codes (list[str]): List of country codes (capitalized) to filter by.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
def __init__(self, country_codes: list[str]):
|