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,209 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
+
from ...models.paginated_samples_response import PaginatedSamplesResponse
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
dataset_id: str,
|
|
16
|
+
*,
|
|
17
|
+
limit: int | Unset = 1000,
|
|
18
|
+
cursor: None | str | Unset = UNSET,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
params: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
params["limit"] = limit
|
|
23
|
+
|
|
24
|
+
json_cursor: None | str | Unset
|
|
25
|
+
if isinstance(cursor, Unset):
|
|
26
|
+
json_cursor = UNSET
|
|
27
|
+
else:
|
|
28
|
+
json_cursor = cursor
|
|
29
|
+
params["cursor"] = json_cursor
|
|
30
|
+
|
|
31
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
32
|
+
|
|
33
|
+
_kwargs: dict[str, Any] = {
|
|
34
|
+
"method": "get",
|
|
35
|
+
"url": "/datasets/{dataset_id}/samples".format(
|
|
36
|
+
dataset_id=quote(str(dataset_id), safe=""),
|
|
37
|
+
),
|
|
38
|
+
"params": params,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return _kwargs
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _parse_response(
|
|
45
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
46
|
+
) -> HTTPValidationError | PaginatedSamplesResponse | None:
|
|
47
|
+
if response.status_code == 200:
|
|
48
|
+
response_200 = PaginatedSamplesResponse.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_200
|
|
51
|
+
|
|
52
|
+
if response.status_code == 422:
|
|
53
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
return response_422
|
|
56
|
+
|
|
57
|
+
if client.raise_on_unexpected_status:
|
|
58
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
59
|
+
else:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _build_response(
|
|
64
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
65
|
+
) -> Response[HTTPValidationError | PaginatedSamplesResponse]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
dataset_id: str,
|
|
76
|
+
*,
|
|
77
|
+
client: AuthenticatedClient,
|
|
78
|
+
limit: int | Unset = 1000,
|
|
79
|
+
cursor: None | str | Unset = UNSET,
|
|
80
|
+
) -> Response[HTTPValidationError | PaginatedSamplesResponse]:
|
|
81
|
+
"""Get Dataset Samples
|
|
82
|
+
|
|
83
|
+
Get samples from a dataset with cursor-based pagination
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
dataset_id (str):
|
|
87
|
+
limit (int | Unset): Default: 1000.
|
|
88
|
+
cursor (None | str | Unset):
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
92
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Response[HTTPValidationError | PaginatedSamplesResponse]
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
kwargs = _get_kwargs(
|
|
99
|
+
dataset_id=dataset_id,
|
|
100
|
+
limit=limit,
|
|
101
|
+
cursor=cursor,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
response = client.get_httpx_client().request(
|
|
105
|
+
**kwargs,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
return _build_response(client=client, response=response)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def sync(
|
|
112
|
+
dataset_id: str,
|
|
113
|
+
*,
|
|
114
|
+
client: AuthenticatedClient,
|
|
115
|
+
limit: int | Unset = 1000,
|
|
116
|
+
cursor: None | str | Unset = UNSET,
|
|
117
|
+
) -> HTTPValidationError | PaginatedSamplesResponse | None:
|
|
118
|
+
"""Get Dataset Samples
|
|
119
|
+
|
|
120
|
+
Get samples from a dataset with cursor-based pagination
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
dataset_id (str):
|
|
124
|
+
limit (int | Unset): Default: 1000.
|
|
125
|
+
cursor (None | str | Unset):
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
HTTPValidationError | PaginatedSamplesResponse
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
return sync_detailed(
|
|
136
|
+
dataset_id=dataset_id,
|
|
137
|
+
client=client,
|
|
138
|
+
limit=limit,
|
|
139
|
+
cursor=cursor,
|
|
140
|
+
).parsed
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
async def asyncio_detailed(
|
|
144
|
+
dataset_id: str,
|
|
145
|
+
*,
|
|
146
|
+
client: AuthenticatedClient,
|
|
147
|
+
limit: int | Unset = 1000,
|
|
148
|
+
cursor: None | str | Unset = UNSET,
|
|
149
|
+
) -> Response[HTTPValidationError | PaginatedSamplesResponse]:
|
|
150
|
+
"""Get Dataset Samples
|
|
151
|
+
|
|
152
|
+
Get samples from a dataset with cursor-based pagination
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
dataset_id (str):
|
|
156
|
+
limit (int | Unset): Default: 1000.
|
|
157
|
+
cursor (None | str | Unset):
|
|
158
|
+
|
|
159
|
+
Raises:
|
|
160
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
161
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
Response[HTTPValidationError | PaginatedSamplesResponse]
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
kwargs = _get_kwargs(
|
|
168
|
+
dataset_id=dataset_id,
|
|
169
|
+
limit=limit,
|
|
170
|
+
cursor=cursor,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
174
|
+
|
|
175
|
+
return _build_response(client=client, response=response)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
async def asyncio(
|
|
179
|
+
dataset_id: str,
|
|
180
|
+
*,
|
|
181
|
+
client: AuthenticatedClient,
|
|
182
|
+
limit: int | Unset = 1000,
|
|
183
|
+
cursor: None | str | Unset = UNSET,
|
|
184
|
+
) -> HTTPValidationError | PaginatedSamplesResponse | None:
|
|
185
|
+
"""Get Dataset Samples
|
|
186
|
+
|
|
187
|
+
Get samples from a dataset with cursor-based pagination
|
|
188
|
+
|
|
189
|
+
Args:
|
|
190
|
+
dataset_id (str):
|
|
191
|
+
limit (int | Unset): Default: 1000.
|
|
192
|
+
cursor (None | str | Unset):
|
|
193
|
+
|
|
194
|
+
Raises:
|
|
195
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
196
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
197
|
+
|
|
198
|
+
Returns:
|
|
199
|
+
HTTPValidationError | PaginatedSamplesResponse
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
await asyncio_detailed(
|
|
204
|
+
dataset_id=dataset_id,
|
|
205
|
+
client=client,
|
|
206
|
+
limit=limit,
|
|
207
|
+
cursor=cursor,
|
|
208
|
+
)
|
|
209
|
+
).parsed
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
+
from ...models.upload_samples_request import UploadSamplesRequest
|
|
11
|
+
from ...models.upload_samples_response import UploadSamplesResponse
|
|
12
|
+
from ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
dataset_id: str,
|
|
17
|
+
*,
|
|
18
|
+
body: UploadSamplesRequest,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
headers: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "post",
|
|
24
|
+
"url": "/datasets/{dataset_id}/samples".format(
|
|
25
|
+
dataset_id=quote(str(dataset_id), safe=""),
|
|
26
|
+
),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_kwargs["json"] = body.to_dict()
|
|
30
|
+
|
|
31
|
+
headers["Content-Type"] = "application/json"
|
|
32
|
+
|
|
33
|
+
_kwargs["headers"] = headers
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(
|
|
38
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
39
|
+
) -> HTTPValidationError | UploadSamplesResponse | None:
|
|
40
|
+
if response.status_code == 200:
|
|
41
|
+
response_200 = UploadSamplesResponse.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_200
|
|
44
|
+
|
|
45
|
+
if response.status_code == 422:
|
|
46
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_422
|
|
49
|
+
|
|
50
|
+
if client.raise_on_unexpected_status:
|
|
51
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
52
|
+
else:
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _build_response(
|
|
57
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
58
|
+
) -> Response[HTTPValidationError | UploadSamplesResponse]:
|
|
59
|
+
return Response(
|
|
60
|
+
status_code=HTTPStatus(response.status_code),
|
|
61
|
+
content=response.content,
|
|
62
|
+
headers=response.headers,
|
|
63
|
+
parsed=_parse_response(client=client, response=response),
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def sync_detailed(
|
|
68
|
+
dataset_id: str,
|
|
69
|
+
*,
|
|
70
|
+
client: AuthenticatedClient,
|
|
71
|
+
body: UploadSamplesRequest,
|
|
72
|
+
) -> Response[HTTPValidationError | UploadSamplesResponse]:
|
|
73
|
+
"""Upload Samples
|
|
74
|
+
|
|
75
|
+
Upload samples to a dataset
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
dataset_id (str):
|
|
79
|
+
body (UploadSamplesRequest):
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
83
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
Response[HTTPValidationError | UploadSamplesResponse]
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
kwargs = _get_kwargs(
|
|
90
|
+
dataset_id=dataset_id,
|
|
91
|
+
body=body,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
response = client.get_httpx_client().request(
|
|
95
|
+
**kwargs,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
return _build_response(client=client, response=response)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def sync(
|
|
102
|
+
dataset_id: str,
|
|
103
|
+
*,
|
|
104
|
+
client: AuthenticatedClient,
|
|
105
|
+
body: UploadSamplesRequest,
|
|
106
|
+
) -> HTTPValidationError | UploadSamplesResponse | None:
|
|
107
|
+
"""Upload Samples
|
|
108
|
+
|
|
109
|
+
Upload samples to a dataset
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
dataset_id (str):
|
|
113
|
+
body (UploadSamplesRequest):
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
HTTPValidationError | UploadSamplesResponse
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
return sync_detailed(
|
|
124
|
+
dataset_id=dataset_id,
|
|
125
|
+
client=client,
|
|
126
|
+
body=body,
|
|
127
|
+
).parsed
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
async def asyncio_detailed(
|
|
131
|
+
dataset_id: str,
|
|
132
|
+
*,
|
|
133
|
+
client: AuthenticatedClient,
|
|
134
|
+
body: UploadSamplesRequest,
|
|
135
|
+
) -> Response[HTTPValidationError | UploadSamplesResponse]:
|
|
136
|
+
"""Upload Samples
|
|
137
|
+
|
|
138
|
+
Upload samples to a dataset
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
dataset_id (str):
|
|
142
|
+
body (UploadSamplesRequest):
|
|
143
|
+
|
|
144
|
+
Raises:
|
|
145
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
146
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Response[HTTPValidationError | UploadSamplesResponse]
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
kwargs = _get_kwargs(
|
|
153
|
+
dataset_id=dataset_id,
|
|
154
|
+
body=body,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
158
|
+
|
|
159
|
+
return _build_response(client=client, response=response)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
async def asyncio(
|
|
163
|
+
dataset_id: str,
|
|
164
|
+
*,
|
|
165
|
+
client: AuthenticatedClient,
|
|
166
|
+
body: UploadSamplesRequest,
|
|
167
|
+
) -> HTTPValidationError | UploadSamplesResponse | None:
|
|
168
|
+
"""Upload Samples
|
|
169
|
+
|
|
170
|
+
Upload samples to a dataset
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
dataset_id (str):
|
|
174
|
+
body (UploadSamplesRequest):
|
|
175
|
+
|
|
176
|
+
Raises:
|
|
177
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
178
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
HTTPValidationError | UploadSamplesResponse
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
await asyncio_detailed(
|
|
186
|
+
dataset_id=dataset_id,
|
|
187
|
+
client=client,
|
|
188
|
+
body=body,
|
|
189
|
+
)
|
|
190
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.create_file_set_file_request import CreateFileSetFileRequest
|
|
10
|
+
from ...models.file_set_file import FileSetFile
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
file_set_id: str,
|
|
17
|
+
*,
|
|
18
|
+
body: CreateFileSetFileRequest,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
headers: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "post",
|
|
24
|
+
"url": "/filesets/{file_set_id}/files".format(
|
|
25
|
+
file_set_id=quote(str(file_set_id), safe=""),
|
|
26
|
+
),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_kwargs["json"] = body.to_dict()
|
|
30
|
+
|
|
31
|
+
headers["Content-Type"] = "application/json"
|
|
32
|
+
|
|
33
|
+
_kwargs["headers"] = headers
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(
|
|
38
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
39
|
+
) -> FileSetFile | HTTPValidationError | None:
|
|
40
|
+
if response.status_code == 201:
|
|
41
|
+
response_201 = FileSetFile.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_201
|
|
44
|
+
|
|
45
|
+
if response.status_code == 422:
|
|
46
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_422
|
|
49
|
+
|
|
50
|
+
if client.raise_on_unexpected_status:
|
|
51
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
52
|
+
else:
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _build_response(
|
|
57
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
58
|
+
) -> Response[FileSetFile | HTTPValidationError]:
|
|
59
|
+
return Response(
|
|
60
|
+
status_code=HTTPStatus(response.status_code),
|
|
61
|
+
content=response.content,
|
|
62
|
+
headers=response.headers,
|
|
63
|
+
parsed=_parse_response(client=client, response=response),
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def sync_detailed(
|
|
68
|
+
file_set_id: str,
|
|
69
|
+
*,
|
|
70
|
+
client: AuthenticatedClient,
|
|
71
|
+
body: CreateFileSetFileRequest,
|
|
72
|
+
) -> Response[FileSetFile | HTTPValidationError]:
|
|
73
|
+
"""Add File To Set
|
|
74
|
+
|
|
75
|
+
Add a file to a FileSet by providing file information and metadata.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
file_set_id (str):
|
|
79
|
+
body (CreateFileSetFileRequest):
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
83
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
Response[FileSetFile | HTTPValidationError]
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
kwargs = _get_kwargs(
|
|
90
|
+
file_set_id=file_set_id,
|
|
91
|
+
body=body,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
response = client.get_httpx_client().request(
|
|
95
|
+
**kwargs,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
return _build_response(client=client, response=response)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def sync(
|
|
102
|
+
file_set_id: str,
|
|
103
|
+
*,
|
|
104
|
+
client: AuthenticatedClient,
|
|
105
|
+
body: CreateFileSetFileRequest,
|
|
106
|
+
) -> FileSetFile | HTTPValidationError | None:
|
|
107
|
+
"""Add File To Set
|
|
108
|
+
|
|
109
|
+
Add a file to a FileSet by providing file information and metadata.
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
file_set_id (str):
|
|
113
|
+
body (CreateFileSetFileRequest):
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
FileSetFile | HTTPValidationError
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
return sync_detailed(
|
|
124
|
+
file_set_id=file_set_id,
|
|
125
|
+
client=client,
|
|
126
|
+
body=body,
|
|
127
|
+
).parsed
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
async def asyncio_detailed(
|
|
131
|
+
file_set_id: str,
|
|
132
|
+
*,
|
|
133
|
+
client: AuthenticatedClient,
|
|
134
|
+
body: CreateFileSetFileRequest,
|
|
135
|
+
) -> Response[FileSetFile | HTTPValidationError]:
|
|
136
|
+
"""Add File To Set
|
|
137
|
+
|
|
138
|
+
Add a file to a FileSet by providing file information and metadata.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
file_set_id (str):
|
|
142
|
+
body (CreateFileSetFileRequest):
|
|
143
|
+
|
|
144
|
+
Raises:
|
|
145
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
146
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Response[FileSetFile | HTTPValidationError]
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
kwargs = _get_kwargs(
|
|
153
|
+
file_set_id=file_set_id,
|
|
154
|
+
body=body,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
158
|
+
|
|
159
|
+
return _build_response(client=client, response=response)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
async def asyncio(
|
|
163
|
+
file_set_id: str,
|
|
164
|
+
*,
|
|
165
|
+
client: AuthenticatedClient,
|
|
166
|
+
body: CreateFileSetFileRequest,
|
|
167
|
+
) -> FileSetFile | HTTPValidationError | None:
|
|
168
|
+
"""Add File To Set
|
|
169
|
+
|
|
170
|
+
Add a file to a FileSet by providing file information and metadata.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
file_set_id (str):
|
|
174
|
+
body (CreateFileSetFileRequest):
|
|
175
|
+
|
|
176
|
+
Raises:
|
|
177
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
178
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
FileSetFile | HTTPValidationError
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
await asyncio_detailed(
|
|
186
|
+
file_set_id=file_set_id,
|
|
187
|
+
client=client,
|
|
188
|
+
body=body,
|
|
189
|
+
)
|
|
190
|
+
).parsed
|