llama-cloud 0.0.1__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.

Potentially problematic release.


This version of llama-cloud might be problematic. Click here for more details.

Files changed (173) hide show
  1. llama_cloud/__init__.py +295 -0
  2. llama_cloud/client.py +72 -0
  3. llama_cloud/core/__init__.py +17 -0
  4. llama_cloud/core/api_error.py +15 -0
  5. llama_cloud/core/client_wrapper.py +51 -0
  6. llama_cloud/core/datetime_utils.py +28 -0
  7. llama_cloud/core/jsonable_encoder.py +103 -0
  8. llama_cloud/core/remove_none_from_dict.py +11 -0
  9. llama_cloud/errors/__init__.py +5 -0
  10. llama_cloud/errors/unprocessable_entity_error.py +9 -0
  11. llama_cloud/resources/__init__.py +40 -0
  12. llama_cloud/resources/api_keys/__init__.py +2 -0
  13. llama_cloud/resources/api_keys/client.py +302 -0
  14. llama_cloud/resources/billing/__init__.py +2 -0
  15. llama_cloud/resources/billing/client.py +234 -0
  16. llama_cloud/resources/component_definitions/__init__.py +2 -0
  17. llama_cloud/resources/component_definitions/client.py +192 -0
  18. llama_cloud/resources/data_sinks/__init__.py +5 -0
  19. llama_cloud/resources/data_sinks/client.py +506 -0
  20. llama_cloud/resources/data_sinks/types/__init__.py +6 -0
  21. llama_cloud/resources/data_sinks/types/data_sink_update_component.py +7 -0
  22. llama_cloud/resources/data_sinks/types/data_sink_update_component_one.py +17 -0
  23. llama_cloud/resources/data_sources/__init__.py +5 -0
  24. llama_cloud/resources/data_sources/client.py +521 -0
  25. llama_cloud/resources/data_sources/types/__init__.py +7 -0
  26. llama_cloud/resources/data_sources/types/data_source_update_component.py +7 -0
  27. llama_cloud/resources/data_sources/types/data_source_update_component_one.py +19 -0
  28. llama_cloud/resources/data_sources/types/data_source_update_custom_metadata_value.py +7 -0
  29. llama_cloud/resources/deprecated/__init__.py +2 -0
  30. llama_cloud/resources/deprecated/client.py +982 -0
  31. llama_cloud/resources/evals/__init__.py +2 -0
  32. llama_cloud/resources/evals/client.py +745 -0
  33. llama_cloud/resources/files/__init__.py +5 -0
  34. llama_cloud/resources/files/client.py +560 -0
  35. llama_cloud/resources/files/types/__init__.py +5 -0
  36. llama_cloud/resources/files/types/file_create_resource_info_value.py +5 -0
  37. llama_cloud/resources/parsing/__init__.py +2 -0
  38. llama_cloud/resources/parsing/client.py +982 -0
  39. llama_cloud/resources/pipelines/__init__.py +5 -0
  40. llama_cloud/resources/pipelines/client.py +2599 -0
  41. llama_cloud/resources/pipelines/types/__init__.py +5 -0
  42. llama_cloud/resources/pipelines/types/pipeline_file_update_custom_metadata_value.py +7 -0
  43. llama_cloud/resources/projects/__init__.py +2 -0
  44. llama_cloud/resources/projects/client.py +1231 -0
  45. llama_cloud/types/__init__.py +253 -0
  46. llama_cloud/types/api_key.py +37 -0
  47. llama_cloud/types/azure_open_ai_embedding.py +75 -0
  48. llama_cloud/types/base.py +26 -0
  49. llama_cloud/types/base_prompt_template.py +44 -0
  50. llama_cloud/types/bedrock_embedding.py +56 -0
  51. llama_cloud/types/chat_message.py +35 -0
  52. llama_cloud/types/cloud_az_storage_blob_data_source.py +40 -0
  53. llama_cloud/types/cloud_chroma_vector_store.py +40 -0
  54. llama_cloud/types/cloud_document.py +36 -0
  55. llama_cloud/types/cloud_document_create.py +36 -0
  56. llama_cloud/types/cloud_gcs_data_source.py +37 -0
  57. llama_cloud/types/cloud_google_drive_data_source.py +36 -0
  58. llama_cloud/types/cloud_one_drive_data_source.py +38 -0
  59. llama_cloud/types/cloud_pinecone_vector_store.py +46 -0
  60. llama_cloud/types/cloud_postgres_vector_store.py +44 -0
  61. llama_cloud/types/cloud_qdrant_vector_store.py +48 -0
  62. llama_cloud/types/cloud_s_3_data_source.py +42 -0
  63. llama_cloud/types/cloud_sharepoint_data_source.py +38 -0
  64. llama_cloud/types/cloud_weaviate_vector_store.py +38 -0
  65. llama_cloud/types/code_splitter.py +46 -0
  66. llama_cloud/types/cohere_embedding.py +46 -0
  67. llama_cloud/types/configurable_data_sink_names.py +37 -0
  68. llama_cloud/types/configurable_data_source_names.py +41 -0
  69. llama_cloud/types/configurable_transformation_definition.py +45 -0
  70. llama_cloud/types/configurable_transformation_names.py +73 -0
  71. llama_cloud/types/configured_transformation_item.py +43 -0
  72. llama_cloud/types/configured_transformation_item_component.py +9 -0
  73. llama_cloud/types/configured_transformation_item_component_one.py +35 -0
  74. llama_cloud/types/data_sink.py +40 -0
  75. llama_cloud/types/data_sink_component.py +7 -0
  76. llama_cloud/types/data_sink_component_one.py +17 -0
  77. llama_cloud/types/data_sink_create.py +36 -0
  78. llama_cloud/types/data_sink_create_component.py +7 -0
  79. llama_cloud/types/data_sink_create_component_one.py +17 -0
  80. llama_cloud/types/data_sink_definition.py +41 -0
  81. llama_cloud/types/data_source.py +44 -0
  82. llama_cloud/types/data_source_component.py +7 -0
  83. llama_cloud/types/data_source_component_one.py +19 -0
  84. llama_cloud/types/data_source_create.py +40 -0
  85. llama_cloud/types/data_source_create_component.py +7 -0
  86. llama_cloud/types/data_source_create_component_one.py +19 -0
  87. llama_cloud/types/data_source_create_custom_metadata_value.py +7 -0
  88. llama_cloud/types/data_source_custom_metadata_value.py +7 -0
  89. llama_cloud/types/data_source_definition.py +41 -0
  90. llama_cloud/types/eval_dataset.py +37 -0
  91. llama_cloud/types/eval_dataset_job_params.py +36 -0
  92. llama_cloud/types/eval_dataset_job_record.py +59 -0
  93. llama_cloud/types/eval_execution_params.py +38 -0
  94. llama_cloud/types/eval_execution_params_override.py +38 -0
  95. llama_cloud/types/eval_llm_model_data.py +33 -0
  96. llama_cloud/types/eval_question.py +39 -0
  97. llama_cloud/types/eval_question_create.py +28 -0
  98. llama_cloud/types/eval_question_result.py +49 -0
  99. llama_cloud/types/file.py +46 -0
  100. llama_cloud/types/file_resource_info_value.py +5 -0
  101. llama_cloud/types/filter_condition.py +21 -0
  102. llama_cloud/types/filter_operator.py +65 -0
  103. llama_cloud/types/gemini_embedding.py +51 -0
  104. llama_cloud/types/html_node_parser.py +44 -0
  105. llama_cloud/types/http_validation_error.py +29 -0
  106. llama_cloud/types/hugging_face_inference_api_embedding.py +68 -0
  107. llama_cloud/types/hugging_face_inference_api_embedding_token.py +5 -0
  108. llama_cloud/types/json_node_parser.py +43 -0
  109. llama_cloud/types/llama_parse_supported_file_extensions.py +161 -0
  110. llama_cloud/types/llm.py +55 -0
  111. llama_cloud/types/local_eval.py +46 -0
  112. llama_cloud/types/local_eval_results.py +37 -0
  113. llama_cloud/types/local_eval_sets.py +30 -0
  114. llama_cloud/types/managed_ingestion_status.py +37 -0
  115. llama_cloud/types/markdown_element_node_parser.py +49 -0
  116. llama_cloud/types/markdown_node_parser.py +43 -0
  117. llama_cloud/types/message_role.py +45 -0
  118. llama_cloud/types/metadata_filter.py +41 -0
  119. llama_cloud/types/metadata_filter_value.py +5 -0
  120. llama_cloud/types/metadata_filters.py +41 -0
  121. llama_cloud/types/metadata_filters_filters_item.py +8 -0
  122. llama_cloud/types/metric_result.py +30 -0
  123. llama_cloud/types/node_parser.py +37 -0
  124. llama_cloud/types/object_type.py +33 -0
  125. llama_cloud/types/open_ai_embedding.py +73 -0
  126. llama_cloud/types/parser_languages.py +361 -0
  127. llama_cloud/types/parsing_history_item.py +36 -0
  128. llama_cloud/types/parsing_job.py +30 -0
  129. llama_cloud/types/parsing_job_json_result.py +29 -0
  130. llama_cloud/types/parsing_job_markdown_result.py +29 -0
  131. llama_cloud/types/parsing_job_text_result.py +29 -0
  132. llama_cloud/types/parsing_usage.py +29 -0
  133. llama_cloud/types/pipeline.py +64 -0
  134. llama_cloud/types/pipeline_create.py +61 -0
  135. llama_cloud/types/pipeline_data_source.py +46 -0
  136. llama_cloud/types/pipeline_data_source_component.py +7 -0
  137. llama_cloud/types/pipeline_data_source_component_one.py +19 -0
  138. llama_cloud/types/pipeline_data_source_create.py +32 -0
  139. llama_cloud/types/pipeline_data_source_custom_metadata_value.py +7 -0
  140. llama_cloud/types/pipeline_deployment.py +38 -0
  141. llama_cloud/types/pipeline_file.py +52 -0
  142. llama_cloud/types/pipeline_file_create.py +36 -0
  143. llama_cloud/types/pipeline_file_create_custom_metadata_value.py +7 -0
  144. llama_cloud/types/pipeline_file_custom_metadata_value.py +7 -0
  145. llama_cloud/types/pipeline_file_resource_info_value.py +7 -0
  146. llama_cloud/types/pipeline_file_status_response.py +35 -0
  147. llama_cloud/types/pipeline_type.py +21 -0
  148. llama_cloud/types/pooling.py +29 -0
  149. llama_cloud/types/preset_retrieval_params.py +40 -0
  150. llama_cloud/types/presigned_url.py +36 -0
  151. llama_cloud/types/project.py +42 -0
  152. llama_cloud/types/project_create.py +32 -0
  153. llama_cloud/types/prompt_mixin_prompts.py +36 -0
  154. llama_cloud/types/prompt_spec.py +35 -0
  155. llama_cloud/types/pydantic_program_mode.py +41 -0
  156. llama_cloud/types/related_node_info.py +37 -0
  157. llama_cloud/types/retrieve_results.py +40 -0
  158. llama_cloud/types/sentence_splitter.py +48 -0
  159. llama_cloud/types/simple_file_node_parser.py +44 -0
  160. llama_cloud/types/status_enum.py +33 -0
  161. llama_cloud/types/supported_eval_llm_model.py +35 -0
  162. llama_cloud/types/supported_eval_llm_model_names.py +29 -0
  163. llama_cloud/types/text_node.py +62 -0
  164. llama_cloud/types/text_node_relationships_value.py +7 -0
  165. llama_cloud/types/text_node_with_score.py +36 -0
  166. llama_cloud/types/token_text_splitter.py +43 -0
  167. llama_cloud/types/transformation_category_names.py +21 -0
  168. llama_cloud/types/validation_error.py +31 -0
  169. llama_cloud/types/validation_error_loc_item.py +5 -0
  170. llama_cloud-0.0.1.dist-info/LICENSE +21 -0
  171. llama_cloud-0.0.1.dist-info/METADATA +25 -0
  172. llama_cloud-0.0.1.dist-info/RECORD +173 -0
  173. llama_cloud-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,1231 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ import urllib.parse
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from ...core.api_error import ApiError
8
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ...core.jsonable_encoder import jsonable_encoder
10
+ from ...core.remove_none_from_dict import remove_none_from_dict
11
+ from ...errors.unprocessable_entity_error import UnprocessableEntityError
12
+ from ...types.eval_dataset import EvalDataset
13
+ from ...types.http_validation_error import HttpValidationError
14
+ from ...types.local_eval import LocalEval
15
+ from ...types.local_eval_results import LocalEvalResults
16
+ from ...types.local_eval_sets import LocalEvalSets
17
+ from ...types.project import Project
18
+ from ...types.project_create import ProjectCreate
19
+ from ...types.prompt_mixin_prompts import PromptMixinPrompts
20
+
21
+ try:
22
+ import pydantic.v1 as pydantic # type: ignore
23
+ except ImportError:
24
+ import pydantic # type: ignore
25
+
26
+ # this is used as the default value for optional parameters
27
+ OMIT = typing.cast(typing.Any, ...)
28
+
29
+
30
+ class ProjectsClient:
31
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
32
+ self._client_wrapper = client_wrapper
33
+
34
+ def list_projects(self, *, project_name: typing.Optional[str] = None) -> typing.List[Project]:
35
+ """
36
+ List projects or get one by name
37
+
38
+ Parameters:
39
+ - project_name: typing.Optional[str].
40
+ ---
41
+ from platform.client import PlatformApi
42
+
43
+ client = PlatformApi(
44
+ token="YOUR_TOKEN",
45
+ base_url="https://yourhost.com/path/to/api",
46
+ )
47
+ client.projects.list_projects()
48
+ """
49
+ _response = self._client_wrapper.httpx_client.request(
50
+ "GET",
51
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/projects"),
52
+ params=remove_none_from_dict({"project_name": project_name}),
53
+ headers=self._client_wrapper.get_headers(),
54
+ timeout=60,
55
+ )
56
+ if 200 <= _response.status_code < 300:
57
+ return pydantic.parse_obj_as(typing.List[Project], _response.json()) # type: ignore
58
+ if _response.status_code == 422:
59
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
60
+ try:
61
+ _response_json = _response.json()
62
+ except JSONDecodeError:
63
+ raise ApiError(status_code=_response.status_code, body=_response.text)
64
+ raise ApiError(status_code=_response.status_code, body=_response_json)
65
+
66
+ def create_project(self, *, request: ProjectCreate) -> Project:
67
+ """
68
+ Create a new project.
69
+
70
+ Parameters:
71
+ - request: ProjectCreate.
72
+ ---
73
+ from platform import ProjectCreate
74
+ from platform.client import PlatformApi
75
+
76
+ client = PlatformApi(
77
+ token="YOUR_TOKEN",
78
+ base_url="https://yourhost.com/path/to/api",
79
+ )
80
+ client.projects.create_project(
81
+ request=ProjectCreate(
82
+ name="string",
83
+ ),
84
+ )
85
+ """
86
+ _response = self._client_wrapper.httpx_client.request(
87
+ "POST",
88
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/projects"),
89
+ json=jsonable_encoder(request),
90
+ headers=self._client_wrapper.get_headers(),
91
+ timeout=60,
92
+ )
93
+ if 200 <= _response.status_code < 300:
94
+ return pydantic.parse_obj_as(Project, _response.json()) # type: ignore
95
+ if _response.status_code == 422:
96
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
97
+ try:
98
+ _response_json = _response.json()
99
+ except JSONDecodeError:
100
+ raise ApiError(status_code=_response.status_code, body=_response.text)
101
+ raise ApiError(status_code=_response.status_code, body=_response_json)
102
+
103
+ def upsert_project(self, *, request: ProjectCreate) -> Project:
104
+ """
105
+ Upsert a project.
106
+ Updates if a project with the same name already exists. Otherwise, creates a new project.
107
+
108
+ Parameters:
109
+ - request: ProjectCreate.
110
+ ---
111
+ from platform import ProjectCreate
112
+ from platform.client import PlatformApi
113
+
114
+ client = PlatformApi(
115
+ token="YOUR_TOKEN",
116
+ base_url="https://yourhost.com/path/to/api",
117
+ )
118
+ client.projects.upsert_project(
119
+ request=ProjectCreate(
120
+ name="string",
121
+ ),
122
+ )
123
+ """
124
+ _response = self._client_wrapper.httpx_client.request(
125
+ "PUT",
126
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/projects"),
127
+ json=jsonable_encoder(request),
128
+ headers=self._client_wrapper.get_headers(),
129
+ timeout=60,
130
+ )
131
+ if 200 <= _response.status_code < 300:
132
+ return pydantic.parse_obj_as(Project, _response.json()) # type: ignore
133
+ if _response.status_code == 422:
134
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
135
+ try:
136
+ _response_json = _response.json()
137
+ except JSONDecodeError:
138
+ raise ApiError(status_code=_response.status_code, body=_response.text)
139
+ raise ApiError(status_code=_response.status_code, body=_response_json)
140
+
141
+ def get_project(self, project_id: str) -> Project:
142
+ """
143
+ Get a project by ID.
144
+
145
+ Parameters:
146
+ - project_id: str.
147
+ ---
148
+ from platform.client import PlatformApi
149
+
150
+ client = PlatformApi(
151
+ token="YOUR_TOKEN",
152
+ base_url="https://yourhost.com/path/to/api",
153
+ )
154
+ client.projects.get_project(
155
+ project_id="string",
156
+ )
157
+ """
158
+ _response = self._client_wrapper.httpx_client.request(
159
+ "GET",
160
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}"),
161
+ headers=self._client_wrapper.get_headers(),
162
+ timeout=60,
163
+ )
164
+ if 200 <= _response.status_code < 300:
165
+ return pydantic.parse_obj_as(Project, _response.json()) # type: ignore
166
+ if _response.status_code == 422:
167
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
168
+ try:
169
+ _response_json = _response.json()
170
+ except JSONDecodeError:
171
+ raise ApiError(status_code=_response.status_code, body=_response.text)
172
+ raise ApiError(status_code=_response.status_code, body=_response_json)
173
+
174
+ def update_existing_project(self, project_id: str, *, name: str) -> Project:
175
+ """
176
+ Update an existing project.
177
+
178
+ Parameters:
179
+ - project_id: str.
180
+
181
+ - name: str.
182
+ ---
183
+ from platform.client import PlatformApi
184
+
185
+ client = PlatformApi(
186
+ token="YOUR_TOKEN",
187
+ base_url="https://yourhost.com/path/to/api",
188
+ )
189
+ client.projects.update_existing_project(
190
+ project_id="string",
191
+ name="string",
192
+ )
193
+ """
194
+ _response = self._client_wrapper.httpx_client.request(
195
+ "PUT",
196
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}"),
197
+ json=jsonable_encoder({"name": name}),
198
+ headers=self._client_wrapper.get_headers(),
199
+ timeout=60,
200
+ )
201
+ if 200 <= _response.status_code < 300:
202
+ return pydantic.parse_obj_as(Project, _response.json()) # type: ignore
203
+ if _response.status_code == 422:
204
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
205
+ try:
206
+ _response_json = _response.json()
207
+ except JSONDecodeError:
208
+ raise ApiError(status_code=_response.status_code, body=_response.text)
209
+ raise ApiError(status_code=_response.status_code, body=_response_json)
210
+
211
+ def delete_project(self, project_id: str) -> None:
212
+ """
213
+ Delete a project by ID.
214
+
215
+ Parameters:
216
+ - project_id: str.
217
+ ---
218
+ from platform.client import PlatformApi
219
+
220
+ client = PlatformApi(
221
+ token="YOUR_TOKEN",
222
+ base_url="https://yourhost.com/path/to/api",
223
+ )
224
+ client.projects.delete_project(
225
+ project_id="string",
226
+ )
227
+ """
228
+ _response = self._client_wrapper.httpx_client.request(
229
+ "DELETE",
230
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}"),
231
+ headers=self._client_wrapper.get_headers(),
232
+ timeout=60,
233
+ )
234
+ if 200 <= _response.status_code < 300:
235
+ return
236
+ if _response.status_code == 422:
237
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
238
+ try:
239
+ _response_json = _response.json()
240
+ except JSONDecodeError:
241
+ raise ApiError(status_code=_response.status_code, body=_response.text)
242
+ raise ApiError(status_code=_response.status_code, body=_response_json)
243
+
244
+ def get_datasets_for_project(self, project_id: str) -> typing.List[EvalDataset]:
245
+ """
246
+ Get all eval datasets for a project.
247
+
248
+ Parameters:
249
+ - project_id: str.
250
+ ---
251
+ from platform.client import PlatformApi
252
+
253
+ client = PlatformApi(
254
+ token="YOUR_TOKEN",
255
+ base_url="https://yourhost.com/path/to/api",
256
+ )
257
+ client.projects.get_datasets_for_project(
258
+ project_id="string",
259
+ )
260
+ """
261
+ _response = self._client_wrapper.httpx_client.request(
262
+ "GET",
263
+ urllib.parse.urljoin(
264
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/eval/dataset"
265
+ ),
266
+ headers=self._client_wrapper.get_headers(),
267
+ timeout=60,
268
+ )
269
+ if 200 <= _response.status_code < 300:
270
+ return pydantic.parse_obj_as(typing.List[EvalDataset], _response.json()) # type: ignore
271
+ if _response.status_code == 422:
272
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
273
+ try:
274
+ _response_json = _response.json()
275
+ except JSONDecodeError:
276
+ raise ApiError(status_code=_response.status_code, body=_response.text)
277
+ raise ApiError(status_code=_response.status_code, body=_response_json)
278
+
279
+ def create_eval_dataset_for_project(self, project_id: str, *, name: str) -> EvalDataset:
280
+ """
281
+ Create a new eval dataset for a project.
282
+
283
+ Parameters:
284
+ - project_id: str.
285
+
286
+ - name: str. The name of the EvalDataset.
287
+ ---
288
+ from platform.client import PlatformApi
289
+
290
+ client = PlatformApi(
291
+ token="YOUR_TOKEN",
292
+ base_url="https://yourhost.com/path/to/api",
293
+ )
294
+ client.projects.create_eval_dataset_for_project(
295
+ project_id="string",
296
+ name="string",
297
+ )
298
+ """
299
+ _response = self._client_wrapper.httpx_client.request(
300
+ "POST",
301
+ urllib.parse.urljoin(
302
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/eval/dataset"
303
+ ),
304
+ json=jsonable_encoder({"name": name}),
305
+ headers=self._client_wrapper.get_headers(),
306
+ timeout=60,
307
+ )
308
+ if 200 <= _response.status_code < 300:
309
+ return pydantic.parse_obj_as(EvalDataset, _response.json()) # type: ignore
310
+ if _response.status_code == 422:
311
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
312
+ try:
313
+ _response_json = _response.json()
314
+ except JSONDecodeError:
315
+ raise ApiError(status_code=_response.status_code, body=_response.text)
316
+ raise ApiError(status_code=_response.status_code, body=_response_json)
317
+
318
+ def create_local_eval_set_for_project(
319
+ self, project_id: str, *, app_name: str, results: typing.Dict[str, typing.List[LocalEval]]
320
+ ) -> typing.List[LocalEvalResults]:
321
+ """
322
+ Create a new local eval set.
323
+
324
+ Parameters:
325
+ - project_id: str.
326
+
327
+ - app_name: str. The name of the app.
328
+
329
+ - results: typing.Dict[str, typing.List[LocalEval]]. The eval results.
330
+ ---
331
+ from platform.client import PlatformApi
332
+
333
+ client = PlatformApi(
334
+ token="YOUR_TOKEN",
335
+ base_url="https://yourhost.com/path/to/api",
336
+ )
337
+ client.projects.create_local_eval_set_for_project(
338
+ project_id="string",
339
+ app_name="string",
340
+ results={"string": []},
341
+ )
342
+ """
343
+ _response = self._client_wrapper.httpx_client.request(
344
+ "POST",
345
+ urllib.parse.urljoin(
346
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/localevalset"
347
+ ),
348
+ json=jsonable_encoder({"app_name": app_name, "results": results}),
349
+ headers=self._client_wrapper.get_headers(),
350
+ timeout=60,
351
+ )
352
+ if 200 <= _response.status_code < 300:
353
+ return pydantic.parse_obj_as(typing.List[LocalEvalResults], _response.json()) # type: ignore
354
+ if _response.status_code == 422:
355
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
356
+ try:
357
+ _response_json = _response.json()
358
+ except JSONDecodeError:
359
+ raise ApiError(status_code=_response.status_code, body=_response.text)
360
+ raise ApiError(status_code=_response.status_code, body=_response_json)
361
+
362
+ def get_local_evals_for_project(self, project_id: str) -> typing.List[LocalEvalResults]:
363
+ """
364
+ Get all local eval results for a project.
365
+
366
+ Parameters:
367
+ - project_id: str.
368
+ ---
369
+ from platform.client import PlatformApi
370
+
371
+ client = PlatformApi(
372
+ token="YOUR_TOKEN",
373
+ base_url="https://yourhost.com/path/to/api",
374
+ )
375
+ client.projects.get_local_evals_for_project(
376
+ project_id="string",
377
+ )
378
+ """
379
+ _response = self._client_wrapper.httpx_client.request(
380
+ "GET",
381
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/localeval"),
382
+ headers=self._client_wrapper.get_headers(),
383
+ timeout=60,
384
+ )
385
+ if 200 <= _response.status_code < 300:
386
+ return pydantic.parse_obj_as(typing.List[LocalEvalResults], _response.json()) # type: ignore
387
+ if _response.status_code == 422:
388
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
389
+ try:
390
+ _response_json = _response.json()
391
+ except JSONDecodeError:
392
+ raise ApiError(status_code=_response.status_code, body=_response.text)
393
+ raise ApiError(status_code=_response.status_code, body=_response_json)
394
+
395
+ def get_local_eval_sets_for_project(self, project_id: str) -> typing.List[LocalEvalSets]:
396
+ """
397
+ Get all local eval sets for a project.
398
+
399
+ Parameters:
400
+ - project_id: str.
401
+ ---
402
+ from platform.client import PlatformApi
403
+
404
+ client = PlatformApi(
405
+ token="YOUR_TOKEN",
406
+ base_url="https://yourhost.com/path/to/api",
407
+ )
408
+ client.projects.get_local_eval_sets_for_project(
409
+ project_id="string",
410
+ )
411
+ """
412
+ _response = self._client_wrapper.httpx_client.request(
413
+ "GET",
414
+ urllib.parse.urljoin(
415
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/localevalsets"
416
+ ),
417
+ headers=self._client_wrapper.get_headers(),
418
+ timeout=60,
419
+ )
420
+ if 200 <= _response.status_code < 300:
421
+ return pydantic.parse_obj_as(typing.List[LocalEvalSets], _response.json()) # type: ignore
422
+ if _response.status_code == 422:
423
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
424
+ try:
425
+ _response_json = _response.json()
426
+ except JSONDecodeError:
427
+ raise ApiError(status_code=_response.status_code, body=_response.text)
428
+ raise ApiError(status_code=_response.status_code, body=_response_json)
429
+
430
+ def delete_local_eval_set(self, project_id: str, local_eval_set_id: str) -> typing.Any:
431
+ """
432
+ Delete a local eval set.
433
+
434
+ Parameters:
435
+ - project_id: str.
436
+
437
+ - local_eval_set_id: str.
438
+ ---
439
+ from platform.client import PlatformApi
440
+
441
+ client = PlatformApi(
442
+ token="YOUR_TOKEN",
443
+ base_url="https://yourhost.com/path/to/api",
444
+ )
445
+ client.projects.delete_local_eval_set(
446
+ project_id="string",
447
+ local_eval_set_id="string",
448
+ )
449
+ """
450
+ _response = self._client_wrapper.httpx_client.request(
451
+ "DELETE",
452
+ urllib.parse.urljoin(
453
+ f"{self._client_wrapper.get_base_url()}/",
454
+ f"api/v1/projects/{project_id}/localevalset/{local_eval_set_id}",
455
+ ),
456
+ headers=self._client_wrapper.get_headers(),
457
+ timeout=60,
458
+ )
459
+ if 200 <= _response.status_code < 300:
460
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
461
+ if _response.status_code == 422:
462
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
463
+ try:
464
+ _response_json = _response.json()
465
+ except JSONDecodeError:
466
+ raise ApiError(status_code=_response.status_code, body=_response.text)
467
+ raise ApiError(status_code=_response.status_code, body=_response_json)
468
+
469
+ def get_promptmixin_prompts(self, project_id: str) -> typing.List[PromptMixinPrompts]:
470
+ """
471
+ Get all PromptMixin prompt sets for a project.
472
+
473
+ Parameters:
474
+ - project_id: str.
475
+ ---
476
+ from platform.client import PlatformApi
477
+
478
+ client = PlatformApi(
479
+ token="YOUR_TOKEN",
480
+ base_url="https://yourhost.com/path/to/api",
481
+ )
482
+ client.projects.get_promptmixin_prompts(
483
+ project_id="string",
484
+ )
485
+ """
486
+ _response = self._client_wrapper.httpx_client.request(
487
+ "GET",
488
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/prompts"),
489
+ headers=self._client_wrapper.get_headers(),
490
+ timeout=60,
491
+ )
492
+ if 200 <= _response.status_code < 300:
493
+ return pydantic.parse_obj_as(typing.List[PromptMixinPrompts], _response.json()) # type: ignore
494
+ if _response.status_code == 422:
495
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
496
+ try:
497
+ _response_json = _response.json()
498
+ except JSONDecodeError:
499
+ raise ApiError(status_code=_response.status_code, body=_response.text)
500
+ raise ApiError(status_code=_response.status_code, body=_response_json)
501
+
502
+ def create_prompt_mixin_prompts(self, project_id: str, *, request: PromptMixinPrompts) -> PromptMixinPrompts:
503
+ """
504
+ Create a new PromptMixin prompt set.
505
+
506
+ Parameters:
507
+ - project_id: str.
508
+
509
+ - request: PromptMixinPrompts.
510
+ ---
511
+ from platform import PromptMixinPrompts
512
+ from platform.client import PlatformApi
513
+
514
+ client = PlatformApi(
515
+ token="YOUR_TOKEN",
516
+ base_url="https://yourhost.com/path/to/api",
517
+ )
518
+ client.projects.create_prompt_mixin_prompts(
519
+ project_id="string",
520
+ request=PromptMixinPrompts(
521
+ project_id="string",
522
+ name="string",
523
+ prompts=[],
524
+ ),
525
+ )
526
+ """
527
+ _response = self._client_wrapper.httpx_client.request(
528
+ "POST",
529
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/prompts"),
530
+ json=jsonable_encoder(request),
531
+ headers=self._client_wrapper.get_headers(),
532
+ timeout=60,
533
+ )
534
+ if 200 <= _response.status_code < 300:
535
+ return pydantic.parse_obj_as(PromptMixinPrompts, _response.json()) # type: ignore
536
+ if _response.status_code == 422:
537
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
538
+ try:
539
+ _response_json = _response.json()
540
+ except JSONDecodeError:
541
+ raise ApiError(status_code=_response.status_code, body=_response.text)
542
+ raise ApiError(status_code=_response.status_code, body=_response_json)
543
+
544
+ def update_promptmixin_prompts(
545
+ self, project_id: str, prompt_set_id: str, *, request: PromptMixinPrompts
546
+ ) -> PromptMixinPrompts:
547
+ """
548
+ Update a PromptMixin prompt set.
549
+
550
+ Parameters:
551
+ - project_id: str.
552
+
553
+ - prompt_set_id: str.
554
+
555
+ - request: PromptMixinPrompts.
556
+ ---
557
+ from platform import PromptMixinPrompts
558
+ from platform.client import PlatformApi
559
+
560
+ client = PlatformApi(
561
+ token="YOUR_TOKEN",
562
+ base_url="https://yourhost.com/path/to/api",
563
+ )
564
+ client.projects.update_promptmixin_prompts(
565
+ project_id="string",
566
+ prompt_set_id="string",
567
+ request=PromptMixinPrompts(
568
+ project_id="string",
569
+ name="string",
570
+ prompts=[],
571
+ ),
572
+ )
573
+ """
574
+ _response = self._client_wrapper.httpx_client.request(
575
+ "PUT",
576
+ urllib.parse.urljoin(
577
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/prompts/{prompt_set_id}"
578
+ ),
579
+ json=jsonable_encoder(request),
580
+ headers=self._client_wrapper.get_headers(),
581
+ timeout=60,
582
+ )
583
+ if 200 <= _response.status_code < 300:
584
+ return pydantic.parse_obj_as(PromptMixinPrompts, _response.json()) # type: ignore
585
+ if _response.status_code == 422:
586
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
587
+ try:
588
+ _response_json = _response.json()
589
+ except JSONDecodeError:
590
+ raise ApiError(status_code=_response.status_code, body=_response.text)
591
+ raise ApiError(status_code=_response.status_code, body=_response_json)
592
+
593
+ def delete_prompt_mixin_prompts(self, project_id: str, prompt_set_id: str) -> typing.Any:
594
+ """
595
+ Delete a PromptMixin prompt set.
596
+
597
+ Parameters:
598
+ - project_id: str.
599
+
600
+ - prompt_set_id: str.
601
+ ---
602
+ from platform.client import PlatformApi
603
+
604
+ client = PlatformApi(
605
+ token="YOUR_TOKEN",
606
+ base_url="https://yourhost.com/path/to/api",
607
+ )
608
+ client.projects.delete_prompt_mixin_prompts(
609
+ project_id="string",
610
+ prompt_set_id="string",
611
+ )
612
+ """
613
+ _response = self._client_wrapper.httpx_client.request(
614
+ "DELETE",
615
+ urllib.parse.urljoin(
616
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/prompts/{prompt_set_id}"
617
+ ),
618
+ headers=self._client_wrapper.get_headers(),
619
+ timeout=60,
620
+ )
621
+ if 200 <= _response.status_code < 300:
622
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
623
+ if _response.status_code == 422:
624
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
625
+ try:
626
+ _response_json = _response.json()
627
+ except JSONDecodeError:
628
+ raise ApiError(status_code=_response.status_code, body=_response.text)
629
+ raise ApiError(status_code=_response.status_code, body=_response_json)
630
+
631
+
632
+ class AsyncProjectsClient:
633
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
634
+ self._client_wrapper = client_wrapper
635
+
636
+ async def list_projects(self, *, project_name: typing.Optional[str] = None) -> typing.List[Project]:
637
+ """
638
+ List projects or get one by name
639
+
640
+ Parameters:
641
+ - project_name: typing.Optional[str].
642
+ ---
643
+ from platform.client import AsyncPlatformApi
644
+
645
+ client = AsyncPlatformApi(
646
+ token="YOUR_TOKEN",
647
+ base_url="https://yourhost.com/path/to/api",
648
+ )
649
+ await client.projects.list_projects()
650
+ """
651
+ _response = await self._client_wrapper.httpx_client.request(
652
+ "GET",
653
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/projects"),
654
+ params=remove_none_from_dict({"project_name": project_name}),
655
+ headers=self._client_wrapper.get_headers(),
656
+ timeout=60,
657
+ )
658
+ if 200 <= _response.status_code < 300:
659
+ return pydantic.parse_obj_as(typing.List[Project], _response.json()) # type: ignore
660
+ if _response.status_code == 422:
661
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
662
+ try:
663
+ _response_json = _response.json()
664
+ except JSONDecodeError:
665
+ raise ApiError(status_code=_response.status_code, body=_response.text)
666
+ raise ApiError(status_code=_response.status_code, body=_response_json)
667
+
668
+ async def create_project(self, *, request: ProjectCreate) -> Project:
669
+ """
670
+ Create a new project.
671
+
672
+ Parameters:
673
+ - request: ProjectCreate.
674
+ ---
675
+ from platform import ProjectCreate
676
+ from platform.client import AsyncPlatformApi
677
+
678
+ client = AsyncPlatformApi(
679
+ token="YOUR_TOKEN",
680
+ base_url="https://yourhost.com/path/to/api",
681
+ )
682
+ await client.projects.create_project(
683
+ request=ProjectCreate(
684
+ name="string",
685
+ ),
686
+ )
687
+ """
688
+ _response = await self._client_wrapper.httpx_client.request(
689
+ "POST",
690
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/projects"),
691
+ json=jsonable_encoder(request),
692
+ headers=self._client_wrapper.get_headers(),
693
+ timeout=60,
694
+ )
695
+ if 200 <= _response.status_code < 300:
696
+ return pydantic.parse_obj_as(Project, _response.json()) # type: ignore
697
+ if _response.status_code == 422:
698
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
699
+ try:
700
+ _response_json = _response.json()
701
+ except JSONDecodeError:
702
+ raise ApiError(status_code=_response.status_code, body=_response.text)
703
+ raise ApiError(status_code=_response.status_code, body=_response_json)
704
+
705
+ async def upsert_project(self, *, request: ProjectCreate) -> Project:
706
+ """
707
+ Upsert a project.
708
+ Updates if a project with the same name already exists. Otherwise, creates a new project.
709
+
710
+ Parameters:
711
+ - request: ProjectCreate.
712
+ ---
713
+ from platform import ProjectCreate
714
+ from platform.client import AsyncPlatformApi
715
+
716
+ client = AsyncPlatformApi(
717
+ token="YOUR_TOKEN",
718
+ base_url="https://yourhost.com/path/to/api",
719
+ )
720
+ await client.projects.upsert_project(
721
+ request=ProjectCreate(
722
+ name="string",
723
+ ),
724
+ )
725
+ """
726
+ _response = await self._client_wrapper.httpx_client.request(
727
+ "PUT",
728
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/projects"),
729
+ json=jsonable_encoder(request),
730
+ headers=self._client_wrapper.get_headers(),
731
+ timeout=60,
732
+ )
733
+ if 200 <= _response.status_code < 300:
734
+ return pydantic.parse_obj_as(Project, _response.json()) # type: ignore
735
+ if _response.status_code == 422:
736
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
737
+ try:
738
+ _response_json = _response.json()
739
+ except JSONDecodeError:
740
+ raise ApiError(status_code=_response.status_code, body=_response.text)
741
+ raise ApiError(status_code=_response.status_code, body=_response_json)
742
+
743
+ async def get_project(self, project_id: str) -> Project:
744
+ """
745
+ Get a project by ID.
746
+
747
+ Parameters:
748
+ - project_id: str.
749
+ ---
750
+ from platform.client import AsyncPlatformApi
751
+
752
+ client = AsyncPlatformApi(
753
+ token="YOUR_TOKEN",
754
+ base_url="https://yourhost.com/path/to/api",
755
+ )
756
+ await client.projects.get_project(
757
+ project_id="string",
758
+ )
759
+ """
760
+ _response = await self._client_wrapper.httpx_client.request(
761
+ "GET",
762
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}"),
763
+ headers=self._client_wrapper.get_headers(),
764
+ timeout=60,
765
+ )
766
+ if 200 <= _response.status_code < 300:
767
+ return pydantic.parse_obj_as(Project, _response.json()) # type: ignore
768
+ if _response.status_code == 422:
769
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
770
+ try:
771
+ _response_json = _response.json()
772
+ except JSONDecodeError:
773
+ raise ApiError(status_code=_response.status_code, body=_response.text)
774
+ raise ApiError(status_code=_response.status_code, body=_response_json)
775
+
776
+ async def update_existing_project(self, project_id: str, *, name: str) -> Project:
777
+ """
778
+ Update an existing project.
779
+
780
+ Parameters:
781
+ - project_id: str.
782
+
783
+ - name: str.
784
+ ---
785
+ from platform.client import AsyncPlatformApi
786
+
787
+ client = AsyncPlatformApi(
788
+ token="YOUR_TOKEN",
789
+ base_url="https://yourhost.com/path/to/api",
790
+ )
791
+ await client.projects.update_existing_project(
792
+ project_id="string",
793
+ name="string",
794
+ )
795
+ """
796
+ _response = await self._client_wrapper.httpx_client.request(
797
+ "PUT",
798
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}"),
799
+ json=jsonable_encoder({"name": name}),
800
+ headers=self._client_wrapper.get_headers(),
801
+ timeout=60,
802
+ )
803
+ if 200 <= _response.status_code < 300:
804
+ return pydantic.parse_obj_as(Project, _response.json()) # type: ignore
805
+ if _response.status_code == 422:
806
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
807
+ try:
808
+ _response_json = _response.json()
809
+ except JSONDecodeError:
810
+ raise ApiError(status_code=_response.status_code, body=_response.text)
811
+ raise ApiError(status_code=_response.status_code, body=_response_json)
812
+
813
+ async def delete_project(self, project_id: str) -> None:
814
+ """
815
+ Delete a project by ID.
816
+
817
+ Parameters:
818
+ - project_id: str.
819
+ ---
820
+ from platform.client import AsyncPlatformApi
821
+
822
+ client = AsyncPlatformApi(
823
+ token="YOUR_TOKEN",
824
+ base_url="https://yourhost.com/path/to/api",
825
+ )
826
+ await client.projects.delete_project(
827
+ project_id="string",
828
+ )
829
+ """
830
+ _response = await self._client_wrapper.httpx_client.request(
831
+ "DELETE",
832
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}"),
833
+ headers=self._client_wrapper.get_headers(),
834
+ timeout=60,
835
+ )
836
+ if 200 <= _response.status_code < 300:
837
+ return
838
+ if _response.status_code == 422:
839
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
840
+ try:
841
+ _response_json = _response.json()
842
+ except JSONDecodeError:
843
+ raise ApiError(status_code=_response.status_code, body=_response.text)
844
+ raise ApiError(status_code=_response.status_code, body=_response_json)
845
+
846
+ async def get_datasets_for_project(self, project_id: str) -> typing.List[EvalDataset]:
847
+ """
848
+ Get all eval datasets for a project.
849
+
850
+ Parameters:
851
+ - project_id: str.
852
+ ---
853
+ from platform.client import AsyncPlatformApi
854
+
855
+ client = AsyncPlatformApi(
856
+ token="YOUR_TOKEN",
857
+ base_url="https://yourhost.com/path/to/api",
858
+ )
859
+ await client.projects.get_datasets_for_project(
860
+ project_id="string",
861
+ )
862
+ """
863
+ _response = await self._client_wrapper.httpx_client.request(
864
+ "GET",
865
+ urllib.parse.urljoin(
866
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/eval/dataset"
867
+ ),
868
+ headers=self._client_wrapper.get_headers(),
869
+ timeout=60,
870
+ )
871
+ if 200 <= _response.status_code < 300:
872
+ return pydantic.parse_obj_as(typing.List[EvalDataset], _response.json()) # type: ignore
873
+ if _response.status_code == 422:
874
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
875
+ try:
876
+ _response_json = _response.json()
877
+ except JSONDecodeError:
878
+ raise ApiError(status_code=_response.status_code, body=_response.text)
879
+ raise ApiError(status_code=_response.status_code, body=_response_json)
880
+
881
+ async def create_eval_dataset_for_project(self, project_id: str, *, name: str) -> EvalDataset:
882
+ """
883
+ Create a new eval dataset for a project.
884
+
885
+ Parameters:
886
+ - project_id: str.
887
+
888
+ - name: str. The name of the EvalDataset.
889
+ ---
890
+ from platform.client import AsyncPlatformApi
891
+
892
+ client = AsyncPlatformApi(
893
+ token="YOUR_TOKEN",
894
+ base_url="https://yourhost.com/path/to/api",
895
+ )
896
+ await client.projects.create_eval_dataset_for_project(
897
+ project_id="string",
898
+ name="string",
899
+ )
900
+ """
901
+ _response = await self._client_wrapper.httpx_client.request(
902
+ "POST",
903
+ urllib.parse.urljoin(
904
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/eval/dataset"
905
+ ),
906
+ json=jsonable_encoder({"name": name}),
907
+ headers=self._client_wrapper.get_headers(),
908
+ timeout=60,
909
+ )
910
+ if 200 <= _response.status_code < 300:
911
+ return pydantic.parse_obj_as(EvalDataset, _response.json()) # type: ignore
912
+ if _response.status_code == 422:
913
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
914
+ try:
915
+ _response_json = _response.json()
916
+ except JSONDecodeError:
917
+ raise ApiError(status_code=_response.status_code, body=_response.text)
918
+ raise ApiError(status_code=_response.status_code, body=_response_json)
919
+
920
+ async def create_local_eval_set_for_project(
921
+ self, project_id: str, *, app_name: str, results: typing.Dict[str, typing.List[LocalEval]]
922
+ ) -> typing.List[LocalEvalResults]:
923
+ """
924
+ Create a new local eval set.
925
+
926
+ Parameters:
927
+ - project_id: str.
928
+
929
+ - app_name: str. The name of the app.
930
+
931
+ - results: typing.Dict[str, typing.List[LocalEval]]. The eval results.
932
+ ---
933
+ from platform.client import AsyncPlatformApi
934
+
935
+ client = AsyncPlatformApi(
936
+ token="YOUR_TOKEN",
937
+ base_url="https://yourhost.com/path/to/api",
938
+ )
939
+ await client.projects.create_local_eval_set_for_project(
940
+ project_id="string",
941
+ app_name="string",
942
+ results={"string": []},
943
+ )
944
+ """
945
+ _response = await self._client_wrapper.httpx_client.request(
946
+ "POST",
947
+ urllib.parse.urljoin(
948
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/localevalset"
949
+ ),
950
+ json=jsonable_encoder({"app_name": app_name, "results": results}),
951
+ headers=self._client_wrapper.get_headers(),
952
+ timeout=60,
953
+ )
954
+ if 200 <= _response.status_code < 300:
955
+ return pydantic.parse_obj_as(typing.List[LocalEvalResults], _response.json()) # type: ignore
956
+ if _response.status_code == 422:
957
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
958
+ try:
959
+ _response_json = _response.json()
960
+ except JSONDecodeError:
961
+ raise ApiError(status_code=_response.status_code, body=_response.text)
962
+ raise ApiError(status_code=_response.status_code, body=_response_json)
963
+
964
+ async def get_local_evals_for_project(self, project_id: str) -> typing.List[LocalEvalResults]:
965
+ """
966
+ Get all local eval results for a project.
967
+
968
+ Parameters:
969
+ - project_id: str.
970
+ ---
971
+ from platform.client import AsyncPlatformApi
972
+
973
+ client = AsyncPlatformApi(
974
+ token="YOUR_TOKEN",
975
+ base_url="https://yourhost.com/path/to/api",
976
+ )
977
+ await client.projects.get_local_evals_for_project(
978
+ project_id="string",
979
+ )
980
+ """
981
+ _response = await self._client_wrapper.httpx_client.request(
982
+ "GET",
983
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/localeval"),
984
+ headers=self._client_wrapper.get_headers(),
985
+ timeout=60,
986
+ )
987
+ if 200 <= _response.status_code < 300:
988
+ return pydantic.parse_obj_as(typing.List[LocalEvalResults], _response.json()) # type: ignore
989
+ if _response.status_code == 422:
990
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
991
+ try:
992
+ _response_json = _response.json()
993
+ except JSONDecodeError:
994
+ raise ApiError(status_code=_response.status_code, body=_response.text)
995
+ raise ApiError(status_code=_response.status_code, body=_response_json)
996
+
997
+ async def get_local_eval_sets_for_project(self, project_id: str) -> typing.List[LocalEvalSets]:
998
+ """
999
+ Get all local eval sets for a project.
1000
+
1001
+ Parameters:
1002
+ - project_id: str.
1003
+ ---
1004
+ from platform.client import AsyncPlatformApi
1005
+
1006
+ client = AsyncPlatformApi(
1007
+ token="YOUR_TOKEN",
1008
+ base_url="https://yourhost.com/path/to/api",
1009
+ )
1010
+ await client.projects.get_local_eval_sets_for_project(
1011
+ project_id="string",
1012
+ )
1013
+ """
1014
+ _response = await self._client_wrapper.httpx_client.request(
1015
+ "GET",
1016
+ urllib.parse.urljoin(
1017
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/localevalsets"
1018
+ ),
1019
+ headers=self._client_wrapper.get_headers(),
1020
+ timeout=60,
1021
+ )
1022
+ if 200 <= _response.status_code < 300:
1023
+ return pydantic.parse_obj_as(typing.List[LocalEvalSets], _response.json()) # type: ignore
1024
+ if _response.status_code == 422:
1025
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1026
+ try:
1027
+ _response_json = _response.json()
1028
+ except JSONDecodeError:
1029
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1030
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1031
+
1032
+ async def delete_local_eval_set(self, project_id: str, local_eval_set_id: str) -> typing.Any:
1033
+ """
1034
+ Delete a local eval set.
1035
+
1036
+ Parameters:
1037
+ - project_id: str.
1038
+
1039
+ - local_eval_set_id: str.
1040
+ ---
1041
+ from platform.client import AsyncPlatformApi
1042
+
1043
+ client = AsyncPlatformApi(
1044
+ token="YOUR_TOKEN",
1045
+ base_url="https://yourhost.com/path/to/api",
1046
+ )
1047
+ await client.projects.delete_local_eval_set(
1048
+ project_id="string",
1049
+ local_eval_set_id="string",
1050
+ )
1051
+ """
1052
+ _response = await self._client_wrapper.httpx_client.request(
1053
+ "DELETE",
1054
+ urllib.parse.urljoin(
1055
+ f"{self._client_wrapper.get_base_url()}/",
1056
+ f"api/v1/projects/{project_id}/localevalset/{local_eval_set_id}",
1057
+ ),
1058
+ headers=self._client_wrapper.get_headers(),
1059
+ timeout=60,
1060
+ )
1061
+ if 200 <= _response.status_code < 300:
1062
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
1063
+ if _response.status_code == 422:
1064
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1065
+ try:
1066
+ _response_json = _response.json()
1067
+ except JSONDecodeError:
1068
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1069
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1070
+
1071
+ async def get_promptmixin_prompts(self, project_id: str) -> typing.List[PromptMixinPrompts]:
1072
+ """
1073
+ Get all PromptMixin prompt sets for a project.
1074
+
1075
+ Parameters:
1076
+ - project_id: str.
1077
+ ---
1078
+ from platform.client import AsyncPlatformApi
1079
+
1080
+ client = AsyncPlatformApi(
1081
+ token="YOUR_TOKEN",
1082
+ base_url="https://yourhost.com/path/to/api",
1083
+ )
1084
+ await client.projects.get_promptmixin_prompts(
1085
+ project_id="string",
1086
+ )
1087
+ """
1088
+ _response = await self._client_wrapper.httpx_client.request(
1089
+ "GET",
1090
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/prompts"),
1091
+ headers=self._client_wrapper.get_headers(),
1092
+ timeout=60,
1093
+ )
1094
+ if 200 <= _response.status_code < 300:
1095
+ return pydantic.parse_obj_as(typing.List[PromptMixinPrompts], _response.json()) # type: ignore
1096
+ if _response.status_code == 422:
1097
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1098
+ try:
1099
+ _response_json = _response.json()
1100
+ except JSONDecodeError:
1101
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1102
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1103
+
1104
+ async def create_prompt_mixin_prompts(self, project_id: str, *, request: PromptMixinPrompts) -> PromptMixinPrompts:
1105
+ """
1106
+ Create a new PromptMixin prompt set.
1107
+
1108
+ Parameters:
1109
+ - project_id: str.
1110
+
1111
+ - request: PromptMixinPrompts.
1112
+ ---
1113
+ from platform import PromptMixinPrompts
1114
+ from platform.client import AsyncPlatformApi
1115
+
1116
+ client = AsyncPlatformApi(
1117
+ token="YOUR_TOKEN",
1118
+ base_url="https://yourhost.com/path/to/api",
1119
+ )
1120
+ await client.projects.create_prompt_mixin_prompts(
1121
+ project_id="string",
1122
+ request=PromptMixinPrompts(
1123
+ project_id="string",
1124
+ name="string",
1125
+ prompts=[],
1126
+ ),
1127
+ )
1128
+ """
1129
+ _response = await self._client_wrapper.httpx_client.request(
1130
+ "POST",
1131
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/prompts"),
1132
+ json=jsonable_encoder(request),
1133
+ headers=self._client_wrapper.get_headers(),
1134
+ timeout=60,
1135
+ )
1136
+ if 200 <= _response.status_code < 300:
1137
+ return pydantic.parse_obj_as(PromptMixinPrompts, _response.json()) # type: ignore
1138
+ if _response.status_code == 422:
1139
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1140
+ try:
1141
+ _response_json = _response.json()
1142
+ except JSONDecodeError:
1143
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1144
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1145
+
1146
+ async def update_promptmixin_prompts(
1147
+ self, project_id: str, prompt_set_id: str, *, request: PromptMixinPrompts
1148
+ ) -> PromptMixinPrompts:
1149
+ """
1150
+ Update a PromptMixin prompt set.
1151
+
1152
+ Parameters:
1153
+ - project_id: str.
1154
+
1155
+ - prompt_set_id: str.
1156
+
1157
+ - request: PromptMixinPrompts.
1158
+ ---
1159
+ from platform import PromptMixinPrompts
1160
+ from platform.client import AsyncPlatformApi
1161
+
1162
+ client = AsyncPlatformApi(
1163
+ token="YOUR_TOKEN",
1164
+ base_url="https://yourhost.com/path/to/api",
1165
+ )
1166
+ await client.projects.update_promptmixin_prompts(
1167
+ project_id="string",
1168
+ prompt_set_id="string",
1169
+ request=PromptMixinPrompts(
1170
+ project_id="string",
1171
+ name="string",
1172
+ prompts=[],
1173
+ ),
1174
+ )
1175
+ """
1176
+ _response = await self._client_wrapper.httpx_client.request(
1177
+ "PUT",
1178
+ urllib.parse.urljoin(
1179
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/prompts/{prompt_set_id}"
1180
+ ),
1181
+ json=jsonable_encoder(request),
1182
+ headers=self._client_wrapper.get_headers(),
1183
+ timeout=60,
1184
+ )
1185
+ if 200 <= _response.status_code < 300:
1186
+ return pydantic.parse_obj_as(PromptMixinPrompts, _response.json()) # type: ignore
1187
+ if _response.status_code == 422:
1188
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1189
+ try:
1190
+ _response_json = _response.json()
1191
+ except JSONDecodeError:
1192
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1193
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1194
+
1195
+ async def delete_prompt_mixin_prompts(self, project_id: str, prompt_set_id: str) -> typing.Any:
1196
+ """
1197
+ Delete a PromptMixin prompt set.
1198
+
1199
+ Parameters:
1200
+ - project_id: str.
1201
+
1202
+ - prompt_set_id: str.
1203
+ ---
1204
+ from platform.client import AsyncPlatformApi
1205
+
1206
+ client = AsyncPlatformApi(
1207
+ token="YOUR_TOKEN",
1208
+ base_url="https://yourhost.com/path/to/api",
1209
+ )
1210
+ await client.projects.delete_prompt_mixin_prompts(
1211
+ project_id="string",
1212
+ prompt_set_id="string",
1213
+ )
1214
+ """
1215
+ _response = await self._client_wrapper.httpx_client.request(
1216
+ "DELETE",
1217
+ urllib.parse.urljoin(
1218
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/projects/{project_id}/prompts/{prompt_set_id}"
1219
+ ),
1220
+ headers=self._client_wrapper.get_headers(),
1221
+ timeout=60,
1222
+ )
1223
+ if 200 <= _response.status_code < 300:
1224
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
1225
+ if _response.status_code == 422:
1226
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1227
+ try:
1228
+ _response_json = _response.json()
1229
+ except JSONDecodeError:
1230
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1231
+ raise ApiError(status_code=_response.status_code, body=_response_json)