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,117 @@
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.step_cost_breakdown import StepCostBreakdown
11
+ from ..models.usage_summary import UsageSummary
12
+
13
+
14
+ T = TypeVar("T", bound="EstimateCostResponse")
15
+
16
+
17
+ @_attrs_define
18
+ class EstimateCostResponse:
19
+ """
20
+ Attributes:
21
+ total_cost_dollars (float):
22
+ llm_cost_dollars (float):
23
+ web_search_cost_dollars (float):
24
+ url_download_cost_dollars (float):
25
+ usage (UsageSummary): Flexible usage statistics by event type and LLM model.
26
+ steps (list[StepCostBreakdown]):
27
+ """
28
+
29
+ total_cost_dollars: float
30
+ llm_cost_dollars: float
31
+ web_search_cost_dollars: float
32
+ url_download_cost_dollars: float
33
+ usage: UsageSummary
34
+ steps: list[StepCostBreakdown]
35
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
36
+
37
+ def to_dict(self) -> dict[str, Any]:
38
+ total_cost_dollars = self.total_cost_dollars
39
+
40
+ llm_cost_dollars = self.llm_cost_dollars
41
+
42
+ web_search_cost_dollars = self.web_search_cost_dollars
43
+
44
+ url_download_cost_dollars = self.url_download_cost_dollars
45
+
46
+ usage = self.usage.to_dict()
47
+
48
+ steps = []
49
+ for steps_item_data in self.steps:
50
+ steps_item = steps_item_data.to_dict()
51
+ steps.append(steps_item)
52
+
53
+ field_dict: dict[str, Any] = {}
54
+ field_dict.update(self.additional_properties)
55
+ field_dict.update(
56
+ {
57
+ "total_cost_dollars": total_cost_dollars,
58
+ "llm_cost_dollars": llm_cost_dollars,
59
+ "web_search_cost_dollars": web_search_cost_dollars,
60
+ "url_download_cost_dollars": url_download_cost_dollars,
61
+ "usage": usage,
62
+ "steps": steps,
63
+ }
64
+ )
65
+
66
+ return field_dict
67
+
68
+ @classmethod
69
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
70
+ from ..models.step_cost_breakdown import StepCostBreakdown
71
+ from ..models.usage_summary import UsageSummary
72
+
73
+ d = dict(src_dict)
74
+ total_cost_dollars = d.pop("total_cost_dollars")
75
+
76
+ llm_cost_dollars = d.pop("llm_cost_dollars")
77
+
78
+ web_search_cost_dollars = d.pop("web_search_cost_dollars")
79
+
80
+ url_download_cost_dollars = d.pop("url_download_cost_dollars")
81
+
82
+ usage = UsageSummary.from_dict(d.pop("usage"))
83
+
84
+ steps = []
85
+ _steps = d.pop("steps")
86
+ for steps_item_data in _steps:
87
+ steps_item = StepCostBreakdown.from_dict(steps_item_data)
88
+
89
+ steps.append(steps_item)
90
+
91
+ estimate_cost_response = cls(
92
+ total_cost_dollars=total_cost_dollars,
93
+ llm_cost_dollars=llm_cost_dollars,
94
+ web_search_cost_dollars=web_search_cost_dollars,
95
+ url_download_cost_dollars=url_download_cost_dollars,
96
+ usage=usage,
97
+ steps=steps,
98
+ )
99
+
100
+ estimate_cost_response.additional_properties = d
101
+ return estimate_cost_response
102
+
103
+ @property
104
+ def additional_keys(self) -> list[str]:
105
+ return list(self.additional_properties.keys())
106
+
107
+ def __getitem__(self, key: str) -> Any:
108
+ return self.additional_properties[key]
109
+
110
+ def __setitem__(self, key: str, value: Any) -> None:
111
+ self.additional_properties[key] = value
112
+
113
+ def __delitem__(self, key: str) -> None:
114
+ del self.additional_properties[key]
115
+
116
+ def __contains__(self, key: str) -> bool:
117
+ return key in self.additional_properties
@@ -0,0 +1,80 @@
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="EventUsageSummary")
12
+
13
+
14
+ @_attrs_define
15
+ class EventUsageSummary:
16
+ """Usage for a single event type.
17
+
18
+ Attributes:
19
+ count (int | Unset): Default: 0.
20
+ cost (float | Unset): Default: 0.0.
21
+ cached_count (int | Unset): Default: 0.
22
+ """
23
+
24
+ count: int | Unset = 0
25
+ cost: float | Unset = 0.0
26
+ cached_count: int | Unset = 0
27
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
+
29
+ def to_dict(self) -> dict[str, Any]:
30
+ count = self.count
31
+
32
+ cost = self.cost
33
+
34
+ cached_count = self.cached_count
35
+
36
+ field_dict: dict[str, Any] = {}
37
+ field_dict.update(self.additional_properties)
38
+ field_dict.update({})
39
+ if count is not UNSET:
40
+ field_dict["count"] = count
41
+ if cost is not UNSET:
42
+ field_dict["cost"] = cost
43
+ if cached_count is not UNSET:
44
+ field_dict["cached_count"] = cached_count
45
+
46
+ return field_dict
47
+
48
+ @classmethod
49
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
50
+ d = dict(src_dict)
51
+ count = d.pop("count", UNSET)
52
+
53
+ cost = d.pop("cost", UNSET)
54
+
55
+ cached_count = d.pop("cached_count", UNSET)
56
+
57
+ event_usage_summary = cls(
58
+ count=count,
59
+ cost=cost,
60
+ cached_count=cached_count,
61
+ )
62
+
63
+ event_usage_summary.additional_properties = d
64
+ return event_usage_summary
65
+
66
+ @property
67
+ def additional_keys(self) -> list[str]:
68
+ return list(self.additional_properties.keys())
69
+
70
+ def __getitem__(self, key: str) -> Any:
71
+ return self.additional_properties[key]
72
+
73
+ def __setitem__(self, key: str, value: Any) -> None:
74
+ self.additional_properties[key] = value
75
+
76
+ def __delitem__(self, key: str) -> None:
77
+ del self.additional_properties[key]
78
+
79
+ def __contains__(self, key: str) -> bool:
80
+ return key in self.additional_properties
@@ -0,0 +1,128 @@
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="FileSet")
14
+
15
+
16
+ @_attrs_define
17
+ class FileSet:
18
+ """
19
+ Attributes:
20
+ id (str):
21
+ name (str):
22
+ description (None | str):
23
+ file_count (int):
24
+ indexed_file_count (int):
25
+ created_at (datetime.datetime):
26
+ updated_at (datetime.datetime):
27
+ is_public (bool | Unset): Default: False.
28
+ """
29
+
30
+ id: str
31
+ name: str
32
+ description: None | str
33
+ file_count: int
34
+ indexed_file_count: int
35
+ created_at: datetime.datetime
36
+ updated_at: datetime.datetime
37
+ is_public: bool | Unset = False
38
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
39
+
40
+ def to_dict(self) -> dict[str, Any]:
41
+ id = self.id
42
+
43
+ name = self.name
44
+
45
+ description: None | str
46
+ description = self.description
47
+
48
+ file_count = self.file_count
49
+
50
+ indexed_file_count = self.indexed_file_count
51
+
52
+ created_at = self.created_at.isoformat()
53
+
54
+ updated_at = self.updated_at.isoformat()
55
+
56
+ is_public = self.is_public
57
+
58
+ field_dict: dict[str, Any] = {}
59
+ field_dict.update(self.additional_properties)
60
+ field_dict.update(
61
+ {
62
+ "id": id,
63
+ "name": name,
64
+ "description": description,
65
+ "file_count": file_count,
66
+ "indexed_file_count": indexed_file_count,
67
+ "created_at": created_at,
68
+ "updated_at": updated_at,
69
+ }
70
+ )
71
+ if is_public is not UNSET:
72
+ field_dict["is_public"] = is_public
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
+ id = d.pop("id")
80
+
81
+ name = d.pop("name")
82
+
83
+ def _parse_description(data: object) -> None | str:
84
+ if data is None:
85
+ return data
86
+ return cast(None | str, data)
87
+
88
+ description = _parse_description(d.pop("description"))
89
+
90
+ file_count = d.pop("file_count")
91
+
92
+ indexed_file_count = d.pop("indexed_file_count")
93
+
94
+ created_at = isoparse(d.pop("created_at"))
95
+
96
+ updated_at = isoparse(d.pop("updated_at"))
97
+
98
+ is_public = d.pop("is_public", UNSET)
99
+
100
+ file_set = cls(
101
+ id=id,
102
+ name=name,
103
+ description=description,
104
+ file_count=file_count,
105
+ indexed_file_count=indexed_file_count,
106
+ created_at=created_at,
107
+ updated_at=updated_at,
108
+ is_public=is_public,
109
+ )
110
+
111
+ file_set.additional_properties = d
112
+ return file_set
113
+
114
+ @property
115
+ def additional_keys(self) -> list[str]:
116
+ return list(self.additional_properties.keys())
117
+
118
+ def __getitem__(self, key: str) -> Any:
119
+ return self.additional_properties[key]
120
+
121
+ def __setitem__(self, key: str, value: Any) -> None:
122
+ self.additional_properties[key] = value
123
+
124
+ def __delitem__(self, key: str) -> None:
125
+ del self.additional_properties[key]
126
+
127
+ def __contains__(self, key: str) -> bool:
128
+ return key in self.additional_properties
@@ -0,0 +1,203 @@
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
+ if TYPE_CHECKING:
12
+ from ..models.file_set_file_metadata_type_0 import FileSetFileMetadataType0
13
+
14
+
15
+ T = TypeVar("T", bound="FileSetFile")
16
+
17
+
18
+ @_attrs_define
19
+ class FileSetFile:
20
+ """
21
+ Attributes:
22
+ id (str):
23
+ original_file_name (str):
24
+ cloud_storage_path (str):
25
+ mime_type (None | str):
26
+ size_bytes (int):
27
+ character_count (int | None):
28
+ metadata (FileSetFileMetadataType0 | None):
29
+ gemini_file_id (None | str):
30
+ file_created_date (datetime.datetime | None):
31
+ created_at (datetime.datetime):
32
+ updated_at (datetime.datetime):
33
+ """
34
+
35
+ id: str
36
+ original_file_name: str
37
+ cloud_storage_path: str
38
+ mime_type: None | str
39
+ size_bytes: int
40
+ character_count: int | None
41
+ metadata: FileSetFileMetadataType0 | None
42
+ gemini_file_id: None | str
43
+ file_created_date: datetime.datetime | None
44
+ created_at: datetime.datetime
45
+ updated_at: datetime.datetime
46
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
47
+
48
+ def to_dict(self) -> dict[str, Any]:
49
+ from ..models.file_set_file_metadata_type_0 import FileSetFileMetadataType0
50
+
51
+ id = self.id
52
+
53
+ original_file_name = self.original_file_name
54
+
55
+ cloud_storage_path = self.cloud_storage_path
56
+
57
+ mime_type: None | str
58
+ mime_type = self.mime_type
59
+
60
+ size_bytes = self.size_bytes
61
+
62
+ character_count: int | None
63
+ character_count = self.character_count
64
+
65
+ metadata: dict[str, Any] | None
66
+ if isinstance(self.metadata, FileSetFileMetadataType0):
67
+ metadata = self.metadata.to_dict()
68
+ else:
69
+ metadata = self.metadata
70
+
71
+ gemini_file_id: None | str
72
+ gemini_file_id = self.gemini_file_id
73
+
74
+ file_created_date: None | str
75
+ if isinstance(self.file_created_date, datetime.datetime):
76
+ file_created_date = self.file_created_date.isoformat()
77
+ else:
78
+ file_created_date = self.file_created_date
79
+
80
+ created_at = self.created_at.isoformat()
81
+
82
+ updated_at = self.updated_at.isoformat()
83
+
84
+ field_dict: dict[str, Any] = {}
85
+ field_dict.update(self.additional_properties)
86
+ field_dict.update(
87
+ {
88
+ "id": id,
89
+ "original_file_name": original_file_name,
90
+ "cloud_storage_path": cloud_storage_path,
91
+ "mime_type": mime_type,
92
+ "size_bytes": size_bytes,
93
+ "character_count": character_count,
94
+ "metadata": metadata,
95
+ "gemini_file_id": gemini_file_id,
96
+ "file_created_date": file_created_date,
97
+ "created_at": created_at,
98
+ "updated_at": updated_at,
99
+ }
100
+ )
101
+
102
+ return field_dict
103
+
104
+ @classmethod
105
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
106
+ from ..models.file_set_file_metadata_type_0 import FileSetFileMetadataType0
107
+
108
+ d = dict(src_dict)
109
+ id = d.pop("id")
110
+
111
+ original_file_name = d.pop("original_file_name")
112
+
113
+ cloud_storage_path = d.pop("cloud_storage_path")
114
+
115
+ def _parse_mime_type(data: object) -> None | str:
116
+ if data is None:
117
+ return data
118
+ return cast(None | str, data)
119
+
120
+ mime_type = _parse_mime_type(d.pop("mime_type"))
121
+
122
+ size_bytes = d.pop("size_bytes")
123
+
124
+ def _parse_character_count(data: object) -> int | None:
125
+ if data is None:
126
+ return data
127
+ return cast(int | None, data)
128
+
129
+ character_count = _parse_character_count(d.pop("character_count"))
130
+
131
+ def _parse_metadata(data: object) -> FileSetFileMetadataType0 | None:
132
+ if data is None:
133
+ return data
134
+ try:
135
+ if not isinstance(data, dict):
136
+ raise TypeError()
137
+ metadata_type_0 = FileSetFileMetadataType0.from_dict(data)
138
+
139
+ return metadata_type_0
140
+ except (TypeError, ValueError, AttributeError, KeyError):
141
+ pass
142
+ return cast(FileSetFileMetadataType0 | None, data)
143
+
144
+ metadata = _parse_metadata(d.pop("metadata"))
145
+
146
+ def _parse_gemini_file_id(data: object) -> None | str:
147
+ if data is None:
148
+ return data
149
+ return cast(None | str, data)
150
+
151
+ gemini_file_id = _parse_gemini_file_id(d.pop("gemini_file_id"))
152
+
153
+ def _parse_file_created_date(data: object) -> datetime.datetime | None:
154
+ if data is None:
155
+ return data
156
+ try:
157
+ if not isinstance(data, str):
158
+ raise TypeError()
159
+ file_created_date_type_0 = isoparse(data)
160
+
161
+ return file_created_date_type_0
162
+ except (TypeError, ValueError, AttributeError, KeyError):
163
+ pass
164
+ return cast(datetime.datetime | None, data)
165
+
166
+ file_created_date = _parse_file_created_date(d.pop("file_created_date"))
167
+
168
+ created_at = isoparse(d.pop("created_at"))
169
+
170
+ updated_at = isoparse(d.pop("updated_at"))
171
+
172
+ file_set_file = cls(
173
+ id=id,
174
+ original_file_name=original_file_name,
175
+ cloud_storage_path=cloud_storage_path,
176
+ mime_type=mime_type,
177
+ size_bytes=size_bytes,
178
+ character_count=character_count,
179
+ metadata=metadata,
180
+ gemini_file_id=gemini_file_id,
181
+ file_created_date=file_created_date,
182
+ created_at=created_at,
183
+ updated_at=updated_at,
184
+ )
185
+
186
+ file_set_file.additional_properties = d
187
+ return file_set_file
188
+
189
+ @property
190
+ def additional_keys(self) -> list[str]:
191
+ return list(self.additional_properties.keys())
192
+
193
+ def __getitem__(self, key: str) -> Any:
194
+ return self.additional_properties[key]
195
+
196
+ def __setitem__(self, key: str, value: Any) -> None:
197
+ self.additional_properties[key] = value
198
+
199
+ def __delitem__(self, key: str) -> None:
200
+ del self.additional_properties[key]
201
+
202
+ def __contains__(self, key: str) -> bool:
203
+ return key in self.additional_properties
@@ -0,0 +1,57 @@
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="FileSetFileMetadataType0")
10
+
11
+
12
+ @_attrs_define
13
+ class FileSetFileMetadataType0:
14
+ """ """
15
+
16
+ additional_properties: dict[str, bool | float | int | str] = _attrs_field(init=False, factory=dict)
17
+
18
+ def to_dict(self) -> dict[str, Any]:
19
+ field_dict: dict[str, Any] = {}
20
+ for prop_name, prop in self.additional_properties.items():
21
+ field_dict[prop_name] = prop
22
+
23
+ return field_dict
24
+
25
+ @classmethod
26
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
27
+ d = dict(src_dict)
28
+ file_set_file_metadata_type_0 = cls()
29
+
30
+ additional_properties = {}
31
+ for prop_name, prop_dict in d.items():
32
+
33
+ def _parse_additional_property(data: object) -> bool | float | int | str:
34
+ return cast(bool | float | int | str, data)
35
+
36
+ additional_property = _parse_additional_property(prop_dict)
37
+
38
+ additional_properties[prop_name] = additional_property
39
+
40
+ file_set_file_metadata_type_0.additional_properties = additional_properties
41
+ return file_set_file_metadata_type_0
42
+
43
+ @property
44
+ def additional_keys(self) -> list[str]:
45
+ return list(self.additional_properties.keys())
46
+
47
+ def __getitem__(self, key: str) -> bool | float | int | str:
48
+ return self.additional_properties[key]
49
+
50
+ def __setitem__(self, key: str, value: bool | float | int | str) -> None:
51
+ self.additional_properties[key] = value
52
+
53
+ def __delitem__(self, key: str) -> None:
54
+ del self.additional_properties[key]
55
+
56
+ def __contains__(self, key: str) -> bool:
57
+ return key in self.additional_properties