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,75 @@
|
|
|
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.file_set import FileSet
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="ListFileSetsResponse")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class ListFileSetsResponse:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
file_sets (list[FileSet]):
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
file_sets: list[FileSet]
|
|
24
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
25
|
+
|
|
26
|
+
def to_dict(self) -> dict[str, Any]:
|
|
27
|
+
file_sets = []
|
|
28
|
+
for file_sets_item_data in self.file_sets:
|
|
29
|
+
file_sets_item = file_sets_item_data.to_dict()
|
|
30
|
+
file_sets.append(file_sets_item)
|
|
31
|
+
|
|
32
|
+
field_dict: dict[str, Any] = {}
|
|
33
|
+
field_dict.update(self.additional_properties)
|
|
34
|
+
field_dict.update(
|
|
35
|
+
{
|
|
36
|
+
"file_sets": file_sets,
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return field_dict
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
44
|
+
from ..models.file_set import FileSet
|
|
45
|
+
|
|
46
|
+
d = dict(src_dict)
|
|
47
|
+
file_sets = []
|
|
48
|
+
_file_sets = d.pop("file_sets")
|
|
49
|
+
for file_sets_item_data in _file_sets:
|
|
50
|
+
file_sets_item = FileSet.from_dict(file_sets_item_data)
|
|
51
|
+
|
|
52
|
+
file_sets.append(file_sets_item)
|
|
53
|
+
|
|
54
|
+
list_file_sets_response = cls(
|
|
55
|
+
file_sets=file_sets,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
list_file_sets_response.additional_properties = d
|
|
59
|
+
return list_file_sets_response
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def additional_keys(self) -> list[str]:
|
|
63
|
+
return list(self.additional_properties.keys())
|
|
64
|
+
|
|
65
|
+
def __getitem__(self, key: str) -> Any:
|
|
66
|
+
return self.additional_properties[key]
|
|
67
|
+
|
|
68
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
69
|
+
self.additional_properties[key] = value
|
|
70
|
+
|
|
71
|
+
def __delitem__(self, key: str) -> None:
|
|
72
|
+
del self.additional_properties[key]
|
|
73
|
+
|
|
74
|
+
def __contains__(self, key: str) -> bool:
|
|
75
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import 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
|
+
T = TypeVar("T", bound="LLMModelUsageSummary")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class LLMModelUsageSummary:
|
|
16
|
+
"""Usage for a single LLM model.
|
|
17
|
+
|
|
18
|
+
Attributes:
|
|
19
|
+
count (int | Unset): Default: 0.
|
|
20
|
+
input_tokens (int | Unset): Default: 0.
|
|
21
|
+
output_tokens (int | Unset): Default: 0.
|
|
22
|
+
cost (float | Unset): Default: 0.0.
|
|
23
|
+
cached_count (int | Unset): Default: 0.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
count: int | Unset = 0
|
|
27
|
+
input_tokens: int | Unset = 0
|
|
28
|
+
output_tokens: int | Unset = 0
|
|
29
|
+
cost: float | Unset = 0.0
|
|
30
|
+
cached_count: int | Unset = 0
|
|
31
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
32
|
+
|
|
33
|
+
def to_dict(self) -> dict[str, Any]:
|
|
34
|
+
count = self.count
|
|
35
|
+
|
|
36
|
+
input_tokens = self.input_tokens
|
|
37
|
+
|
|
38
|
+
output_tokens = self.output_tokens
|
|
39
|
+
|
|
40
|
+
cost = self.cost
|
|
41
|
+
|
|
42
|
+
cached_count = self.cached_count
|
|
43
|
+
|
|
44
|
+
field_dict: dict[str, Any] = {}
|
|
45
|
+
field_dict.update(self.additional_properties)
|
|
46
|
+
field_dict.update({})
|
|
47
|
+
if count is not UNSET:
|
|
48
|
+
field_dict["count"] = count
|
|
49
|
+
if input_tokens is not UNSET:
|
|
50
|
+
field_dict["input_tokens"] = input_tokens
|
|
51
|
+
if output_tokens is not UNSET:
|
|
52
|
+
field_dict["output_tokens"] = output_tokens
|
|
53
|
+
if cost is not UNSET:
|
|
54
|
+
field_dict["cost"] = cost
|
|
55
|
+
if cached_count is not UNSET:
|
|
56
|
+
field_dict["cached_count"] = cached_count
|
|
57
|
+
|
|
58
|
+
return field_dict
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
62
|
+
d = dict(src_dict)
|
|
63
|
+
count = d.pop("count", UNSET)
|
|
64
|
+
|
|
65
|
+
input_tokens = d.pop("input_tokens", UNSET)
|
|
66
|
+
|
|
67
|
+
output_tokens = d.pop("output_tokens", UNSET)
|
|
68
|
+
|
|
69
|
+
cost = d.pop("cost", UNSET)
|
|
70
|
+
|
|
71
|
+
cached_count = d.pop("cached_count", UNSET)
|
|
72
|
+
|
|
73
|
+
llm_model_usage_summary = cls(
|
|
74
|
+
count=count,
|
|
75
|
+
input_tokens=input_tokens,
|
|
76
|
+
output_tokens=output_tokens,
|
|
77
|
+
cost=cost,
|
|
78
|
+
cached_count=cached_count,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
llm_model_usage_summary.additional_properties = d
|
|
82
|
+
return llm_model_usage_summary
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def additional_keys(self) -> list[str]:
|
|
86
|
+
return list(self.additional_properties.keys())
|
|
87
|
+
|
|
88
|
+
def __getitem__(self, key: str) -> Any:
|
|
89
|
+
return self.additional_properties[key]
|
|
90
|
+
|
|
91
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
92
|
+
self.additional_properties[key] = value
|
|
93
|
+
|
|
94
|
+
def __delitem__(self, key: str) -> None:
|
|
95
|
+
del self.additional_properties[key]
|
|
96
|
+
|
|
97
|
+
def __contains__(self, key: str) -> bool:
|
|
98
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, Literal, 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.mock_transform_config_metadata_additions import MockTransformConfigMetadataAdditions
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
T = TypeVar("T", bound="MockTransformConfig")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@_attrs_define
|
|
19
|
+
class MockTransformConfig:
|
|
20
|
+
"""
|
|
21
|
+
Attributes:
|
|
22
|
+
config_type (Literal['MOCK'] | Unset): Default: 'MOCK'.
|
|
23
|
+
num_seeds (int | Unset): Number of mock seeds to generate (0 = not a seed generator) Default: 0.
|
|
24
|
+
seed_text_template (str | Unset): Template for seed text Default: 'Mock seed content {index}'.
|
|
25
|
+
delay_seconds (float | Unset): Simulated processing time per item Default: 0.1.
|
|
26
|
+
delay_variance (float | Unset): Random variance (+/- seconds) Default: 0.05.
|
|
27
|
+
error_rate (float | Unset): Probability of error (0.0-1.0) Default: 0.01.
|
|
28
|
+
error_message (str | Unset): Error message when error_rate triggers Default: 'Mock error'.
|
|
29
|
+
expansion_factor (int | Unset): Outputs per input (1:N expansion) Default: 1.
|
|
30
|
+
filter_rate (float | Unset): Probability of marking invalid Default: 0.0.
|
|
31
|
+
add_question (bool | Unset): Add a mock question to samples Default: False.
|
|
32
|
+
question_template (str | Unset): Template for question text Default: 'Mock question {index}?'.
|
|
33
|
+
metadata_additions (MockTransformConfigMetadataAdditions | Unset): Added to sample.meta
|
|
34
|
+
estimated_input_tokens (int | Unset): Estimated input tokens per call Default: 0.
|
|
35
|
+
estimated_output_tokens (int | Unset): Estimated output tokens per call Default: 0.
|
|
36
|
+
estimated_model_name (None | str | Unset): Model name for cost estimation
|
|
37
|
+
simulated_cost_per_call (float | Unset): Simulated cost per call in dollars (records usage event when > 0)
|
|
38
|
+
Default: 0.0.
|
|
39
|
+
random_seed (int | None | Unset): Seed for deterministic behavior
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
config_type: Literal["MOCK"] | Unset = "MOCK"
|
|
43
|
+
num_seeds: int | Unset = 0
|
|
44
|
+
seed_text_template: str | Unset = "Mock seed content {index}"
|
|
45
|
+
delay_seconds: float | Unset = 0.1
|
|
46
|
+
delay_variance: float | Unset = 0.05
|
|
47
|
+
error_rate: float | Unset = 0.01
|
|
48
|
+
error_message: str | Unset = "Mock error"
|
|
49
|
+
expansion_factor: int | Unset = 1
|
|
50
|
+
filter_rate: float | Unset = 0.0
|
|
51
|
+
add_question: bool | Unset = False
|
|
52
|
+
question_template: str | Unset = "Mock question {index}?"
|
|
53
|
+
metadata_additions: MockTransformConfigMetadataAdditions | Unset = UNSET
|
|
54
|
+
estimated_input_tokens: int | Unset = 0
|
|
55
|
+
estimated_output_tokens: int | Unset = 0
|
|
56
|
+
estimated_model_name: None | str | Unset = UNSET
|
|
57
|
+
simulated_cost_per_call: float | Unset = 0.0
|
|
58
|
+
random_seed: int | None | Unset = UNSET
|
|
59
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> dict[str, Any]:
|
|
62
|
+
config_type = self.config_type
|
|
63
|
+
|
|
64
|
+
num_seeds = self.num_seeds
|
|
65
|
+
|
|
66
|
+
seed_text_template = self.seed_text_template
|
|
67
|
+
|
|
68
|
+
delay_seconds = self.delay_seconds
|
|
69
|
+
|
|
70
|
+
delay_variance = self.delay_variance
|
|
71
|
+
|
|
72
|
+
error_rate = self.error_rate
|
|
73
|
+
|
|
74
|
+
error_message = self.error_message
|
|
75
|
+
|
|
76
|
+
expansion_factor = self.expansion_factor
|
|
77
|
+
|
|
78
|
+
filter_rate = self.filter_rate
|
|
79
|
+
|
|
80
|
+
add_question = self.add_question
|
|
81
|
+
|
|
82
|
+
question_template = self.question_template
|
|
83
|
+
|
|
84
|
+
metadata_additions: dict[str, Any] | Unset = UNSET
|
|
85
|
+
if not isinstance(self.metadata_additions, Unset):
|
|
86
|
+
metadata_additions = self.metadata_additions.to_dict()
|
|
87
|
+
|
|
88
|
+
estimated_input_tokens = self.estimated_input_tokens
|
|
89
|
+
|
|
90
|
+
estimated_output_tokens = self.estimated_output_tokens
|
|
91
|
+
|
|
92
|
+
estimated_model_name: None | str | Unset
|
|
93
|
+
if isinstance(self.estimated_model_name, Unset):
|
|
94
|
+
estimated_model_name = UNSET
|
|
95
|
+
else:
|
|
96
|
+
estimated_model_name = self.estimated_model_name
|
|
97
|
+
|
|
98
|
+
simulated_cost_per_call = self.simulated_cost_per_call
|
|
99
|
+
|
|
100
|
+
random_seed: int | None | Unset
|
|
101
|
+
if isinstance(self.random_seed, Unset):
|
|
102
|
+
random_seed = UNSET
|
|
103
|
+
else:
|
|
104
|
+
random_seed = self.random_seed
|
|
105
|
+
|
|
106
|
+
field_dict: dict[str, Any] = {}
|
|
107
|
+
field_dict.update(self.additional_properties)
|
|
108
|
+
field_dict.update({})
|
|
109
|
+
if config_type is not UNSET:
|
|
110
|
+
field_dict["config_type"] = config_type
|
|
111
|
+
if num_seeds is not UNSET:
|
|
112
|
+
field_dict["num_seeds"] = num_seeds
|
|
113
|
+
if seed_text_template is not UNSET:
|
|
114
|
+
field_dict["seed_text_template"] = seed_text_template
|
|
115
|
+
if delay_seconds is not UNSET:
|
|
116
|
+
field_dict["delay_seconds"] = delay_seconds
|
|
117
|
+
if delay_variance is not UNSET:
|
|
118
|
+
field_dict["delay_variance"] = delay_variance
|
|
119
|
+
if error_rate is not UNSET:
|
|
120
|
+
field_dict["error_rate"] = error_rate
|
|
121
|
+
if error_message is not UNSET:
|
|
122
|
+
field_dict["error_message"] = error_message
|
|
123
|
+
if expansion_factor is not UNSET:
|
|
124
|
+
field_dict["expansion_factor"] = expansion_factor
|
|
125
|
+
if filter_rate is not UNSET:
|
|
126
|
+
field_dict["filter_rate"] = filter_rate
|
|
127
|
+
if add_question is not UNSET:
|
|
128
|
+
field_dict["add_question"] = add_question
|
|
129
|
+
if question_template is not UNSET:
|
|
130
|
+
field_dict["question_template"] = question_template
|
|
131
|
+
if metadata_additions is not UNSET:
|
|
132
|
+
field_dict["metadata_additions"] = metadata_additions
|
|
133
|
+
if estimated_input_tokens is not UNSET:
|
|
134
|
+
field_dict["estimated_input_tokens"] = estimated_input_tokens
|
|
135
|
+
if estimated_output_tokens is not UNSET:
|
|
136
|
+
field_dict["estimated_output_tokens"] = estimated_output_tokens
|
|
137
|
+
if estimated_model_name is not UNSET:
|
|
138
|
+
field_dict["estimated_model_name"] = estimated_model_name
|
|
139
|
+
if simulated_cost_per_call is not UNSET:
|
|
140
|
+
field_dict["simulated_cost_per_call"] = simulated_cost_per_call
|
|
141
|
+
if random_seed is not UNSET:
|
|
142
|
+
field_dict["random_seed"] = random_seed
|
|
143
|
+
|
|
144
|
+
return field_dict
|
|
145
|
+
|
|
146
|
+
@classmethod
|
|
147
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
148
|
+
from ..models.mock_transform_config_metadata_additions import MockTransformConfigMetadataAdditions
|
|
149
|
+
|
|
150
|
+
d = dict(src_dict)
|
|
151
|
+
config_type = cast(Literal["MOCK"] | Unset, d.pop("config_type", UNSET))
|
|
152
|
+
if config_type != "MOCK" and not isinstance(config_type, Unset):
|
|
153
|
+
raise ValueError(f"config_type must match const 'MOCK', got '{config_type}'")
|
|
154
|
+
|
|
155
|
+
num_seeds = d.pop("num_seeds", UNSET)
|
|
156
|
+
|
|
157
|
+
seed_text_template = d.pop("seed_text_template", UNSET)
|
|
158
|
+
|
|
159
|
+
delay_seconds = d.pop("delay_seconds", UNSET)
|
|
160
|
+
|
|
161
|
+
delay_variance = d.pop("delay_variance", UNSET)
|
|
162
|
+
|
|
163
|
+
error_rate = d.pop("error_rate", UNSET)
|
|
164
|
+
|
|
165
|
+
error_message = d.pop("error_message", UNSET)
|
|
166
|
+
|
|
167
|
+
expansion_factor = d.pop("expansion_factor", UNSET)
|
|
168
|
+
|
|
169
|
+
filter_rate = d.pop("filter_rate", UNSET)
|
|
170
|
+
|
|
171
|
+
add_question = d.pop("add_question", UNSET)
|
|
172
|
+
|
|
173
|
+
question_template = d.pop("question_template", UNSET)
|
|
174
|
+
|
|
175
|
+
_metadata_additions = d.pop("metadata_additions", UNSET)
|
|
176
|
+
metadata_additions: MockTransformConfigMetadataAdditions | Unset
|
|
177
|
+
if isinstance(_metadata_additions, Unset):
|
|
178
|
+
metadata_additions = UNSET
|
|
179
|
+
else:
|
|
180
|
+
metadata_additions = MockTransformConfigMetadataAdditions.from_dict(_metadata_additions)
|
|
181
|
+
|
|
182
|
+
estimated_input_tokens = d.pop("estimated_input_tokens", UNSET)
|
|
183
|
+
|
|
184
|
+
estimated_output_tokens = d.pop("estimated_output_tokens", UNSET)
|
|
185
|
+
|
|
186
|
+
def _parse_estimated_model_name(data: object) -> None | str | Unset:
|
|
187
|
+
if data is None:
|
|
188
|
+
return data
|
|
189
|
+
if isinstance(data, Unset):
|
|
190
|
+
return data
|
|
191
|
+
return cast(None | str | Unset, data)
|
|
192
|
+
|
|
193
|
+
estimated_model_name = _parse_estimated_model_name(d.pop("estimated_model_name", UNSET))
|
|
194
|
+
|
|
195
|
+
simulated_cost_per_call = d.pop("simulated_cost_per_call", UNSET)
|
|
196
|
+
|
|
197
|
+
def _parse_random_seed(data: object) -> int | None | Unset:
|
|
198
|
+
if data is None:
|
|
199
|
+
return data
|
|
200
|
+
if isinstance(data, Unset):
|
|
201
|
+
return data
|
|
202
|
+
return cast(int | None | Unset, data)
|
|
203
|
+
|
|
204
|
+
random_seed = _parse_random_seed(d.pop("random_seed", UNSET))
|
|
205
|
+
|
|
206
|
+
mock_transform_config = cls(
|
|
207
|
+
config_type=config_type,
|
|
208
|
+
num_seeds=num_seeds,
|
|
209
|
+
seed_text_template=seed_text_template,
|
|
210
|
+
delay_seconds=delay_seconds,
|
|
211
|
+
delay_variance=delay_variance,
|
|
212
|
+
error_rate=error_rate,
|
|
213
|
+
error_message=error_message,
|
|
214
|
+
expansion_factor=expansion_factor,
|
|
215
|
+
filter_rate=filter_rate,
|
|
216
|
+
add_question=add_question,
|
|
217
|
+
question_template=question_template,
|
|
218
|
+
metadata_additions=metadata_additions,
|
|
219
|
+
estimated_input_tokens=estimated_input_tokens,
|
|
220
|
+
estimated_output_tokens=estimated_output_tokens,
|
|
221
|
+
estimated_model_name=estimated_model_name,
|
|
222
|
+
simulated_cost_per_call=simulated_cost_per_call,
|
|
223
|
+
random_seed=random_seed,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
mock_transform_config.additional_properties = d
|
|
227
|
+
return mock_transform_config
|
|
228
|
+
|
|
229
|
+
@property
|
|
230
|
+
def additional_keys(self) -> list[str]:
|
|
231
|
+
return list(self.additional_properties.keys())
|
|
232
|
+
|
|
233
|
+
def __getitem__(self, key: str) -> Any:
|
|
234
|
+
return self.additional_properties[key]
|
|
235
|
+
|
|
236
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
237
|
+
self.additional_properties[key] = value
|
|
238
|
+
|
|
239
|
+
def __delitem__(self, key: str) -> None:
|
|
240
|
+
del self.additional_properties[key]
|
|
241
|
+
|
|
242
|
+
def __contains__(self, key: str) -> bool:
|
|
243
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
T = TypeVar("T", bound="MockTransformConfigMetadataAdditions")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class MockTransformConfigMetadataAdditions:
|
|
14
|
+
"""Added to sample.meta"""
|
|
15
|
+
|
|
16
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
17
|
+
|
|
18
|
+
def to_dict(self) -> dict[str, Any]:
|
|
19
|
+
field_dict: dict[str, Any] = {}
|
|
20
|
+
field_dict.update(self.additional_properties)
|
|
21
|
+
|
|
22
|
+
return field_dict
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
26
|
+
d = dict(src_dict)
|
|
27
|
+
mock_transform_config_metadata_additions = cls()
|
|
28
|
+
|
|
29
|
+
mock_transform_config_metadata_additions.additional_properties = d
|
|
30
|
+
return mock_transform_config_metadata_additions
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def additional_keys(self) -> list[str]:
|
|
34
|
+
return list(self.additional_properties.keys())
|
|
35
|
+
|
|
36
|
+
def __getitem__(self, key: str) -> Any:
|
|
37
|
+
return self.additional_properties[key]
|
|
38
|
+
|
|
39
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
40
|
+
self.additional_properties[key] = value
|
|
41
|
+
|
|
42
|
+
def __delitem__(self, key: str) -> None:
|
|
43
|
+
del self.additional_properties[key]
|
|
44
|
+
|
|
45
|
+
def __contains__(self, key: str) -> bool:
|
|
46
|
+
return key in self.additional_properties
|