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.
- lightningrod/__init__.py +66 -0
- lightningrod/_display.py +204 -0
- lightningrod/_errors.py +67 -0
- lightningrod/_generated/__init__.py +8 -0
- lightningrod/_generated/api/__init__.py +1 -0
- lightningrod/_generated/api/datasets/__init__.py +1 -0
- lightningrod/_generated/api/datasets/create_dataset_datasets_post.py +133 -0
- lightningrod/_generated/api/datasets/get_dataset_datasets_dataset_id_get.py +168 -0
- lightningrod/_generated/api/datasets/get_dataset_samples_datasets_dataset_id_samples_get.py +209 -0
- lightningrod/_generated/api/datasets/upload_samples_datasets_dataset_id_samples_post.py +190 -0
- lightningrod/_generated/api/file_sets/__init__.py +1 -0
- lightningrod/_generated/api/file_sets/add_file_to_set_filesets_file_set_id_files_post.py +190 -0
- lightningrod/_generated/api/file_sets/create_file_set_filesets_post.py +174 -0
- lightningrod/_generated/api/file_sets/get_file_set_filesets_file_set_id_get.py +168 -0
- lightningrod/_generated/api/file_sets/list_file_sets_filesets_get.py +173 -0
- lightningrod/_generated/api/file_sets/list_files_in_set_filesets_file_set_id_files_get.py +209 -0
- lightningrod/_generated/api/files/__init__.py +1 -0
- lightningrod/_generated/api/files/create_file_upload_files_post.py +174 -0
- lightningrod/_generated/api/open_ai_compatible/__init__.py +1 -0
- lightningrod/_generated/api/open_ai_compatible/chat_completions_openai_chat_completions_post.py +174 -0
- lightningrod/_generated/api/organizations/__init__.py +1 -0
- lightningrod/_generated/api/organizations/get_balance_organizations_balance_get.py +131 -0
- lightningrod/_generated/api/samples/__init__.py +1 -0
- lightningrod/_generated/api/samples/validate_sample_samples_validate_post.py +174 -0
- lightningrod/_generated/api/transform_jobs/__init__.py +1 -0
- lightningrod/_generated/api/transform_jobs/cost_estimation_transform_jobs_cost_estimation_post.py +174 -0
- lightningrod/_generated/api/transform_jobs/create_transform_job_transform_jobs_post.py +174 -0
- lightningrod/_generated/api/transform_jobs/get_transform_job_metrics_transform_jobs_job_id_metrics_get.py +172 -0
- lightningrod/_generated/api/transform_jobs/get_transform_job_transform_jobs_job_id_get.py +168 -0
- lightningrod/_generated/client.py +268 -0
- lightningrod/_generated/errors.py +16 -0
- lightningrod/_generated/models/__init__.py +147 -0
- lightningrod/_generated/models/answer_type.py +129 -0
- lightningrod/_generated/models/answer_type_enum.py +11 -0
- lightningrod/_generated/models/balance_response.py +61 -0
- lightningrod/_generated/models/chat_completion_request.py +216 -0
- lightningrod/_generated/models/chat_completion_response.py +146 -0
- lightningrod/_generated/models/chat_message.py +69 -0
- lightningrod/_generated/models/choice.py +97 -0
- lightningrod/_generated/models/create_dataset_response.py +61 -0
- lightningrod/_generated/models/create_file_set_file_request.py +101 -0
- lightningrod/_generated/models/create_file_set_file_request_metadata_type_0.py +46 -0
- lightningrod/_generated/models/create_file_set_request.py +83 -0
- lightningrod/_generated/models/create_file_upload_request.py +91 -0
- lightningrod/_generated/models/create_file_upload_response.py +165 -0
- lightningrod/_generated/models/create_file_upload_response_metadata_type_0.py +46 -0
- lightningrod/_generated/models/create_transform_job_request.py +312 -0
- lightningrod/_generated/models/dataset_metadata.py +69 -0
- lightningrod/_generated/models/estimate_cost_request.py +243 -0
- lightningrod/_generated/models/estimate_cost_response.py +117 -0
- lightningrod/_generated/models/event_usage_summary.py +80 -0
- lightningrod/_generated/models/file_set.py +128 -0
- lightningrod/_generated/models/file_set_file.py +203 -0
- lightningrod/_generated/models/file_set_file_metadata_type_0.py +57 -0
- lightningrod/_generated/models/file_set_query_seed_generator.py +136 -0
- lightningrod/_generated/models/file_set_seed_generator.py +126 -0
- lightningrod/_generated/models/filter_criteria.py +83 -0
- lightningrod/_generated/models/forward_looking_question.py +130 -0
- lightningrod/_generated/models/forward_looking_question_generator.py +217 -0
- lightningrod/_generated/models/gdelt_seed_generator.py +103 -0
- lightningrod/_generated/models/http_validation_error.py +79 -0
- lightningrod/_generated/models/job_usage.py +185 -0
- lightningrod/_generated/models/job_usage_by_step_type_0.py +59 -0
- lightningrod/_generated/models/label.py +143 -0
- lightningrod/_generated/models/list_file_set_files_response.py +113 -0
- lightningrod/_generated/models/list_file_sets_response.py +75 -0
- lightningrod/_generated/models/llm_model_usage_summary.py +98 -0
- lightningrod/_generated/models/mock_transform_config.py +243 -0
- lightningrod/_generated/models/mock_transform_config_metadata_additions.py +46 -0
- lightningrod/_generated/models/model_config.py +316 -0
- lightningrod/_generated/models/model_source_type.py +16 -0
- lightningrod/_generated/models/news_context.py +82 -0
- lightningrod/_generated/models/news_context_generator.py +127 -0
- lightningrod/_generated/models/news_seed_generator.py +220 -0
- lightningrod/_generated/models/paginated_samples_response.py +113 -0
- lightningrod/_generated/models/pipeline_metrics_response.py +99 -0
- lightningrod/_generated/models/question.py +74 -0
- lightningrod/_generated/models/question_and_label_generator.py +217 -0
- lightningrod/_generated/models/question_generator.py +217 -0
- lightningrod/_generated/models/question_pipeline.py +417 -0
- lightningrod/_generated/models/question_renderer.py +123 -0
- lightningrod/_generated/models/rag_context.py +82 -0
- lightningrod/_generated/models/response_message.py +69 -0
- lightningrod/_generated/models/rollout.py +130 -0
- lightningrod/_generated/models/rollout_generator.py +139 -0
- lightningrod/_generated/models/rollout_parsed_output_type_0.py +46 -0
- lightningrod/_generated/models/sample.py +323 -0
- lightningrod/_generated/models/sample_meta.py +46 -0
- lightningrod/_generated/models/seed.py +135 -0
- lightningrod/_generated/models/step_cost_breakdown.py +109 -0
- lightningrod/_generated/models/transform_job.py +268 -0
- lightningrod/_generated/models/transform_job_status.py +11 -0
- lightningrod/_generated/models/transform_step_metrics_response.py +131 -0
- lightningrod/_generated/models/transform_type.py +25 -0
- lightningrod/_generated/models/upload_samples_request.py +75 -0
- lightningrod/_generated/models/upload_samples_response.py +69 -0
- lightningrod/_generated/models/usage.py +77 -0
- lightningrod/_generated/models/usage_summary.py +102 -0
- lightningrod/_generated/models/usage_summary_events.py +59 -0
- lightningrod/_generated/models/usage_summary_llm_by_model.py +59 -0
- lightningrod/_generated/models/validate_sample_response.py +69 -0
- lightningrod/_generated/models/validation_error.py +90 -0
- lightningrod/_generated/models/web_search_labeler.py +120 -0
- lightningrod/_generated/py.typed +1 -0
- lightningrod/_generated/types.py +54 -0
- lightningrod/client.py +48 -0
- lightningrod/datasets/__init__.py +4 -0
- lightningrod/datasets/client.py +174 -0
- lightningrod/datasets/dataset.py +255 -0
- lightningrod/files/__init__.py +0 -0
- lightningrod/files/client.py +58 -0
- lightningrod/filesets/__init__.py +0 -0
- lightningrod/filesets/client.py +106 -0
- lightningrod/organization/__init__.py +0 -0
- lightningrod/organization/client.py +17 -0
- lightningrod/py.typed +0 -0
- lightningrod/transforms/__init__.py +0 -0
- lightningrod/transforms/client.py +154 -0
- lightningrod_ai-0.1.6.dist-info/METADATA +122 -0
- lightningrod_ai-0.1.6.dist-info/RECORD +123 -0
- lightningrod_ai-0.1.6.dist-info/WHEEL +5 -0
- lightningrod_ai-0.1.6.dist-info/licenses/LICENSE +23 -0
- lightningrod_ai-0.1.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import Any, Literal, 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="GdeltSeedGenerator")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class GdeltSeedGenerator:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
start_date (datetime.datetime): Start date for seed search
|
|
21
|
+
end_date (datetime.datetime): End date for seed search
|
|
22
|
+
config_type (Literal['GDELT_SEED_GENERATOR'] | Unset): Type of transform configuration Default:
|
|
23
|
+
'GDELT_SEED_GENERATOR'.
|
|
24
|
+
interval_duration_days (int | Unset): Duration of each interval in days Default: 7.
|
|
25
|
+
articles_per_interval (int | Unset): Number of articles to fetch per interval from BigQuery Default: 1000.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
start_date: datetime.datetime
|
|
29
|
+
end_date: datetime.datetime
|
|
30
|
+
config_type: Literal["GDELT_SEED_GENERATOR"] | Unset = "GDELT_SEED_GENERATOR"
|
|
31
|
+
interval_duration_days: int | Unset = 7
|
|
32
|
+
articles_per_interval: int | Unset = 1000
|
|
33
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
34
|
+
|
|
35
|
+
def to_dict(self) -> dict[str, Any]:
|
|
36
|
+
start_date = self.start_date.isoformat()
|
|
37
|
+
|
|
38
|
+
end_date = self.end_date.isoformat()
|
|
39
|
+
|
|
40
|
+
config_type = self.config_type
|
|
41
|
+
|
|
42
|
+
interval_duration_days = self.interval_duration_days
|
|
43
|
+
|
|
44
|
+
articles_per_interval = self.articles_per_interval
|
|
45
|
+
|
|
46
|
+
field_dict: dict[str, Any] = {}
|
|
47
|
+
field_dict.update(self.additional_properties)
|
|
48
|
+
field_dict.update(
|
|
49
|
+
{
|
|
50
|
+
"start_date": start_date,
|
|
51
|
+
"end_date": end_date,
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
if config_type is not UNSET:
|
|
55
|
+
field_dict["config_type"] = config_type
|
|
56
|
+
if interval_duration_days is not UNSET:
|
|
57
|
+
field_dict["interval_duration_days"] = interval_duration_days
|
|
58
|
+
if articles_per_interval is not UNSET:
|
|
59
|
+
field_dict["articles_per_interval"] = articles_per_interval
|
|
60
|
+
|
|
61
|
+
return field_dict
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
65
|
+
d = dict(src_dict)
|
|
66
|
+
start_date = isoparse(d.pop("start_date"))
|
|
67
|
+
|
|
68
|
+
end_date = isoparse(d.pop("end_date"))
|
|
69
|
+
|
|
70
|
+
config_type = cast(Literal["GDELT_SEED_GENERATOR"] | Unset, d.pop("config_type", UNSET))
|
|
71
|
+
if config_type != "GDELT_SEED_GENERATOR" and not isinstance(config_type, Unset):
|
|
72
|
+
raise ValueError(f"config_type must match const 'GDELT_SEED_GENERATOR', got '{config_type}'")
|
|
73
|
+
|
|
74
|
+
interval_duration_days = d.pop("interval_duration_days", UNSET)
|
|
75
|
+
|
|
76
|
+
articles_per_interval = d.pop("articles_per_interval", UNSET)
|
|
77
|
+
|
|
78
|
+
gdelt_seed_generator = cls(
|
|
79
|
+
start_date=start_date,
|
|
80
|
+
end_date=end_date,
|
|
81
|
+
config_type=config_type,
|
|
82
|
+
interval_duration_days=interval_duration_days,
|
|
83
|
+
articles_per_interval=articles_per_interval,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
gdelt_seed_generator.additional_properties = d
|
|
87
|
+
return gdelt_seed_generator
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def additional_keys(self) -> list[str]:
|
|
91
|
+
return list(self.additional_properties.keys())
|
|
92
|
+
|
|
93
|
+
def __getitem__(self, key: str) -> Any:
|
|
94
|
+
return self.additional_properties[key]
|
|
95
|
+
|
|
96
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
97
|
+
self.additional_properties[key] = value
|
|
98
|
+
|
|
99
|
+
def __delitem__(self, key: str) -> None:
|
|
100
|
+
del self.additional_properties[key]
|
|
101
|
+
|
|
102
|
+
def __contains__(self, key: str) -> bool:
|
|
103
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,79 @@
|
|
|
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 ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from ..models.validation_error import ValidationError
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
T = TypeVar("T", bound="HTTPValidationError")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@_attrs_define
|
|
19
|
+
class HTTPValidationError:
|
|
20
|
+
"""
|
|
21
|
+
Attributes:
|
|
22
|
+
detail (list[ValidationError] | Unset):
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
detail: list[ValidationError] | Unset = UNSET
|
|
26
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
27
|
+
|
|
28
|
+
def to_dict(self) -> dict[str, Any]:
|
|
29
|
+
detail: list[dict[str, Any]] | Unset = UNSET
|
|
30
|
+
if not isinstance(self.detail, Unset):
|
|
31
|
+
detail = []
|
|
32
|
+
for detail_item_data in self.detail:
|
|
33
|
+
detail_item = detail_item_data.to_dict()
|
|
34
|
+
detail.append(detail_item)
|
|
35
|
+
|
|
36
|
+
field_dict: dict[str, Any] = {}
|
|
37
|
+
field_dict.update(self.additional_properties)
|
|
38
|
+
field_dict.update({})
|
|
39
|
+
if detail is not UNSET:
|
|
40
|
+
field_dict["detail"] = detail
|
|
41
|
+
|
|
42
|
+
return field_dict
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
46
|
+
from ..models.validation_error import ValidationError
|
|
47
|
+
|
|
48
|
+
d = dict(src_dict)
|
|
49
|
+
_detail = d.pop("detail", UNSET)
|
|
50
|
+
detail: list[ValidationError] | Unset = UNSET
|
|
51
|
+
if _detail is not UNSET:
|
|
52
|
+
detail = []
|
|
53
|
+
for detail_item_data in _detail:
|
|
54
|
+
detail_item = ValidationError.from_dict(detail_item_data)
|
|
55
|
+
|
|
56
|
+
detail.append(detail_item)
|
|
57
|
+
|
|
58
|
+
http_validation_error = cls(
|
|
59
|
+
detail=detail,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
http_validation_error.additional_properties = d
|
|
63
|
+
return http_validation_error
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def additional_keys(self) -> list[str]:
|
|
67
|
+
return list(self.additional_properties.keys())
|
|
68
|
+
|
|
69
|
+
def __getitem__(self, key: str) -> Any:
|
|
70
|
+
return self.additional_properties[key]
|
|
71
|
+
|
|
72
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
73
|
+
self.additional_properties[key] = value
|
|
74
|
+
|
|
75
|
+
def __delitem__(self, key: str) -> None:
|
|
76
|
+
del self.additional_properties[key]
|
|
77
|
+
|
|
78
|
+
def __contains__(self, key: str) -> bool:
|
|
79
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from ..models.job_usage_by_step_type_0 import JobUsageByStepType0
|
|
13
|
+
from ..models.usage_summary import UsageSummary
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
T = TypeVar("T", bound="JobUsage")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@_attrs_define
|
|
20
|
+
class JobUsage:
|
|
21
|
+
"""Aggregated usage statistics for a transform job with step breakdown.
|
|
22
|
+
|
|
23
|
+
Attributes:
|
|
24
|
+
total (None | Unset | UsageSummary):
|
|
25
|
+
by_step (JobUsageByStepType0 | None | Unset):
|
|
26
|
+
max_cost_dollars (float | None | Unset):
|
|
27
|
+
current_cost_dollars (float | None | Unset):
|
|
28
|
+
estimated_cost_dollars (float | None | Unset):
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
total: None | Unset | UsageSummary = UNSET
|
|
32
|
+
by_step: JobUsageByStepType0 | None | Unset = UNSET
|
|
33
|
+
max_cost_dollars: float | None | Unset = UNSET
|
|
34
|
+
current_cost_dollars: float | None | Unset = UNSET
|
|
35
|
+
estimated_cost_dollars: float | None | Unset = UNSET
|
|
36
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
37
|
+
|
|
38
|
+
def to_dict(self) -> dict[str, Any]:
|
|
39
|
+
from ..models.job_usage_by_step_type_0 import JobUsageByStepType0
|
|
40
|
+
from ..models.usage_summary import UsageSummary
|
|
41
|
+
|
|
42
|
+
total: dict[str, Any] | None | Unset
|
|
43
|
+
if isinstance(self.total, Unset):
|
|
44
|
+
total = UNSET
|
|
45
|
+
elif isinstance(self.total, UsageSummary):
|
|
46
|
+
total = self.total.to_dict()
|
|
47
|
+
else:
|
|
48
|
+
total = self.total
|
|
49
|
+
|
|
50
|
+
by_step: dict[str, Any] | None | Unset
|
|
51
|
+
if isinstance(self.by_step, Unset):
|
|
52
|
+
by_step = UNSET
|
|
53
|
+
elif isinstance(self.by_step, JobUsageByStepType0):
|
|
54
|
+
by_step = self.by_step.to_dict()
|
|
55
|
+
else:
|
|
56
|
+
by_step = self.by_step
|
|
57
|
+
|
|
58
|
+
max_cost_dollars: float | None | Unset
|
|
59
|
+
if isinstance(self.max_cost_dollars, Unset):
|
|
60
|
+
max_cost_dollars = UNSET
|
|
61
|
+
else:
|
|
62
|
+
max_cost_dollars = self.max_cost_dollars
|
|
63
|
+
|
|
64
|
+
current_cost_dollars: float | None | Unset
|
|
65
|
+
if isinstance(self.current_cost_dollars, Unset):
|
|
66
|
+
current_cost_dollars = UNSET
|
|
67
|
+
else:
|
|
68
|
+
current_cost_dollars = self.current_cost_dollars
|
|
69
|
+
|
|
70
|
+
estimated_cost_dollars: float | None | Unset
|
|
71
|
+
if isinstance(self.estimated_cost_dollars, Unset):
|
|
72
|
+
estimated_cost_dollars = UNSET
|
|
73
|
+
else:
|
|
74
|
+
estimated_cost_dollars = self.estimated_cost_dollars
|
|
75
|
+
|
|
76
|
+
field_dict: dict[str, Any] = {}
|
|
77
|
+
field_dict.update(self.additional_properties)
|
|
78
|
+
field_dict.update({})
|
|
79
|
+
if total is not UNSET:
|
|
80
|
+
field_dict["total"] = total
|
|
81
|
+
if by_step is not UNSET:
|
|
82
|
+
field_dict["by_step"] = by_step
|
|
83
|
+
if max_cost_dollars is not UNSET:
|
|
84
|
+
field_dict["max_cost_dollars"] = max_cost_dollars
|
|
85
|
+
if current_cost_dollars is not UNSET:
|
|
86
|
+
field_dict["current_cost_dollars"] = current_cost_dollars
|
|
87
|
+
if estimated_cost_dollars is not UNSET:
|
|
88
|
+
field_dict["estimated_cost_dollars"] = estimated_cost_dollars
|
|
89
|
+
|
|
90
|
+
return field_dict
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
94
|
+
from ..models.job_usage_by_step_type_0 import JobUsageByStepType0
|
|
95
|
+
from ..models.usage_summary import UsageSummary
|
|
96
|
+
|
|
97
|
+
d = dict(src_dict)
|
|
98
|
+
|
|
99
|
+
def _parse_total(data: object) -> None | Unset | UsageSummary:
|
|
100
|
+
if data is None:
|
|
101
|
+
return data
|
|
102
|
+
if isinstance(data, Unset):
|
|
103
|
+
return data
|
|
104
|
+
try:
|
|
105
|
+
if not isinstance(data, dict):
|
|
106
|
+
raise TypeError()
|
|
107
|
+
total_type_0 = UsageSummary.from_dict(data)
|
|
108
|
+
|
|
109
|
+
return total_type_0
|
|
110
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
111
|
+
pass
|
|
112
|
+
return cast(None | Unset | UsageSummary, data)
|
|
113
|
+
|
|
114
|
+
total = _parse_total(d.pop("total", UNSET))
|
|
115
|
+
|
|
116
|
+
def _parse_by_step(data: object) -> JobUsageByStepType0 | None | Unset:
|
|
117
|
+
if data is None:
|
|
118
|
+
return data
|
|
119
|
+
if isinstance(data, Unset):
|
|
120
|
+
return data
|
|
121
|
+
try:
|
|
122
|
+
if not isinstance(data, dict):
|
|
123
|
+
raise TypeError()
|
|
124
|
+
by_step_type_0 = JobUsageByStepType0.from_dict(data)
|
|
125
|
+
|
|
126
|
+
return by_step_type_0
|
|
127
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
128
|
+
pass
|
|
129
|
+
return cast(JobUsageByStepType0 | None | Unset, data)
|
|
130
|
+
|
|
131
|
+
by_step = _parse_by_step(d.pop("by_step", UNSET))
|
|
132
|
+
|
|
133
|
+
def _parse_max_cost_dollars(data: object) -> float | None | Unset:
|
|
134
|
+
if data is None:
|
|
135
|
+
return data
|
|
136
|
+
if isinstance(data, Unset):
|
|
137
|
+
return data
|
|
138
|
+
return cast(float | None | Unset, data)
|
|
139
|
+
|
|
140
|
+
max_cost_dollars = _parse_max_cost_dollars(d.pop("max_cost_dollars", UNSET))
|
|
141
|
+
|
|
142
|
+
def _parse_current_cost_dollars(data: object) -> float | None | Unset:
|
|
143
|
+
if data is None:
|
|
144
|
+
return data
|
|
145
|
+
if isinstance(data, Unset):
|
|
146
|
+
return data
|
|
147
|
+
return cast(float | None | Unset, data)
|
|
148
|
+
|
|
149
|
+
current_cost_dollars = _parse_current_cost_dollars(d.pop("current_cost_dollars", UNSET))
|
|
150
|
+
|
|
151
|
+
def _parse_estimated_cost_dollars(data: object) -> float | None | Unset:
|
|
152
|
+
if data is None:
|
|
153
|
+
return data
|
|
154
|
+
if isinstance(data, Unset):
|
|
155
|
+
return data
|
|
156
|
+
return cast(float | None | Unset, data)
|
|
157
|
+
|
|
158
|
+
estimated_cost_dollars = _parse_estimated_cost_dollars(d.pop("estimated_cost_dollars", UNSET))
|
|
159
|
+
|
|
160
|
+
job_usage = cls(
|
|
161
|
+
total=total,
|
|
162
|
+
by_step=by_step,
|
|
163
|
+
max_cost_dollars=max_cost_dollars,
|
|
164
|
+
current_cost_dollars=current_cost_dollars,
|
|
165
|
+
estimated_cost_dollars=estimated_cost_dollars,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
job_usage.additional_properties = d
|
|
169
|
+
return job_usage
|
|
170
|
+
|
|
171
|
+
@property
|
|
172
|
+
def additional_keys(self) -> list[str]:
|
|
173
|
+
return list(self.additional_properties.keys())
|
|
174
|
+
|
|
175
|
+
def __getitem__(self, key: str) -> Any:
|
|
176
|
+
return self.additional_properties[key]
|
|
177
|
+
|
|
178
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
179
|
+
self.additional_properties[key] = value
|
|
180
|
+
|
|
181
|
+
def __delitem__(self, key: str) -> None:
|
|
182
|
+
del self.additional_properties[key]
|
|
183
|
+
|
|
184
|
+
def __contains__(self, key: str) -> bool:
|
|
185
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.usage_summary import UsageSummary
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="JobUsageByStepType0")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class JobUsageByStepType0:
|
|
18
|
+
""" """
|
|
19
|
+
|
|
20
|
+
additional_properties: dict[str, UsageSummary] = _attrs_field(init=False, factory=dict)
|
|
21
|
+
|
|
22
|
+
def to_dict(self) -> dict[str, Any]:
|
|
23
|
+
field_dict: dict[str, Any] = {}
|
|
24
|
+
for prop_name, prop in self.additional_properties.items():
|
|
25
|
+
field_dict[prop_name] = prop.to_dict()
|
|
26
|
+
|
|
27
|
+
return field_dict
|
|
28
|
+
|
|
29
|
+
@classmethod
|
|
30
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
31
|
+
from ..models.usage_summary import UsageSummary
|
|
32
|
+
|
|
33
|
+
d = dict(src_dict)
|
|
34
|
+
job_usage_by_step_type_0 = cls()
|
|
35
|
+
|
|
36
|
+
additional_properties = {}
|
|
37
|
+
for prop_name, prop_dict in d.items():
|
|
38
|
+
additional_property = UsageSummary.from_dict(prop_dict)
|
|
39
|
+
|
|
40
|
+
additional_properties[prop_name] = additional_property
|
|
41
|
+
|
|
42
|
+
job_usage_by_step_type_0.additional_properties = additional_properties
|
|
43
|
+
return job_usage_by_step_type_0
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def additional_keys(self) -> list[str]:
|
|
47
|
+
return list(self.additional_properties.keys())
|
|
48
|
+
|
|
49
|
+
def __getitem__(self, key: str) -> UsageSummary:
|
|
50
|
+
return self.additional_properties[key]
|
|
51
|
+
|
|
52
|
+
def __setitem__(self, key: str, value: UsageSummary) -> None:
|
|
53
|
+
self.additional_properties[key] = value
|
|
54
|
+
|
|
55
|
+
def __delitem__(self, key: str) -> None:
|
|
56
|
+
del self.additional_properties[key]
|
|
57
|
+
|
|
58
|
+
def __contains__(self, key: str) -> bool:
|
|
59
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,143 @@
|
|
|
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="Label")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class Label:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
label (str):
|
|
21
|
+
label_confidence (float):
|
|
22
|
+
resolution_date (datetime.datetime | None | Unset):
|
|
23
|
+
reasoning (None | str | Unset):
|
|
24
|
+
answer_sources (None | str | Unset):
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
label: str
|
|
28
|
+
label_confidence: float
|
|
29
|
+
resolution_date: datetime.datetime | None | Unset = UNSET
|
|
30
|
+
reasoning: None | str | Unset = UNSET
|
|
31
|
+
answer_sources: None | str | Unset = UNSET
|
|
32
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
33
|
+
|
|
34
|
+
def to_dict(self) -> dict[str, Any]:
|
|
35
|
+
label = self.label
|
|
36
|
+
|
|
37
|
+
label_confidence = self.label_confidence
|
|
38
|
+
|
|
39
|
+
resolution_date: None | str | Unset
|
|
40
|
+
if isinstance(self.resolution_date, Unset):
|
|
41
|
+
resolution_date = UNSET
|
|
42
|
+
elif isinstance(self.resolution_date, datetime.datetime):
|
|
43
|
+
resolution_date = self.resolution_date.isoformat()
|
|
44
|
+
else:
|
|
45
|
+
resolution_date = self.resolution_date
|
|
46
|
+
|
|
47
|
+
reasoning: None | str | Unset
|
|
48
|
+
if isinstance(self.reasoning, Unset):
|
|
49
|
+
reasoning = UNSET
|
|
50
|
+
else:
|
|
51
|
+
reasoning = self.reasoning
|
|
52
|
+
|
|
53
|
+
answer_sources: None | str | Unset
|
|
54
|
+
if isinstance(self.answer_sources, Unset):
|
|
55
|
+
answer_sources = UNSET
|
|
56
|
+
else:
|
|
57
|
+
answer_sources = self.answer_sources
|
|
58
|
+
|
|
59
|
+
field_dict: dict[str, Any] = {}
|
|
60
|
+
field_dict.update(self.additional_properties)
|
|
61
|
+
field_dict.update(
|
|
62
|
+
{
|
|
63
|
+
"label": label,
|
|
64
|
+
"label_confidence": label_confidence,
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
if resolution_date is not UNSET:
|
|
68
|
+
field_dict["resolution_date"] = resolution_date
|
|
69
|
+
if reasoning is not UNSET:
|
|
70
|
+
field_dict["reasoning"] = reasoning
|
|
71
|
+
if answer_sources is not UNSET:
|
|
72
|
+
field_dict["answer_sources"] = answer_sources
|
|
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
|
+
label = d.pop("label")
|
|
80
|
+
|
|
81
|
+
label_confidence = d.pop("label_confidence")
|
|
82
|
+
|
|
83
|
+
def _parse_resolution_date(data: object) -> datetime.datetime | None | Unset:
|
|
84
|
+
if data is None:
|
|
85
|
+
return data
|
|
86
|
+
if isinstance(data, Unset):
|
|
87
|
+
return data
|
|
88
|
+
try:
|
|
89
|
+
if not isinstance(data, str):
|
|
90
|
+
raise TypeError()
|
|
91
|
+
resolution_date_type_0 = isoparse(data)
|
|
92
|
+
|
|
93
|
+
return resolution_date_type_0
|
|
94
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
95
|
+
pass
|
|
96
|
+
return cast(datetime.datetime | None | Unset, data)
|
|
97
|
+
|
|
98
|
+
resolution_date = _parse_resolution_date(d.pop("resolution_date", UNSET))
|
|
99
|
+
|
|
100
|
+
def _parse_reasoning(data: object) -> None | str | Unset:
|
|
101
|
+
if data is None:
|
|
102
|
+
return data
|
|
103
|
+
if isinstance(data, Unset):
|
|
104
|
+
return data
|
|
105
|
+
return cast(None | str | Unset, data)
|
|
106
|
+
|
|
107
|
+
reasoning = _parse_reasoning(d.pop("reasoning", UNSET))
|
|
108
|
+
|
|
109
|
+
def _parse_answer_sources(data: object) -> None | str | Unset:
|
|
110
|
+
if data is None:
|
|
111
|
+
return data
|
|
112
|
+
if isinstance(data, Unset):
|
|
113
|
+
return data
|
|
114
|
+
return cast(None | str | Unset, data)
|
|
115
|
+
|
|
116
|
+
answer_sources = _parse_answer_sources(d.pop("answer_sources", UNSET))
|
|
117
|
+
|
|
118
|
+
label = cls(
|
|
119
|
+
label=label,
|
|
120
|
+
label_confidence=label_confidence,
|
|
121
|
+
resolution_date=resolution_date,
|
|
122
|
+
reasoning=reasoning,
|
|
123
|
+
answer_sources=answer_sources,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
label.additional_properties = d
|
|
127
|
+
return label
|
|
128
|
+
|
|
129
|
+
@property
|
|
130
|
+
def additional_keys(self) -> list[str]:
|
|
131
|
+
return list(self.additional_properties.keys())
|
|
132
|
+
|
|
133
|
+
def __getitem__(self, key: str) -> Any:
|
|
134
|
+
return self.additional_properties[key]
|
|
135
|
+
|
|
136
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
137
|
+
self.additional_properties[key] = value
|
|
138
|
+
|
|
139
|
+
def __delitem__(self, key: str) -> None:
|
|
140
|
+
del self.additional_properties[key]
|
|
141
|
+
|
|
142
|
+
def __contains__(self, key: str) -> bool:
|
|
143
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from ..models.file_set_file import FileSetFile
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
T = TypeVar("T", bound="ListFileSetFilesResponse")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@_attrs_define
|
|
19
|
+
class ListFileSetFilesResponse:
|
|
20
|
+
"""
|
|
21
|
+
Attributes:
|
|
22
|
+
files (list[FileSetFile]):
|
|
23
|
+
has_more (bool):
|
|
24
|
+
total (int):
|
|
25
|
+
next_cursor (None | str | Unset):
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
files: list[FileSetFile]
|
|
29
|
+
has_more: bool
|
|
30
|
+
total: int
|
|
31
|
+
next_cursor: None | str | Unset = UNSET
|
|
32
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
33
|
+
|
|
34
|
+
def to_dict(self) -> dict[str, Any]:
|
|
35
|
+
files = []
|
|
36
|
+
for files_item_data in self.files:
|
|
37
|
+
files_item = files_item_data.to_dict()
|
|
38
|
+
files.append(files_item)
|
|
39
|
+
|
|
40
|
+
has_more = self.has_more
|
|
41
|
+
|
|
42
|
+
total = self.total
|
|
43
|
+
|
|
44
|
+
next_cursor: None | str | Unset
|
|
45
|
+
if isinstance(self.next_cursor, Unset):
|
|
46
|
+
next_cursor = UNSET
|
|
47
|
+
else:
|
|
48
|
+
next_cursor = self.next_cursor
|
|
49
|
+
|
|
50
|
+
field_dict: dict[str, Any] = {}
|
|
51
|
+
field_dict.update(self.additional_properties)
|
|
52
|
+
field_dict.update(
|
|
53
|
+
{
|
|
54
|
+
"files": files,
|
|
55
|
+
"has_more": has_more,
|
|
56
|
+
"total": total,
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
if next_cursor is not UNSET:
|
|
60
|
+
field_dict["next_cursor"] = next_cursor
|
|
61
|
+
|
|
62
|
+
return field_dict
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
66
|
+
from ..models.file_set_file import FileSetFile
|
|
67
|
+
|
|
68
|
+
d = dict(src_dict)
|
|
69
|
+
files = []
|
|
70
|
+
_files = d.pop("files")
|
|
71
|
+
for files_item_data in _files:
|
|
72
|
+
files_item = FileSetFile.from_dict(files_item_data)
|
|
73
|
+
|
|
74
|
+
files.append(files_item)
|
|
75
|
+
|
|
76
|
+
has_more = d.pop("has_more")
|
|
77
|
+
|
|
78
|
+
total = d.pop("total")
|
|
79
|
+
|
|
80
|
+
def _parse_next_cursor(data: object) -> None | str | Unset:
|
|
81
|
+
if data is None:
|
|
82
|
+
return data
|
|
83
|
+
if isinstance(data, Unset):
|
|
84
|
+
return data
|
|
85
|
+
return cast(None | str | Unset, data)
|
|
86
|
+
|
|
87
|
+
next_cursor = _parse_next_cursor(d.pop("next_cursor", UNSET))
|
|
88
|
+
|
|
89
|
+
list_file_set_files_response = cls(
|
|
90
|
+
files=files,
|
|
91
|
+
has_more=has_more,
|
|
92
|
+
total=total,
|
|
93
|
+
next_cursor=next_cursor,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
list_file_set_files_response.additional_properties = d
|
|
97
|
+
return list_file_set_files_response
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def additional_keys(self) -> list[str]:
|
|
101
|
+
return list(self.additional_properties.keys())
|
|
102
|
+
|
|
103
|
+
def __getitem__(self, key: str) -> Any:
|
|
104
|
+
return self.additional_properties[key]
|
|
105
|
+
|
|
106
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
107
|
+
self.additional_properties[key] = value
|
|
108
|
+
|
|
109
|
+
def __delitem__(self, key: str) -> None:
|
|
110
|
+
del self.additional_properties[key]
|
|
111
|
+
|
|
112
|
+
def __contains__(self, key: str) -> bool:
|
|
113
|
+
return key in self.additional_properties
|