lightningrod-ai 0.1.6__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.
Files changed (123) hide show
  1. lightningrod/__init__.py +66 -0
  2. lightningrod/_display.py +204 -0
  3. lightningrod/_errors.py +67 -0
  4. lightningrod/_generated/__init__.py +8 -0
  5. lightningrod/_generated/api/__init__.py +1 -0
  6. lightningrod/_generated/api/datasets/__init__.py +1 -0
  7. lightningrod/_generated/api/datasets/create_dataset_datasets_post.py +133 -0
  8. lightningrod/_generated/api/datasets/get_dataset_datasets_dataset_id_get.py +168 -0
  9. lightningrod/_generated/api/datasets/get_dataset_samples_datasets_dataset_id_samples_get.py +209 -0
  10. lightningrod/_generated/api/datasets/upload_samples_datasets_dataset_id_samples_post.py +190 -0
  11. lightningrod/_generated/api/file_sets/__init__.py +1 -0
  12. lightningrod/_generated/api/file_sets/add_file_to_set_filesets_file_set_id_files_post.py +190 -0
  13. lightningrod/_generated/api/file_sets/create_file_set_filesets_post.py +174 -0
  14. lightningrod/_generated/api/file_sets/get_file_set_filesets_file_set_id_get.py +168 -0
  15. lightningrod/_generated/api/file_sets/list_file_sets_filesets_get.py +173 -0
  16. lightningrod/_generated/api/file_sets/list_files_in_set_filesets_file_set_id_files_get.py +209 -0
  17. lightningrod/_generated/api/files/__init__.py +1 -0
  18. lightningrod/_generated/api/files/create_file_upload_files_post.py +174 -0
  19. lightningrod/_generated/api/open_ai_compatible/__init__.py +1 -0
  20. lightningrod/_generated/api/open_ai_compatible/chat_completions_openai_chat_completions_post.py +174 -0
  21. lightningrod/_generated/api/organizations/__init__.py +1 -0
  22. lightningrod/_generated/api/organizations/get_balance_organizations_balance_get.py +131 -0
  23. lightningrod/_generated/api/samples/__init__.py +1 -0
  24. lightningrod/_generated/api/samples/validate_sample_samples_validate_post.py +174 -0
  25. lightningrod/_generated/api/transform_jobs/__init__.py +1 -0
  26. lightningrod/_generated/api/transform_jobs/cost_estimation_transform_jobs_cost_estimation_post.py +174 -0
  27. lightningrod/_generated/api/transform_jobs/create_transform_job_transform_jobs_post.py +174 -0
  28. lightningrod/_generated/api/transform_jobs/get_transform_job_metrics_transform_jobs_job_id_metrics_get.py +172 -0
  29. lightningrod/_generated/api/transform_jobs/get_transform_job_transform_jobs_job_id_get.py +168 -0
  30. lightningrod/_generated/client.py +268 -0
  31. lightningrod/_generated/errors.py +16 -0
  32. lightningrod/_generated/models/__init__.py +147 -0
  33. lightningrod/_generated/models/answer_type.py +129 -0
  34. lightningrod/_generated/models/answer_type_enum.py +11 -0
  35. lightningrod/_generated/models/balance_response.py +61 -0
  36. lightningrod/_generated/models/chat_completion_request.py +216 -0
  37. lightningrod/_generated/models/chat_completion_response.py +146 -0
  38. lightningrod/_generated/models/chat_message.py +69 -0
  39. lightningrod/_generated/models/choice.py +97 -0
  40. lightningrod/_generated/models/create_dataset_response.py +61 -0
  41. lightningrod/_generated/models/create_file_set_file_request.py +101 -0
  42. lightningrod/_generated/models/create_file_set_file_request_metadata_type_0.py +46 -0
  43. lightningrod/_generated/models/create_file_set_request.py +83 -0
  44. lightningrod/_generated/models/create_file_upload_request.py +91 -0
  45. lightningrod/_generated/models/create_file_upload_response.py +165 -0
  46. lightningrod/_generated/models/create_file_upload_response_metadata_type_0.py +46 -0
  47. lightningrod/_generated/models/create_transform_job_request.py +312 -0
  48. lightningrod/_generated/models/dataset_metadata.py +69 -0
  49. lightningrod/_generated/models/estimate_cost_request.py +243 -0
  50. lightningrod/_generated/models/estimate_cost_response.py +117 -0
  51. lightningrod/_generated/models/event_usage_summary.py +80 -0
  52. lightningrod/_generated/models/file_set.py +128 -0
  53. lightningrod/_generated/models/file_set_file.py +203 -0
  54. lightningrod/_generated/models/file_set_file_metadata_type_0.py +57 -0
  55. lightningrod/_generated/models/file_set_query_seed_generator.py +136 -0
  56. lightningrod/_generated/models/file_set_seed_generator.py +126 -0
  57. lightningrod/_generated/models/filter_criteria.py +83 -0
  58. lightningrod/_generated/models/forward_looking_question.py +130 -0
  59. lightningrod/_generated/models/forward_looking_question_generator.py +217 -0
  60. lightningrod/_generated/models/gdelt_seed_generator.py +103 -0
  61. lightningrod/_generated/models/http_validation_error.py +79 -0
  62. lightningrod/_generated/models/job_usage.py +185 -0
  63. lightningrod/_generated/models/job_usage_by_step_type_0.py +59 -0
  64. lightningrod/_generated/models/label.py +143 -0
  65. lightningrod/_generated/models/list_file_set_files_response.py +113 -0
  66. lightningrod/_generated/models/list_file_sets_response.py +75 -0
  67. lightningrod/_generated/models/llm_model_usage_summary.py +98 -0
  68. lightningrod/_generated/models/mock_transform_config.py +243 -0
  69. lightningrod/_generated/models/mock_transform_config_metadata_additions.py +46 -0
  70. lightningrod/_generated/models/model_config.py +316 -0
  71. lightningrod/_generated/models/model_source_type.py +16 -0
  72. lightningrod/_generated/models/news_context.py +82 -0
  73. lightningrod/_generated/models/news_context_generator.py +127 -0
  74. lightningrod/_generated/models/news_seed_generator.py +220 -0
  75. lightningrod/_generated/models/paginated_samples_response.py +113 -0
  76. lightningrod/_generated/models/pipeline_metrics_response.py +99 -0
  77. lightningrod/_generated/models/question.py +74 -0
  78. lightningrod/_generated/models/question_and_label_generator.py +217 -0
  79. lightningrod/_generated/models/question_generator.py +217 -0
  80. lightningrod/_generated/models/question_pipeline.py +417 -0
  81. lightningrod/_generated/models/question_renderer.py +123 -0
  82. lightningrod/_generated/models/rag_context.py +82 -0
  83. lightningrod/_generated/models/response_message.py +69 -0
  84. lightningrod/_generated/models/rollout.py +130 -0
  85. lightningrod/_generated/models/rollout_generator.py +139 -0
  86. lightningrod/_generated/models/rollout_parsed_output_type_0.py +46 -0
  87. lightningrod/_generated/models/sample.py +323 -0
  88. lightningrod/_generated/models/sample_meta.py +46 -0
  89. lightningrod/_generated/models/seed.py +135 -0
  90. lightningrod/_generated/models/step_cost_breakdown.py +109 -0
  91. lightningrod/_generated/models/transform_job.py +268 -0
  92. lightningrod/_generated/models/transform_job_status.py +11 -0
  93. lightningrod/_generated/models/transform_step_metrics_response.py +131 -0
  94. lightningrod/_generated/models/transform_type.py +25 -0
  95. lightningrod/_generated/models/upload_samples_request.py +75 -0
  96. lightningrod/_generated/models/upload_samples_response.py +69 -0
  97. lightningrod/_generated/models/usage.py +77 -0
  98. lightningrod/_generated/models/usage_summary.py +102 -0
  99. lightningrod/_generated/models/usage_summary_events.py +59 -0
  100. lightningrod/_generated/models/usage_summary_llm_by_model.py +59 -0
  101. lightningrod/_generated/models/validate_sample_response.py +69 -0
  102. lightningrod/_generated/models/validation_error.py +90 -0
  103. lightningrod/_generated/models/web_search_labeler.py +120 -0
  104. lightningrod/_generated/py.typed +1 -0
  105. lightningrod/_generated/types.py +54 -0
  106. lightningrod/client.py +48 -0
  107. lightningrod/datasets/__init__.py +4 -0
  108. lightningrod/datasets/client.py +174 -0
  109. lightningrod/datasets/dataset.py +255 -0
  110. lightningrod/files/__init__.py +0 -0
  111. lightningrod/files/client.py +58 -0
  112. lightningrod/filesets/__init__.py +0 -0
  113. lightningrod/filesets/client.py +106 -0
  114. lightningrod/organization/__init__.py +0 -0
  115. lightningrod/organization/client.py +17 -0
  116. lightningrod/py.typed +0 -0
  117. lightningrod/transforms/__init__.py +0 -0
  118. lightningrod/transforms/client.py +154 -0
  119. lightningrod_ai-0.1.6.dist-info/METADATA +122 -0
  120. lightningrod_ai-0.1.6.dist-info/RECORD +123 -0
  121. lightningrod_ai-0.1.6.dist-info/WHEEL +5 -0
  122. lightningrod_ai-0.1.6.dist-info/licenses/LICENSE +23 -0
  123. lightningrod_ai-0.1.6.dist-info/top_level.txt +1 -0
@@ -0,0 +1,135 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ from collections.abc import Mapping
5
+ from typing import Any, TypeVar, cast
6
+
7
+ from attrs import define as _attrs_define
8
+ from attrs import field as _attrs_field
9
+ from dateutil.parser import isoparse
10
+
11
+ from ..types import UNSET, Unset
12
+
13
+ T = TypeVar("T", bound="Seed")
14
+
15
+
16
+ @_attrs_define
17
+ class Seed:
18
+ """
19
+ Attributes:
20
+ seed_text (str):
21
+ url (None | str | Unset):
22
+ seed_creation_date (datetime.datetime | None | Unset):
23
+ search_query (None | str | Unset):
24
+ """
25
+
26
+ seed_text: str
27
+ url: None | str | Unset = UNSET
28
+ seed_creation_date: datetime.datetime | None | Unset = UNSET
29
+ search_query: None | str | Unset = UNSET
30
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31
+
32
+ def to_dict(self) -> dict[str, Any]:
33
+ seed_text = self.seed_text
34
+
35
+ url: None | str | Unset
36
+ if isinstance(self.url, Unset):
37
+ url = UNSET
38
+ else:
39
+ url = self.url
40
+
41
+ seed_creation_date: None | str | Unset
42
+ if isinstance(self.seed_creation_date, Unset):
43
+ seed_creation_date = UNSET
44
+ elif isinstance(self.seed_creation_date, datetime.datetime):
45
+ seed_creation_date = self.seed_creation_date.isoformat()
46
+ else:
47
+ seed_creation_date = self.seed_creation_date
48
+
49
+ search_query: None | str | Unset
50
+ if isinstance(self.search_query, Unset):
51
+ search_query = UNSET
52
+ else:
53
+ search_query = self.search_query
54
+
55
+ field_dict: dict[str, Any] = {}
56
+ field_dict.update(self.additional_properties)
57
+ field_dict.update(
58
+ {
59
+ "seed_text": seed_text,
60
+ }
61
+ )
62
+ if url is not UNSET:
63
+ field_dict["url"] = url
64
+ if seed_creation_date is not UNSET:
65
+ field_dict["seed_creation_date"] = seed_creation_date
66
+ if search_query is not UNSET:
67
+ field_dict["search_query"] = search_query
68
+
69
+ return field_dict
70
+
71
+ @classmethod
72
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
73
+ d = dict(src_dict)
74
+ seed_text = d.pop("seed_text")
75
+
76
+ def _parse_url(data: object) -> None | str | Unset:
77
+ if data is None:
78
+ return data
79
+ if isinstance(data, Unset):
80
+ return data
81
+ return cast(None | str | Unset, data)
82
+
83
+ url = _parse_url(d.pop("url", UNSET))
84
+
85
+ def _parse_seed_creation_date(data: object) -> datetime.datetime | None | Unset:
86
+ if data is None:
87
+ return data
88
+ if isinstance(data, Unset):
89
+ return data
90
+ try:
91
+ if not isinstance(data, str):
92
+ raise TypeError()
93
+ seed_creation_date_type_0 = isoparse(data)
94
+
95
+ return seed_creation_date_type_0
96
+ except (TypeError, ValueError, AttributeError, KeyError):
97
+ pass
98
+ return cast(datetime.datetime | None | Unset, data)
99
+
100
+ seed_creation_date = _parse_seed_creation_date(d.pop("seed_creation_date", UNSET))
101
+
102
+ def _parse_search_query(data: object) -> None | str | Unset:
103
+ if data is None:
104
+ return data
105
+ if isinstance(data, Unset):
106
+ return data
107
+ return cast(None | str | Unset, data)
108
+
109
+ search_query = _parse_search_query(d.pop("search_query", UNSET))
110
+
111
+ seed = cls(
112
+ seed_text=seed_text,
113
+ url=url,
114
+ seed_creation_date=seed_creation_date,
115
+ search_query=search_query,
116
+ )
117
+
118
+ seed.additional_properties = d
119
+ return seed
120
+
121
+ @property
122
+ def additional_keys(self) -> list[str]:
123
+ return list(self.additional_properties.keys())
124
+
125
+ def __getitem__(self, key: str) -> Any:
126
+ return self.additional_properties[key]
127
+
128
+ def __setitem__(self, key: str, value: Any) -> None:
129
+ self.additional_properties[key] = value
130
+
131
+ def __delitem__(self, key: str) -> None:
132
+ del self.additional_properties[key]
133
+
134
+ def __contains__(self, key: str) -> bool:
135
+ return key in self.additional_properties
@@ -0,0 +1,109 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.transform_type import TransformType
10
+
11
+ if TYPE_CHECKING:
12
+ from ..models.usage_summary import UsageSummary
13
+
14
+
15
+ T = TypeVar("T", bound="StepCostBreakdown")
16
+
17
+
18
+ @_attrs_define
19
+ class StepCostBreakdown:
20
+ """
21
+ Attributes:
22
+ step_name (str):
23
+ step_type (TransformType):
24
+ total_cost_dollars (float):
25
+ usage (UsageSummary): Flexible usage statistics by event type and LLM model.
26
+ output_count (int):
27
+ cost_per_output (float):
28
+ """
29
+
30
+ step_name: str
31
+ step_type: TransformType
32
+ total_cost_dollars: float
33
+ usage: UsageSummary
34
+ output_count: int
35
+ cost_per_output: float
36
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
37
+
38
+ def to_dict(self) -> dict[str, Any]:
39
+ step_name = self.step_name
40
+
41
+ step_type = self.step_type.value
42
+
43
+ total_cost_dollars = self.total_cost_dollars
44
+
45
+ usage = self.usage.to_dict()
46
+
47
+ output_count = self.output_count
48
+
49
+ cost_per_output = self.cost_per_output
50
+
51
+ field_dict: dict[str, Any] = {}
52
+ field_dict.update(self.additional_properties)
53
+ field_dict.update(
54
+ {
55
+ "step_name": step_name,
56
+ "step_type": step_type,
57
+ "total_cost_dollars": total_cost_dollars,
58
+ "usage": usage,
59
+ "output_count": output_count,
60
+ "cost_per_output": cost_per_output,
61
+ }
62
+ )
63
+
64
+ return field_dict
65
+
66
+ @classmethod
67
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
68
+ from ..models.usage_summary import UsageSummary
69
+
70
+ d = dict(src_dict)
71
+ step_name = d.pop("step_name")
72
+
73
+ step_type = TransformType(d.pop("step_type"))
74
+
75
+ total_cost_dollars = d.pop("total_cost_dollars")
76
+
77
+ usage = UsageSummary.from_dict(d.pop("usage"))
78
+
79
+ output_count = d.pop("output_count")
80
+
81
+ cost_per_output = d.pop("cost_per_output")
82
+
83
+ step_cost_breakdown = cls(
84
+ step_name=step_name,
85
+ step_type=step_type,
86
+ total_cost_dollars=total_cost_dollars,
87
+ usage=usage,
88
+ output_count=output_count,
89
+ cost_per_output=cost_per_output,
90
+ )
91
+
92
+ step_cost_breakdown.additional_properties = d
93
+ return step_cost_breakdown
94
+
95
+ @property
96
+ def additional_keys(self) -> list[str]:
97
+ return list(self.additional_properties.keys())
98
+
99
+ def __getitem__(self, key: str) -> Any:
100
+ return self.additional_properties[key]
101
+
102
+ def __setitem__(self, key: str, value: Any) -> None:
103
+ self.additional_properties[key] = value
104
+
105
+ def __delitem__(self, key: str) -> None:
106
+ del self.additional_properties[key]
107
+
108
+ def __contains__(self, key: str) -> bool:
109
+ return key in self.additional_properties
@@ -0,0 +1,268 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ from collections.abc import Mapping
5
+ from typing import TYPE_CHECKING, Any, TypeVar, cast
6
+
7
+ from attrs import define as _attrs_define
8
+ from attrs import field as _attrs_field
9
+ from dateutil.parser import isoparse
10
+
11
+ from ..models.transform_job_status import TransformJobStatus
12
+ from ..types import UNSET, Unset
13
+
14
+ if TYPE_CHECKING:
15
+ from ..models.job_usage import JobUsage
16
+
17
+
18
+ T = TypeVar("T", bound="TransformJob")
19
+
20
+
21
+ @_attrs_define
22
+ class TransformJob:
23
+ """
24
+ Attributes:
25
+ id (str):
26
+ organization_id (str):
27
+ status (TransformJobStatus):
28
+ modal_function_call_id (str):
29
+ modal_app_id (str):
30
+ transform_config (str):
31
+ input_dataset_id (None | str):
32
+ output_dataset_id (None | str):
33
+ created_at (datetime.datetime):
34
+ updated_at (datetime.datetime):
35
+ configuration_id (None | str | Unset):
36
+ error_message (None | str | Unset):
37
+ warning_message (None | str | Unset):
38
+ usage (JobUsage | None | Unset):
39
+ estimated_cost_dollars (float | None | Unset):
40
+ """
41
+
42
+ id: str
43
+ organization_id: str
44
+ status: TransformJobStatus
45
+ modal_function_call_id: str
46
+ modal_app_id: str
47
+ transform_config: str
48
+ input_dataset_id: None | str
49
+ output_dataset_id: None | str
50
+ created_at: datetime.datetime
51
+ updated_at: datetime.datetime
52
+ configuration_id: None | str | Unset = UNSET
53
+ error_message: None | str | Unset = UNSET
54
+ warning_message: None | str | Unset = UNSET
55
+ usage: JobUsage | None | Unset = UNSET
56
+ estimated_cost_dollars: float | None | Unset = UNSET
57
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
58
+
59
+ def to_dict(self) -> dict[str, Any]:
60
+ from ..models.job_usage import JobUsage
61
+
62
+ id = self.id
63
+
64
+ organization_id = self.organization_id
65
+
66
+ status = self.status.value
67
+
68
+ modal_function_call_id = self.modal_function_call_id
69
+
70
+ modal_app_id = self.modal_app_id
71
+
72
+ transform_config = self.transform_config
73
+
74
+ input_dataset_id: None | str
75
+ input_dataset_id = self.input_dataset_id
76
+
77
+ output_dataset_id: None | str
78
+ output_dataset_id = self.output_dataset_id
79
+
80
+ created_at = self.created_at.isoformat()
81
+
82
+ updated_at = self.updated_at.isoformat()
83
+
84
+ configuration_id: None | str | Unset
85
+ if isinstance(self.configuration_id, Unset):
86
+ configuration_id = UNSET
87
+ else:
88
+ configuration_id = self.configuration_id
89
+
90
+ error_message: None | str | Unset
91
+ if isinstance(self.error_message, Unset):
92
+ error_message = UNSET
93
+ else:
94
+ error_message = self.error_message
95
+
96
+ warning_message: None | str | Unset
97
+ if isinstance(self.warning_message, Unset):
98
+ warning_message = UNSET
99
+ else:
100
+ warning_message = self.warning_message
101
+
102
+ usage: dict[str, Any] | None | Unset
103
+ if isinstance(self.usage, Unset):
104
+ usage = UNSET
105
+ elif isinstance(self.usage, JobUsage):
106
+ usage = self.usage.to_dict()
107
+ else:
108
+ usage = self.usage
109
+
110
+ estimated_cost_dollars: float | None | Unset
111
+ if isinstance(self.estimated_cost_dollars, Unset):
112
+ estimated_cost_dollars = UNSET
113
+ else:
114
+ estimated_cost_dollars = self.estimated_cost_dollars
115
+
116
+ field_dict: dict[str, Any] = {}
117
+ field_dict.update(self.additional_properties)
118
+ field_dict.update(
119
+ {
120
+ "id": id,
121
+ "organization_id": organization_id,
122
+ "status": status,
123
+ "modal_function_call_id": modal_function_call_id,
124
+ "modal_app_id": modal_app_id,
125
+ "transform_config": transform_config,
126
+ "input_dataset_id": input_dataset_id,
127
+ "output_dataset_id": output_dataset_id,
128
+ "created_at": created_at,
129
+ "updated_at": updated_at,
130
+ }
131
+ )
132
+ if configuration_id is not UNSET:
133
+ field_dict["configuration_id"] = configuration_id
134
+ if error_message is not UNSET:
135
+ field_dict["error_message"] = error_message
136
+ if warning_message is not UNSET:
137
+ field_dict["warning_message"] = warning_message
138
+ if usage is not UNSET:
139
+ field_dict["usage"] = usage
140
+ if estimated_cost_dollars is not UNSET:
141
+ field_dict["estimated_cost_dollars"] = estimated_cost_dollars
142
+
143
+ return field_dict
144
+
145
+ @classmethod
146
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
147
+ from ..models.job_usage import JobUsage
148
+
149
+ d = dict(src_dict)
150
+ id = d.pop("id")
151
+
152
+ organization_id = d.pop("organization_id")
153
+
154
+ status = TransformJobStatus(d.pop("status"))
155
+
156
+ modal_function_call_id = d.pop("modal_function_call_id")
157
+
158
+ modal_app_id = d.pop("modal_app_id")
159
+
160
+ transform_config = d.pop("transform_config")
161
+
162
+ def _parse_input_dataset_id(data: object) -> None | str:
163
+ if data is None:
164
+ return data
165
+ return cast(None | str, data)
166
+
167
+ input_dataset_id = _parse_input_dataset_id(d.pop("input_dataset_id"))
168
+
169
+ def _parse_output_dataset_id(data: object) -> None | str:
170
+ if data is None:
171
+ return data
172
+ return cast(None | str, data)
173
+
174
+ output_dataset_id = _parse_output_dataset_id(d.pop("output_dataset_id"))
175
+
176
+ created_at = isoparse(d.pop("created_at"))
177
+
178
+ updated_at = isoparse(d.pop("updated_at"))
179
+
180
+ def _parse_configuration_id(data: object) -> None | str | Unset:
181
+ if data is None:
182
+ return data
183
+ if isinstance(data, Unset):
184
+ return data
185
+ return cast(None | str | Unset, data)
186
+
187
+ configuration_id = _parse_configuration_id(d.pop("configuration_id", UNSET))
188
+
189
+ def _parse_error_message(data: object) -> None | str | Unset:
190
+ if data is None:
191
+ return data
192
+ if isinstance(data, Unset):
193
+ return data
194
+ return cast(None | str | Unset, data)
195
+
196
+ error_message = _parse_error_message(d.pop("error_message", UNSET))
197
+
198
+ def _parse_warning_message(data: object) -> None | str | Unset:
199
+ if data is None:
200
+ return data
201
+ if isinstance(data, Unset):
202
+ return data
203
+ return cast(None | str | Unset, data)
204
+
205
+ warning_message = _parse_warning_message(d.pop("warning_message", UNSET))
206
+
207
+ def _parse_usage(data: object) -> JobUsage | None | Unset:
208
+ if data is None:
209
+ return data
210
+ if isinstance(data, Unset):
211
+ return data
212
+ try:
213
+ if not isinstance(data, dict):
214
+ raise TypeError()
215
+ usage_type_0 = JobUsage.from_dict(data)
216
+
217
+ return usage_type_0
218
+ except (TypeError, ValueError, AttributeError, KeyError):
219
+ pass
220
+ return cast(JobUsage | None | Unset, data)
221
+
222
+ usage = _parse_usage(d.pop("usage", UNSET))
223
+
224
+ def _parse_estimated_cost_dollars(data: object) -> float | None | Unset:
225
+ if data is None:
226
+ return data
227
+ if isinstance(data, Unset):
228
+ return data
229
+ return cast(float | None | Unset, data)
230
+
231
+ estimated_cost_dollars = _parse_estimated_cost_dollars(d.pop("estimated_cost_dollars", UNSET))
232
+
233
+ transform_job = cls(
234
+ id=id,
235
+ organization_id=organization_id,
236
+ status=status,
237
+ modal_function_call_id=modal_function_call_id,
238
+ modal_app_id=modal_app_id,
239
+ transform_config=transform_config,
240
+ input_dataset_id=input_dataset_id,
241
+ output_dataset_id=output_dataset_id,
242
+ created_at=created_at,
243
+ updated_at=updated_at,
244
+ configuration_id=configuration_id,
245
+ error_message=error_message,
246
+ warning_message=warning_message,
247
+ usage=usage,
248
+ estimated_cost_dollars=estimated_cost_dollars,
249
+ )
250
+
251
+ transform_job.additional_properties = d
252
+ return transform_job
253
+
254
+ @property
255
+ def additional_keys(self) -> list[str]:
256
+ return list(self.additional_properties.keys())
257
+
258
+ def __getitem__(self, key: str) -> Any:
259
+ return self.additional_properties[key]
260
+
261
+ def __setitem__(self, key: str, value: Any) -> None:
262
+ self.additional_properties[key] = value
263
+
264
+ def __delitem__(self, key: str) -> None:
265
+ del self.additional_properties[key]
266
+
267
+ def __contains__(self, key: str) -> bool:
268
+ return key in self.additional_properties
@@ -0,0 +1,11 @@
1
+ from enum import Enum
2
+
3
+
4
+ class TransformJobStatus(str, Enum):
5
+ CANCELLED = "CANCELLED"
6
+ COMPLETED = "COMPLETED"
7
+ FAILED = "FAILED"
8
+ RUNNING = "RUNNING"
9
+
10
+ def __str__(self) -> str:
11
+ return str(self.value)
@@ -0,0 +1,131 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="TransformStepMetricsResponse")
10
+
11
+
12
+ @_attrs_define
13
+ class TransformStepMetricsResponse:
14
+ """
15
+ Attributes:
16
+ step_index (int):
17
+ transform_name (str):
18
+ input_rows (int):
19
+ output_rows (int):
20
+ rejected_count (int):
21
+ error_count (int):
22
+ duration_seconds (float):
23
+ progress (float):
24
+ summary (None | str):
25
+ """
26
+
27
+ step_index: int
28
+ transform_name: str
29
+ input_rows: int
30
+ output_rows: int
31
+ rejected_count: int
32
+ error_count: int
33
+ duration_seconds: float
34
+ progress: float
35
+ summary: None | str
36
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
37
+
38
+ def to_dict(self) -> dict[str, Any]:
39
+ step_index = self.step_index
40
+
41
+ transform_name = self.transform_name
42
+
43
+ input_rows = self.input_rows
44
+
45
+ output_rows = self.output_rows
46
+
47
+ rejected_count = self.rejected_count
48
+
49
+ error_count = self.error_count
50
+
51
+ duration_seconds = self.duration_seconds
52
+
53
+ progress = self.progress
54
+
55
+ summary: None | str
56
+ summary = self.summary
57
+
58
+ field_dict: dict[str, Any] = {}
59
+ field_dict.update(self.additional_properties)
60
+ field_dict.update(
61
+ {
62
+ "step_index": step_index,
63
+ "transform_name": transform_name,
64
+ "input_rows": input_rows,
65
+ "output_rows": output_rows,
66
+ "rejected_count": rejected_count,
67
+ "error_count": error_count,
68
+ "duration_seconds": duration_seconds,
69
+ "progress": progress,
70
+ "summary": summary,
71
+ }
72
+ )
73
+
74
+ return field_dict
75
+
76
+ @classmethod
77
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
78
+ d = dict(src_dict)
79
+ step_index = d.pop("step_index")
80
+
81
+ transform_name = d.pop("transform_name")
82
+
83
+ input_rows = d.pop("input_rows")
84
+
85
+ output_rows = d.pop("output_rows")
86
+
87
+ rejected_count = d.pop("rejected_count")
88
+
89
+ error_count = d.pop("error_count")
90
+
91
+ duration_seconds = d.pop("duration_seconds")
92
+
93
+ progress = d.pop("progress")
94
+
95
+ def _parse_summary(data: object) -> None | str:
96
+ if data is None:
97
+ return data
98
+ return cast(None | str, data)
99
+
100
+ summary = _parse_summary(d.pop("summary"))
101
+
102
+ transform_step_metrics_response = cls(
103
+ step_index=step_index,
104
+ transform_name=transform_name,
105
+ input_rows=input_rows,
106
+ output_rows=output_rows,
107
+ rejected_count=rejected_count,
108
+ error_count=error_count,
109
+ duration_seconds=duration_seconds,
110
+ progress=progress,
111
+ summary=summary,
112
+ )
113
+
114
+ transform_step_metrics_response.additional_properties = d
115
+ return transform_step_metrics_response
116
+
117
+ @property
118
+ def additional_keys(self) -> list[str]:
119
+ return list(self.additional_properties.keys())
120
+
121
+ def __getitem__(self, key: str) -> Any:
122
+ return self.additional_properties[key]
123
+
124
+ def __setitem__(self, key: str, value: Any) -> None:
125
+ self.additional_properties[key] = value
126
+
127
+ def __delitem__(self, key: str) -> None:
128
+ del self.additional_properties[key]
129
+
130
+ def __contains__(self, key: str) -> bool:
131
+ return key in self.additional_properties
@@ -0,0 +1,25 @@
1
+ from enum import Enum
2
+
3
+
4
+ class TransformType(str, Enum):
5
+ FILESET_QUERY_SEED_GENERATOR = "FILESET_QUERY_SEED_GENERATOR"
6
+ FILESET_SEED_GENERATOR = "FILESET_SEED_GENERATOR"
7
+ FILTER_CRITERIA = "FILTER_CRITERIA"
8
+ FORWARD_LOOKING_QUESTION_GENERATOR = "FORWARD_LOOKING_QUESTION_GENERATOR"
9
+ GDELT_SEED_GENERATOR = "GDELT_SEED_GENERATOR"
10
+ MOCK = "MOCK"
11
+ NEWS_CONTEXT_GENERATOR = "NEWS_CONTEXT_GENERATOR"
12
+ NEWS_SEED_GENERATOR = "NEWS_SEED_GENERATOR"
13
+ PIPELINE = "PIPELINE"
14
+ QUESTION_AND_LABEL_GENERATOR = "QUESTION_AND_LABEL_GENERATOR"
15
+ QUESTION_FILTER = "QUESTION_FILTER"
16
+ QUESTION_GENERATOR = "QUESTION_GENERATOR"
17
+ QUESTION_PIPELINE = "QUESTION_PIPELINE"
18
+ QUESTION_QUALITY_SCORER = "QUESTION_QUALITY_SCORER"
19
+ QUESTION_RENDERER = "QUESTION_RENDERER"
20
+ ROLLOUT_GENERATOR = "ROLLOUT_GENERATOR"
21
+ SCORE_FILTER = "SCORE_FILTER"
22
+ WEB_SEARCH_LABELER = "WEB_SEARCH_LABELER"
23
+
24
+ def __str__(self) -> str:
25
+ return str(self.value)