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.

Files changed (35) hide show
  1. rapidata/api_client/__init__.py +6 -4
  2. rapidata/api_client/api/__init__.py +1 -0
  3. rapidata/api_client/api/dataset_api.py +265 -0
  4. rapidata/api_client/api/workflow_api.py +298 -1
  5. rapidata/api_client/models/__init__.py +5 -4
  6. rapidata/api_client/models/add_campaign_model.py +3 -3
  7. rapidata/api_client/models/add_validation_rapid_model.py +3 -3
  8. rapidata/api_client/models/add_validation_text_rapid_model.py +3 -3
  9. rapidata/api_client/models/create_datapoint_from_urls_model.py +26 -4
  10. rapidata/api_client/models/create_datapoint_from_urls_model_metadata_inner.py +168 -0
  11. rapidata/api_client/models/create_datapoint_result.py +5 -3
  12. rapidata/api_client/models/datapoint.py +7 -30
  13. rapidata/api_client/models/datapoint_asset.py +40 -40
  14. rapidata/api_client/models/datapoint_metadata_model.py +3 -3
  15. rapidata/api_client/models/datapoint_model.py +3 -3
  16. rapidata/api_client/models/get_compare_workflow_results_result.py +3 -3
  17. rapidata/api_client/models/get_datapoint_by_id_result.py +3 -3
  18. rapidata/api_client/models/get_failed_datapoints_result.py +95 -0
  19. rapidata/api_client/models/get_responses_result.py +95 -0
  20. rapidata/api_client/models/get_simple_workflow_results_result.py +3 -3
  21. rapidata/api_client/models/multi_asset_model.py +3 -3
  22. rapidata/api_client/models/upload_text_sources_to_dataset_model.py +17 -2
  23. rapidata/api_client_README.md +8 -4
  24. rapidata/rapidata_client/assets/_media_asset.py +5 -1
  25. rapidata/rapidata_client/assets/_multi_asset.py +6 -1
  26. rapidata/rapidata_client/filter/country_filter.py +1 -1
  27. rapidata/rapidata_client/order/_rapidata_dataset.py +311 -108
  28. rapidata/rapidata_client/order/rapidata_order_manager.py +64 -6
  29. rapidata/rapidata_client/validation/rapids/rapids.py +4 -5
  30. rapidata/rapidata_client/workflow/__init__.py +1 -0
  31. rapidata/rapidata_client/workflow/_ranking_workflow.py +40 -0
  32. {rapidata-2.13.1.dist-info → rapidata-2.14.0.dist-info}/METADATA +1 -1
  33. {rapidata-2.13.1.dist-info → rapidata-2.14.0.dist-info}/RECORD +35 -31
  34. {rapidata-2.13.1.dist-info → rapidata-2.14.0.dist-info}/LICENSE +0 -0
  35. {rapidata-2.13.1.dist-info → rapidata-2.14.0.dist-info}/WHEEL +0 -0
@@ -18,7 +18,6 @@ from rapidata.api_client.models.ab_test_selection import AbTestSelection
18
18
  from rapidata.api_client.models.ab_test_selection_a_inner import AbTestSelectionAInner
19
19
  from rapidata.api_client.models.add_campaign_artifact_result import AddCampaignArtifactResult
20
20
  from rapidata.api_client.models.add_campaign_model import AddCampaignModel
21
- from rapidata.api_client.models.add_campaign_model_user_filters_inner import AddCampaignModelUserFiltersInner
22
21
  from rapidata.api_client.models.add_validation_rapid_model import AddValidationRapidModel
23
22
  from rapidata.api_client.models.add_validation_rapid_model_payload import AddValidationRapidModelPayload
24
23
  from rapidata.api_client.models.add_validation_rapid_model_truth import AddValidationRapidModelTruth
@@ -75,6 +74,7 @@ from rapidata.api_client.models.create_complex_order_model import CreateComplexO
75
74
  from rapidata.api_client.models.create_complex_order_model_pipeline import CreateComplexOrderModelPipeline
76
75
  from rapidata.api_client.models.create_complex_order_result import CreateComplexOrderResult
77
76
  from rapidata.api_client.models.create_datapoint_from_urls_model import CreateDatapointFromUrlsModel
77
+ from rapidata.api_client.models.create_datapoint_from_urls_model_metadata_inner import CreateDatapointFromUrlsModelMetadataInner
78
78
  from rapidata.api_client.models.create_datapoint_result import CreateDatapointResult
79
79
  from rapidata.api_client.models.create_dataset_artifact_model import CreateDatasetArtifactModel
80
80
  from rapidata.api_client.models.create_dataset_artifact_model_dataset import CreateDatasetArtifactModelDataset
@@ -90,10 +90,10 @@ from rapidata.api_client.models.create_simple_pipeline_model_artifacts_inner imp
90
90
  from rapidata.api_client.models.create_simple_pipeline_model_pipeline_steps_inner import CreateSimplePipelineModelPipelineStepsInner
91
91
  from rapidata.api_client.models.create_unsupported_order_model import CreateUnsupportedOrderModel
92
92
  from rapidata.api_client.models.custom_user_filter_model import CustomUserFilterModel
93
+ from rapidata.api_client.models.datapoint import Datapoint
94
+ from rapidata.api_client.models.datapoint_asset import DatapointAsset
93
95
  from rapidata.api_client.models.datapoint_metadata_model import DatapointMetadataModel
94
- from rapidata.api_client.models.datapoint_metadata_model_metadata_inner import DatapointMetadataModelMetadataInner
95
96
  from rapidata.api_client.models.datapoint_model import DatapointModel
96
- from rapidata.api_client.models.datapoint_model_asset import DatapointModelAsset
97
97
  from rapidata.api_client.models.datapoint_state import DatapointState
98
98
  from rapidata.api_client.models.dataset_artifact_model import DatasetArtifactModel
99
99
  from rapidata.api_client.models.dataset_evaluation_step_model import DatasetEvaluationStepModel
@@ -128,10 +128,12 @@ from rapidata.api_client.models.get_datapoint_by_id_result import GetDatapointBy
128
128
  from rapidata.api_client.models.get_datapoints_by_dataset_id_result import GetDatapointsByDatasetIdResult
129
129
  from rapidata.api_client.models.get_dataset_by_id_result import GetDatasetByIdResult
130
130
  from rapidata.api_client.models.get_dataset_progress_result import GetDatasetProgressResult
131
+ from rapidata.api_client.models.get_failed_datapoints_result import GetFailedDatapointsResult
131
132
  from rapidata.api_client.models.get_order_by_id_result import GetOrderByIdResult
132
133
  from rapidata.api_client.models.get_pipeline_by_id_result import GetPipelineByIdResult
133
134
  from rapidata.api_client.models.get_pipeline_by_id_result_artifacts_value import GetPipelineByIdResultArtifactsValue
134
135
  from rapidata.api_client.models.get_public_orders_result import GetPublicOrdersResult
136
+ from rapidata.api_client.models.get_responses_result import GetResponsesResult
135
137
  from rapidata.api_client.models.get_simple_workflow_results_model import GetSimpleWorkflowResultsModel
136
138
  from rapidata.api_client.models.get_simple_workflow_results_result import GetSimpleWorkflowResultsResult
137
139
  from rapidata.api_client.models.get_simple_workflow_results_result_paged_result import GetSimpleWorkflowResultsResultPagedResult
@@ -171,7 +173,6 @@ from rapidata.api_client.models.named_entity_result import NamedEntityResult
171
173
  from rapidata.api_client.models.named_entity_truth import NamedEntityTruth
172
174
  from rapidata.api_client.models.never_ending_referee_config import NeverEndingRefereeConfig
173
175
  from rapidata.api_client.models.new_user_filter_model import NewUserFilterModel
174
- from rapidata.api_client.models.new_user_filter_model1 import NewUserFilterModel1
175
176
  from rapidata.api_client.models.newsletter_model import NewsletterModel
176
177
  from rapidata.api_client.models.not_available_yet_result import NotAvailableYetResult
177
178
  from rapidata.api_client.models.null_asset_model import NullAssetModel
@@ -20,7 +20,7 @@ import json
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
22
  from rapidata.api_client.models.ab_test_selection_a_inner import AbTestSelectionAInner
23
- from rapidata.api_client.models.add_campaign_model_user_filters_inner import AddCampaignModelUserFiltersInner
23
+ from rapidata.api_client.models.create_order_model_user_filters_inner import CreateOrderModelUserFiltersInner
24
24
  from rapidata.api_client.models.feature_flag import FeatureFlag
25
25
  from typing import Optional, Set
26
26
  from typing_extensions import Self
@@ -32,7 +32,7 @@ class AddCampaignModel(BaseModel):
32
32
  t: StrictStr = Field(description="Discriminator value for AddCampaignModel", alias="_t")
33
33
  artifact_id: Optional[StrictStr] = Field(default=None, description="The id of the campaign artifact. If not provided a random value will be used.", alias="artifactId")
34
34
  campaign_name: StrictStr = Field(description="The name of the campaign.", alias="campaignName")
35
- user_filters: List[AddCampaignModelUserFiltersInner] = Field(description="The user filters to apply to the campaign.", alias="userFilters")
35
+ user_filters: List[CreateOrderModelUserFiltersInner] = Field(description="The user filters to apply to the campaign.", alias="userFilters")
36
36
  validation_set_id: Optional[StrictStr] = Field(default=None, description="A validation set that should be used.", alias="validationSetId")
37
37
  selections: Optional[List[AbTestSelectionAInner]] = Field(default=None, description="The selections that the campaign should have.")
38
38
  feature_flags: List[FeatureFlag] = Field(description="The feature flags that should be applied to the campaign.", alias="featureFlags")
@@ -137,7 +137,7 @@ class AddCampaignModel(BaseModel):
137
137
  "_t": obj.get("_t") if obj.get("_t") is not None else 'AddCampaignModel',
138
138
  "artifactId": obj.get("artifactId"),
139
139
  "campaignName": obj.get("campaignName"),
140
- "userFilters": [AddCampaignModelUserFiltersInner.from_dict(_item) for _item in obj["userFilters"]] if obj.get("userFilters") is not None else None,
140
+ "userFilters": [CreateOrderModelUserFiltersInner.from_dict(_item) for _item in obj["userFilters"]] if obj.get("userFilters") is not None else None,
141
141
  "validationSetId": obj.get("validationSetId"),
142
142
  "selections": [AbTestSelectionAInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None,
143
143
  "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
@@ -21,7 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, Stric
21
21
  from typing import Any, ClassVar, Dict, List, Optional, Union
22
22
  from rapidata.api_client.models.add_validation_rapid_model_payload import AddValidationRapidModelPayload
23
23
  from rapidata.api_client.models.add_validation_rapid_model_truth import AddValidationRapidModelTruth
24
- from rapidata.api_client.models.datapoint_metadata_model_metadata_inner import DatapointMetadataModelMetadataInner
24
+ from rapidata.api_client.models.create_datapoint_from_urls_model_metadata_inner import CreateDatapointFromUrlsModelMetadataInner
25
25
  from typing import Optional, Set
26
26
  from typing_extensions import Self
27
27
 
@@ -31,7 +31,7 @@ class AddValidationRapidModel(BaseModel):
31
31
  """ # noqa: E501
32
32
  validation_set_id: StrictStr = Field(description="The ID of the validation set to add the rapid to.", alias="validationSetId")
33
33
  payload: AddValidationRapidModelPayload
34
- metadata: List[DatapointMetadataModelMetadataInner] = Field(description="Some metadata to attach to the rapid.")
34
+ metadata: List[CreateDatapointFromUrlsModelMetadataInner] = Field(description="Some metadata to attach to the rapid.")
35
35
  truth: AddValidationRapidModelTruth
36
36
  random_correct_probability: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The probability for an answer to be correct when randomly guessing.", alias="randomCorrectProbability")
37
37
  explanation: Optional[StrictStr] = Field(default=None, description="An explanation for the users if they answer the rapid incorrectly.")
@@ -113,7 +113,7 @@ class AddValidationRapidModel(BaseModel):
113
113
  _obj = cls.model_validate({
114
114
  "validationSetId": obj.get("validationSetId"),
115
115
  "payload": AddValidationRapidModelPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
116
- "metadata": [DatapointMetadataModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
116
+ "metadata": [CreateDatapointFromUrlsModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
117
117
  "truth": AddValidationRapidModelTruth.from_dict(obj["truth"]) if obj.get("truth") is not None else None,
118
118
  "randomCorrectProbability": obj.get("randomCorrectProbability"),
119
119
  "explanation": obj.get("explanation")
@@ -21,7 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, Stric
21
21
  from typing import Any, ClassVar, Dict, List, Optional, Union
22
22
  from rapidata.api_client.models.add_validation_rapid_model_payload import AddValidationRapidModelPayload
23
23
  from rapidata.api_client.models.add_validation_rapid_model_truth import AddValidationRapidModelTruth
24
- from rapidata.api_client.models.datapoint_metadata_model_metadata_inner import DatapointMetadataModelMetadataInner
24
+ from rapidata.api_client.models.create_datapoint_from_urls_model_metadata_inner import CreateDatapointFromUrlsModelMetadataInner
25
25
  from typing import Optional, Set
26
26
  from typing_extensions import Self
27
27
 
@@ -31,7 +31,7 @@ class AddValidationTextRapidModel(BaseModel):
31
31
  """ # noqa: E501
32
32
  validation_set_id: StrictStr = Field(description="The ID of the validation set to add the rapid to.", alias="validationSetId")
33
33
  payload: AddValidationRapidModelPayload
34
- metadata: List[DatapointMetadataModelMetadataInner] = Field(description="Some metadata to attach to the rapid.")
34
+ metadata: List[CreateDatapointFromUrlsModelMetadataInner] = Field(description="Some metadata to attach to the rapid.")
35
35
  truth: AddValidationRapidModelTruth
36
36
  texts: List[StrictStr] = Field(description="The texts to use for the rapid.")
37
37
  random_correct_probability: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The probability for an answer to be correct when randomly guessing.", alias="randomCorrectProbability")
@@ -114,7 +114,7 @@ class AddValidationTextRapidModel(BaseModel):
114
114
  _obj = cls.model_validate({
115
115
  "validationSetId": obj.get("validationSetId"),
116
116
  "payload": AddValidationRapidModelPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
117
- "metadata": [DatapointMetadataModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
117
+ "metadata": [CreateDatapointFromUrlsModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
118
118
  "truth": AddValidationRapidModelTruth.from_dict(obj["truth"]) if obj.get("truth") is not None else None,
119
119
  "texts": obj.get("texts"),
120
120
  "randomCorrectProbability": obj.get("randomCorrectProbability"),
@@ -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
- __properties: ClassVar[List[str]] = ["urls"]
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
- __properties: ClassVar[List[str]] = ["datapointId", "errors"]
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, field_validator
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
- t: StrictStr = Field(description="Discriminator value for Datapoint", alias="_t")
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
- dataset_id: StrictStr = Field(alias="datasetId")
35
- id: Optional[StrictStr] = None
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
- "_t": obj.get("_t") if obj.get("_t") is not None else 'Datapoint',
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.file_asset import FileAsset
21
- from rapidata.api_client.models.null_asset import NullAsset
22
- from rapidata.api_client.models.text_asset import TextAsset
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 = ["FileAsset", "MultiAsset", "NullAsset", "TextAsset"]
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: FileAsset
34
- oneof_schema_1_validator: Optional[FileAsset] = None
35
- # data type: MultiAsset
36
- oneof_schema_2_validator: Optional[MultiAsset] = None
37
- # data type: NullAsset
38
- oneof_schema_3_validator: Optional[NullAsset] = None
39
- # data type: TextAsset
40
- oneof_schema_4_validator: Optional[TextAsset] = None
41
- actual_instance: Optional[Union[FileAsset, MultiAsset, NullAsset, TextAsset]] = None
42
- one_of_schemas: Set[str] = { "FileAsset", "MultiAsset", "NullAsset", "TextAsset" }
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: FileAsset
69
- if not isinstance(v, FileAsset):
70
- error_messages.append(f"Error! Input type `{type(v)}` is not `FileAsset`")
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: MultiAsset
74
- if not isinstance(v, MultiAsset):
75
- error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAsset`")
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: NullAsset
79
- if not isinstance(v, NullAsset):
80
- error_messages.append(f"Error! Input type `{type(v)}` is not `NullAsset`")
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: TextAsset
84
- if not isinstance(v, TextAsset):
85
- error_messages.append(f"Error! Input type `{type(v)}` is not `TextAsset`")
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: FileAsset, MultiAsset, NullAsset, TextAsset. Details: " + ", ".join(error_messages))
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: FileAsset, MultiAsset, NullAsset, TextAsset. Details: " + ", ".join(error_messages))
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 FileAsset
108
+ # deserialize data into FileAssetModel
109
109
  try:
110
- instance.actual_instance = FileAsset.from_json(json_str)
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 MultiAsset
114
+ # deserialize data into MultiAssetModel
115
115
  try:
116
- instance.actual_instance = MultiAsset.from_json(json_str)
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 NullAsset
120
+ # deserialize data into NullAssetModel
121
121
  try:
122
- instance.actual_instance = NullAsset.from_json(json_str)
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 TextAsset
126
+ # deserialize data into TextAssetModel
127
127
  try:
128
- instance.actual_instance = TextAsset.from_json(json_str)
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: FileAsset, MultiAsset, NullAsset, TextAsset. Details: " + ", ".join(error_messages))
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: FileAsset, MultiAsset, NullAsset, TextAsset. Details: " + ", ".join(error_messages))
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], FileAsset, MultiAsset, NullAsset, TextAsset]]:
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.multi_asset import MultiAsset
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.datapoint_metadata_model_metadata_inner import DatapointMetadataModelMetadataInner
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[DatapointMetadataModelMetadataInner] = Field(description="The metadata of the datapoint.")
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": [DatapointMetadataModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
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