agenta 0.13.0a0__py3-none-any.whl → 0.13.0a2__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 agenta might be problematic. Click here for more details.
- agenta/__init__.py +1 -0
- agenta/client/backend/client.py +169 -50
- agenta/client/backend/core/api_error.py +3 -1
- agenta/client/backend/core/datetime_utils.py +3 -1
- agenta/client/backend/core/jsonable_encoder.py +9 -3
- agenta/client/backend/resources/__init__.py +12 -1
- agenta/client/backend/resources/apps/__init__.py +0 -1
- agenta/client/backend/resources/apps/client.py +88 -26
- agenta/client/backend/resources/bases/__init__.py +0 -1
- agenta/client/backend/resources/bases/client.py +8 -2
- agenta/client/backend/resources/configs/__init__.py +0 -1
- agenta/client/backend/resources/configs/client.py +58 -14
- agenta/client/backend/resources/containers/client.py +46 -14
- agenta/client/backend/resources/environments/__init__.py +0 -1
- agenta/client/backend/resources/environments/client.py +18 -6
- agenta/client/backend/resources/evaluations/__init__.py +0 -1
- agenta/client/backend/resources/evaluations/client.py +86 -26
- agenta/client/backend/resources/evaluators/__init__.py +0 -1
- agenta/client/backend/resources/evaluators/client.py +57 -17
- agenta/client/backend/resources/observability/__init__.py +0 -1
- agenta/client/backend/resources/observability/client.py +100 -30
- agenta/client/backend/resources/testsets/__init__.py +0 -1
- agenta/client/backend/resources/testsets/client.py +56 -16
- agenta/client/backend/resources/variants/client.py +92 -26
- agenta/client/backend/resources/variants/types/__init__.py +3 -1
- agenta/client/backend/types/aggregated_result.py +10 -2
- agenta/client/backend/types/aggregated_result_evaluator_config.py +3 -1
- agenta/client/backend/types/app.py +10 -2
- agenta/client/backend/types/app_variant_response.py +10 -2
- agenta/client/backend/types/app_variant_revision.py +10 -2
- agenta/client/backend/types/base_output.py +10 -2
- agenta/client/backend/types/body_import_testset.py +10 -2
- agenta/client/backend/types/config_db.py +10 -2
- agenta/client/backend/types/create_app_output.py +10 -2
- agenta/client/backend/types/create_span.py +11 -2
- agenta/client/backend/types/create_trace_response.py +10 -2
- agenta/client/backend/types/docker_env_vars.py +10 -2
- agenta/client/backend/types/environment_output.py +10 -2
- agenta/client/backend/types/environment_output_extended.py +10 -2
- agenta/client/backend/types/environment_revision.py +10 -2
- agenta/client/backend/types/error.py +10 -2
- agenta/client/backend/types/evaluation.py +10 -2
- agenta/client/backend/types/evaluation_scenario.py +10 -2
- agenta/client/backend/types/evaluation_scenario_input.py +10 -2
- agenta/client/backend/types/evaluation_scenario_output.py +10 -2
- agenta/client/backend/types/evaluation_scenario_result.py +10 -2
- agenta/client/backend/types/evaluation_scenario_score_update.py +10 -2
- agenta/client/backend/types/evaluation_type.py +3 -1
- agenta/client/backend/types/evaluation_webhook.py +10 -2
- agenta/client/backend/types/evaluator.py +10 -2
- agenta/client/backend/types/evaluator_config.py +10 -2
- agenta/client/backend/types/feedback.py +10 -2
- agenta/client/backend/types/get_config_response.py +10 -3
- agenta/client/backend/types/http_validation_error.py +10 -2
- agenta/client/backend/types/human_evaluation.py +10 -2
- agenta/client/backend/types/human_evaluation_scenario.py +10 -2
- agenta/client/backend/types/human_evaluation_scenario_input.py +10 -2
- agenta/client/backend/types/human_evaluation_scenario_output.py +10 -2
- agenta/client/backend/types/human_evaluation_scenario_update.py +10 -2
- agenta/client/backend/types/human_evaluation_update.py +10 -2
- agenta/client/backend/types/image.py +10 -2
- agenta/client/backend/types/invite_request.py +10 -2
- agenta/client/backend/types/list_api_keys_response.py +10 -2
- agenta/client/backend/types/llm_run_rate_limit.py +10 -2
- agenta/client/backend/types/llm_tokens.py +10 -2
- agenta/client/backend/types/new_human_evaluation.py +10 -2
- agenta/client/backend/types/new_testset.py +10 -2
- agenta/client/backend/types/organization.py +10 -2
- agenta/client/backend/types/organization_output.py +10 -2
- agenta/client/backend/types/result.py +10 -2
- agenta/client/backend/types/simple_evaluation_output.py +10 -2
- agenta/client/backend/types/span.py +10 -2
- agenta/client/backend/types/span_detail.py +10 -2
- agenta/client/backend/types/span_variant.py +10 -2
- agenta/client/backend/types/template.py +10 -2
- agenta/client/backend/types/template_image_info.py +10 -2
- agenta/client/backend/types/test_set_output_response.py +10 -2
- agenta/client/backend/types/test_set_simple_response.py +10 -2
- agenta/client/backend/types/trace_detail.py +10 -2
- agenta/client/backend/types/uri.py +10 -2
- agenta/client/backend/types/validation_error.py +10 -2
- agenta/client/backend/types/variant_action.py +10 -2
- agenta/client/backend/types/variant_action_enum.py +3 -1
- agenta/client/backend/types/with_pagination.py +10 -2
- agenta/client/backend/types/workspace_member_response.py +10 -2
- agenta/client/backend/types/workspace_permission.py +10 -2
- agenta/client/backend/types/workspace_response.py +10 -2
- agenta/client/backend/types/workspace_role_response.py +10 -2
- agenta/sdk/__init__.py +1 -0
- agenta/sdk/agenta_decorator.py +11 -3
- agenta/sdk/agenta_init.py +3 -1
- agenta/sdk/tracing/llm_tracing.py +35 -18
- agenta/sdk/types.py +38 -0
- {agenta-0.13.0a0.dist-info → agenta-0.13.0a2.dist-info}/METADATA +46 -96
- agenta-0.13.0a2.dist-info/RECORD +161 -0
- agenta-0.13.0a0.dist-info/RECORD +0 -161
- {agenta-0.13.0a0.dist-info → agenta-0.13.0a2.dist-info}/WHEEL +0 -0
- {agenta-0.13.0a0.dist-info → agenta-0.13.0a2.dist-info}/entry_points.txt +0 -0
|
@@ -55,7 +55,9 @@ class AppsClient:
|
|
|
55
55
|
"""
|
|
56
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
57
57
|
"GET",
|
|
58
|
-
urllib.parse.urljoin(
|
|
58
|
+
urllib.parse.urljoin(
|
|
59
|
+
f"{self._client_wrapper.get_base_url()}/", f"apps/{app_id}/variants"
|
|
60
|
+
),
|
|
59
61
|
headers=self._client_wrapper.get_headers(),
|
|
60
62
|
timeout=60,
|
|
61
63
|
)
|
|
@@ -69,7 +71,9 @@ class AppsClient:
|
|
|
69
71
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
70
72
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
71
73
|
|
|
72
|
-
def get_variant_by_env(
|
|
74
|
+
def get_variant_by_env(
|
|
75
|
+
self, *, app_id: str, environment: str
|
|
76
|
+
) -> AppVariantResponse:
|
|
73
77
|
"""
|
|
74
78
|
Retrieve the app variant based on the provided app_id and environment.
|
|
75
79
|
|
|
@@ -102,8 +106,12 @@ class AppsClient:
|
|
|
102
106
|
"""
|
|
103
107
|
_response = self._client_wrapper.httpx_client.request(
|
|
104
108
|
"GET",
|
|
105
|
-
urllib.parse.urljoin(
|
|
106
|
-
|
|
109
|
+
urllib.parse.urljoin(
|
|
110
|
+
f"{self._client_wrapper.get_base_url()}/", "apps/get_variant_by_env"
|
|
111
|
+
),
|
|
112
|
+
params=remove_none_from_dict(
|
|
113
|
+
{"app_id": app_id, "environment": environment}
|
|
114
|
+
),
|
|
107
115
|
headers=self._client_wrapper.get_headers(),
|
|
108
116
|
timeout=60,
|
|
109
117
|
)
|
|
@@ -156,7 +164,9 @@ class AppsClient:
|
|
|
156
164
|
_response = self._client_wrapper.httpx_client.request(
|
|
157
165
|
"GET",
|
|
158
166
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "apps"),
|
|
159
|
-
params=remove_none_from_dict(
|
|
167
|
+
params=remove_none_from_dict(
|
|
168
|
+
{"app_name": app_name, "org_id": org_id, "workspace_id": workspace_id}
|
|
169
|
+
),
|
|
160
170
|
headers=self._client_wrapper.get_headers(),
|
|
161
171
|
timeout=60,
|
|
162
172
|
)
|
|
@@ -171,7 +181,11 @@ class AppsClient:
|
|
|
171
181
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
172
182
|
|
|
173
183
|
def create_app(
|
|
174
|
-
self,
|
|
184
|
+
self,
|
|
185
|
+
*,
|
|
186
|
+
app_name: str,
|
|
187
|
+
organization_id: typing.Optional[str] = OMIT,
|
|
188
|
+
workspace_id: typing.Optional[str] = OMIT,
|
|
175
189
|
) -> CreateAppOutput:
|
|
176
190
|
"""
|
|
177
191
|
Create a new app for a user or organization.
|
|
@@ -275,14 +289,21 @@ class AppsClient:
|
|
|
275
289
|
tags="tags",
|
|
276
290
|
)
|
|
277
291
|
"""
|
|
278
|
-
_request: typing.Dict[str, typing.Any] = {
|
|
292
|
+
_request: typing.Dict[str, typing.Any] = {
|
|
293
|
+
"variant_name": variant_name,
|
|
294
|
+
"docker_id": docker_id,
|
|
295
|
+
"tags": tags,
|
|
296
|
+
}
|
|
279
297
|
if base_name is not OMIT:
|
|
280
298
|
_request["base_name"] = base_name
|
|
281
299
|
if config_name is not OMIT:
|
|
282
300
|
_request["config_name"] = config_name
|
|
283
301
|
_response = self._client_wrapper.httpx_client.request(
|
|
284
302
|
"POST",
|
|
285
|
-
urllib.parse.urljoin(
|
|
303
|
+
urllib.parse.urljoin(
|
|
304
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
305
|
+
f"apps/{app_id}/variant/from-image",
|
|
306
|
+
),
|
|
286
307
|
json=jsonable_encoder(_request),
|
|
287
308
|
headers=self._client_wrapper.get_headers(),
|
|
288
309
|
timeout=60,
|
|
@@ -319,7 +340,9 @@ class AppsClient:
|
|
|
319
340
|
"""
|
|
320
341
|
_response = self._client_wrapper.httpx_client.request(
|
|
321
342
|
"DELETE",
|
|
322
|
-
urllib.parse.urljoin(
|
|
343
|
+
urllib.parse.urljoin(
|
|
344
|
+
f"{self._client_wrapper.get_base_url()}/", f"apps/{app_id}"
|
|
345
|
+
),
|
|
323
346
|
headers=self._client_wrapper.get_headers(),
|
|
324
347
|
timeout=60,
|
|
325
348
|
)
|
|
@@ -389,7 +412,10 @@ class AppsClient:
|
|
|
389
412
|
_request["workspace_id"] = workspace_id
|
|
390
413
|
_response = self._client_wrapper.httpx_client.request(
|
|
391
414
|
"POST",
|
|
392
|
-
urllib.parse.urljoin(
|
|
415
|
+
urllib.parse.urljoin(
|
|
416
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
417
|
+
"apps/app_and_variant_from_template",
|
|
418
|
+
),
|
|
393
419
|
json=jsonable_encoder(_request),
|
|
394
420
|
headers=self._client_wrapper.get_headers(),
|
|
395
421
|
timeout=60,
|
|
@@ -430,7 +456,9 @@ class AppsClient:
|
|
|
430
456
|
"""
|
|
431
457
|
_response = self._client_wrapper.httpx_client.request(
|
|
432
458
|
"GET",
|
|
433
|
-
urllib.parse.urljoin(
|
|
459
|
+
urllib.parse.urljoin(
|
|
460
|
+
f"{self._client_wrapper.get_base_url()}/", f"apps/{app_id}/environments"
|
|
461
|
+
),
|
|
434
462
|
headers=self._client_wrapper.get_headers(),
|
|
435
463
|
timeout=60,
|
|
436
464
|
)
|
|
@@ -444,7 +472,9 @@ class AppsClient:
|
|
|
444
472
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
445
473
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
446
474
|
|
|
447
|
-
def environment_revisions(
|
|
475
|
+
def environment_revisions(
|
|
476
|
+
self, app_id: str, environment_name: typing.Any
|
|
477
|
+
) -> EnvironmentOutputExtended:
|
|
448
478
|
"""
|
|
449
479
|
Parameters:
|
|
450
480
|
- app_id: str.
|
|
@@ -454,7 +484,8 @@ class AppsClient:
|
|
|
454
484
|
_response = self._client_wrapper.httpx_client.request(
|
|
455
485
|
"GET",
|
|
456
486
|
urllib.parse.urljoin(
|
|
457
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
487
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
488
|
+
f"apps/{app_id}/revisions/{environment_name}",
|
|
458
489
|
),
|
|
459
490
|
headers=self._client_wrapper.get_headers(),
|
|
460
491
|
timeout=60,
|
|
@@ -500,7 +531,9 @@ class AsyncAppsClient:
|
|
|
500
531
|
"""
|
|
501
532
|
_response = await self._client_wrapper.httpx_client.request(
|
|
502
533
|
"GET",
|
|
503
|
-
urllib.parse.urljoin(
|
|
534
|
+
urllib.parse.urljoin(
|
|
535
|
+
f"{self._client_wrapper.get_base_url()}/", f"apps/{app_id}/variants"
|
|
536
|
+
),
|
|
504
537
|
headers=self._client_wrapper.get_headers(),
|
|
505
538
|
timeout=60,
|
|
506
539
|
)
|
|
@@ -514,7 +547,9 @@ class AsyncAppsClient:
|
|
|
514
547
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
515
548
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
516
549
|
|
|
517
|
-
async def get_variant_by_env(
|
|
550
|
+
async def get_variant_by_env(
|
|
551
|
+
self, *, app_id: str, environment: str
|
|
552
|
+
) -> AppVariantResponse:
|
|
518
553
|
"""
|
|
519
554
|
Retrieve the app variant based on the provided app_id and environment.
|
|
520
555
|
|
|
@@ -547,8 +582,12 @@ class AsyncAppsClient:
|
|
|
547
582
|
"""
|
|
548
583
|
_response = await self._client_wrapper.httpx_client.request(
|
|
549
584
|
"GET",
|
|
550
|
-
urllib.parse.urljoin(
|
|
551
|
-
|
|
585
|
+
urllib.parse.urljoin(
|
|
586
|
+
f"{self._client_wrapper.get_base_url()}/", "apps/get_variant_by_env"
|
|
587
|
+
),
|
|
588
|
+
params=remove_none_from_dict(
|
|
589
|
+
{"app_id": app_id, "environment": environment}
|
|
590
|
+
),
|
|
552
591
|
headers=self._client_wrapper.get_headers(),
|
|
553
592
|
timeout=60,
|
|
554
593
|
)
|
|
@@ -601,7 +640,9 @@ class AsyncAppsClient:
|
|
|
601
640
|
_response = await self._client_wrapper.httpx_client.request(
|
|
602
641
|
"GET",
|
|
603
642
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "apps"),
|
|
604
|
-
params=remove_none_from_dict(
|
|
643
|
+
params=remove_none_from_dict(
|
|
644
|
+
{"app_name": app_name, "org_id": org_id, "workspace_id": workspace_id}
|
|
645
|
+
),
|
|
605
646
|
headers=self._client_wrapper.get_headers(),
|
|
606
647
|
timeout=60,
|
|
607
648
|
)
|
|
@@ -616,7 +657,11 @@ class AsyncAppsClient:
|
|
|
616
657
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
617
658
|
|
|
618
659
|
async def create_app(
|
|
619
|
-
self,
|
|
660
|
+
self,
|
|
661
|
+
*,
|
|
662
|
+
app_name: str,
|
|
663
|
+
organization_id: typing.Optional[str] = OMIT,
|
|
664
|
+
workspace_id: typing.Optional[str] = OMIT,
|
|
620
665
|
) -> CreateAppOutput:
|
|
621
666
|
"""
|
|
622
667
|
Create a new app for a user or organization.
|
|
@@ -720,14 +765,21 @@ class AsyncAppsClient:
|
|
|
720
765
|
tags="tags",
|
|
721
766
|
)
|
|
722
767
|
"""
|
|
723
|
-
_request: typing.Dict[str, typing.Any] = {
|
|
768
|
+
_request: typing.Dict[str, typing.Any] = {
|
|
769
|
+
"variant_name": variant_name,
|
|
770
|
+
"docker_id": docker_id,
|
|
771
|
+
"tags": tags,
|
|
772
|
+
}
|
|
724
773
|
if base_name is not OMIT:
|
|
725
774
|
_request["base_name"] = base_name
|
|
726
775
|
if config_name is not OMIT:
|
|
727
776
|
_request["config_name"] = config_name
|
|
728
777
|
_response = await self._client_wrapper.httpx_client.request(
|
|
729
778
|
"POST",
|
|
730
|
-
urllib.parse.urljoin(
|
|
779
|
+
urllib.parse.urljoin(
|
|
780
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
781
|
+
f"apps/{app_id}/variant/from-image",
|
|
782
|
+
),
|
|
731
783
|
json=jsonable_encoder(_request),
|
|
732
784
|
headers=self._client_wrapper.get_headers(),
|
|
733
785
|
timeout=60,
|
|
@@ -764,7 +816,9 @@ class AsyncAppsClient:
|
|
|
764
816
|
"""
|
|
765
817
|
_response = await self._client_wrapper.httpx_client.request(
|
|
766
818
|
"DELETE",
|
|
767
|
-
urllib.parse.urljoin(
|
|
819
|
+
urllib.parse.urljoin(
|
|
820
|
+
f"{self._client_wrapper.get_base_url()}/", f"apps/{app_id}"
|
|
821
|
+
),
|
|
768
822
|
headers=self._client_wrapper.get_headers(),
|
|
769
823
|
timeout=60,
|
|
770
824
|
)
|
|
@@ -834,7 +888,10 @@ class AsyncAppsClient:
|
|
|
834
888
|
_request["workspace_id"] = workspace_id
|
|
835
889
|
_response = await self._client_wrapper.httpx_client.request(
|
|
836
890
|
"POST",
|
|
837
|
-
urllib.parse.urljoin(
|
|
891
|
+
urllib.parse.urljoin(
|
|
892
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
893
|
+
"apps/app_and_variant_from_template",
|
|
894
|
+
),
|
|
838
895
|
json=jsonable_encoder(_request),
|
|
839
896
|
headers=self._client_wrapper.get_headers(),
|
|
840
897
|
timeout=60,
|
|
@@ -875,7 +932,9 @@ class AsyncAppsClient:
|
|
|
875
932
|
"""
|
|
876
933
|
_response = await self._client_wrapper.httpx_client.request(
|
|
877
934
|
"GET",
|
|
878
|
-
urllib.parse.urljoin(
|
|
935
|
+
urllib.parse.urljoin(
|
|
936
|
+
f"{self._client_wrapper.get_base_url()}/", f"apps/{app_id}/environments"
|
|
937
|
+
),
|
|
879
938
|
headers=self._client_wrapper.get_headers(),
|
|
880
939
|
timeout=60,
|
|
881
940
|
)
|
|
@@ -889,7 +948,9 @@ class AsyncAppsClient:
|
|
|
889
948
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
890
949
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
891
950
|
|
|
892
|
-
async def environment_revisions(
|
|
951
|
+
async def environment_revisions(
|
|
952
|
+
self, app_id: str, environment_name: typing.Any
|
|
953
|
+
) -> EnvironmentOutputExtended:
|
|
893
954
|
"""
|
|
894
955
|
Parameters:
|
|
895
956
|
- app_id: str.
|
|
@@ -899,7 +960,8 @@ class AsyncAppsClient:
|
|
|
899
960
|
_response = await self._client_wrapper.httpx_client.request(
|
|
900
961
|
"GET",
|
|
901
962
|
urllib.parse.urljoin(
|
|
902
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
963
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
964
|
+
f"apps/{app_id}/revisions/{environment_name}",
|
|
903
965
|
),
|
|
904
966
|
headers=self._client_wrapper.get_headers(),
|
|
905
967
|
timeout=60,
|
|
@@ -22,7 +22,10 @@ class BasesClient:
|
|
|
22
22
|
self._client_wrapper = client_wrapper
|
|
23
23
|
|
|
24
24
|
def list_bases(
|
|
25
|
-
self,
|
|
25
|
+
self,
|
|
26
|
+
*,
|
|
27
|
+
app_id: typing.Optional[str] = None,
|
|
28
|
+
base_name: typing.Optional[str] = None,
|
|
26
29
|
) -> typing.List[BaseOutput]:
|
|
27
30
|
"""
|
|
28
31
|
Retrieve a list of bases filtered by app_id and base_name.
|
|
@@ -74,7 +77,10 @@ class AsyncBasesClient:
|
|
|
74
77
|
self._client_wrapper = client_wrapper
|
|
75
78
|
|
|
76
79
|
async def list_bases(
|
|
77
|
-
self,
|
|
80
|
+
self,
|
|
81
|
+
*,
|
|
82
|
+
app_id: typing.Optional[str] = None,
|
|
83
|
+
base_name: typing.Optional[str] = None,
|
|
78
84
|
) -> typing.List[BaseOutput]:
|
|
79
85
|
"""
|
|
80
86
|
Retrieve a list of bases filtered by app_id and base_name.
|
|
@@ -26,7 +26,11 @@ class ConfigsClient:
|
|
|
26
26
|
self._client_wrapper = client_wrapper
|
|
27
27
|
|
|
28
28
|
def get_config(
|
|
29
|
-
self,
|
|
29
|
+
self,
|
|
30
|
+
*,
|
|
31
|
+
base_id: str,
|
|
32
|
+
config_name: typing.Optional[str] = None,
|
|
33
|
+
environment_name: typing.Optional[str] = None,
|
|
30
34
|
) -> GetConfigResponse:
|
|
31
35
|
"""
|
|
32
36
|
Parameters:
|
|
@@ -50,7 +54,11 @@ class ConfigsClient:
|
|
|
50
54
|
"GET",
|
|
51
55
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "configs"),
|
|
52
56
|
params=remove_none_from_dict(
|
|
53
|
-
{
|
|
57
|
+
{
|
|
58
|
+
"base_id": base_id,
|
|
59
|
+
"config_name": config_name,
|
|
60
|
+
"environment_name": environment_name,
|
|
61
|
+
}
|
|
54
62
|
),
|
|
55
63
|
headers=self._client_wrapper.get_headers(),
|
|
56
64
|
timeout=60,
|
|
@@ -66,7 +74,12 @@ class ConfigsClient:
|
|
|
66
74
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
67
75
|
|
|
68
76
|
def save_config(
|
|
69
|
-
self,
|
|
77
|
+
self,
|
|
78
|
+
*,
|
|
79
|
+
base_id: str,
|
|
80
|
+
config_name: str,
|
|
81
|
+
parameters: typing.Dict[str, typing.Any],
|
|
82
|
+
overwrite: bool,
|
|
70
83
|
) -> typing.Any:
|
|
71
84
|
"""
|
|
72
85
|
Parameters:
|
|
@@ -95,7 +108,12 @@ class ConfigsClient:
|
|
|
95
108
|
"POST",
|
|
96
109
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "configs"),
|
|
97
110
|
json=jsonable_encoder(
|
|
98
|
-
{
|
|
111
|
+
{
|
|
112
|
+
"base_id": base_id,
|
|
113
|
+
"config_name": config_name,
|
|
114
|
+
"parameters": parameters,
|
|
115
|
+
"overwrite": overwrite,
|
|
116
|
+
}
|
|
99
117
|
),
|
|
100
118
|
headers=self._client_wrapper.get_headers(),
|
|
101
119
|
timeout=60,
|
|
@@ -128,7 +146,8 @@ class ConfigsClient:
|
|
|
128
146
|
_response = self._client_wrapper.httpx_client.request(
|
|
129
147
|
"GET",
|
|
130
148
|
urllib.parse.urljoin(
|
|
131
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
149
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
150
|
+
f"configs/deployment/{deployment_revision_id}",
|
|
132
151
|
),
|
|
133
152
|
headers=self._client_wrapper.get_headers(),
|
|
134
153
|
timeout=60,
|
|
@@ -161,7 +180,8 @@ class ConfigsClient:
|
|
|
161
180
|
_response = self._client_wrapper.httpx_client.request(
|
|
162
181
|
"POST",
|
|
163
182
|
urllib.parse.urljoin(
|
|
164
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
183
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
184
|
+
f"configs/deployment/{deployment_revision_id}/revert",
|
|
165
185
|
),
|
|
166
186
|
headers=self._client_wrapper.get_headers(),
|
|
167
187
|
timeout=60,
|
|
@@ -182,7 +202,11 @@ class AsyncConfigsClient:
|
|
|
182
202
|
self._client_wrapper = client_wrapper
|
|
183
203
|
|
|
184
204
|
async def get_config(
|
|
185
|
-
self,
|
|
205
|
+
self,
|
|
206
|
+
*,
|
|
207
|
+
base_id: str,
|
|
208
|
+
config_name: typing.Optional[str] = None,
|
|
209
|
+
environment_name: typing.Optional[str] = None,
|
|
186
210
|
) -> GetConfigResponse:
|
|
187
211
|
"""
|
|
188
212
|
Parameters:
|
|
@@ -206,7 +230,11 @@ class AsyncConfigsClient:
|
|
|
206
230
|
"GET",
|
|
207
231
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "configs"),
|
|
208
232
|
params=remove_none_from_dict(
|
|
209
|
-
{
|
|
233
|
+
{
|
|
234
|
+
"base_id": base_id,
|
|
235
|
+
"config_name": config_name,
|
|
236
|
+
"environment_name": environment_name,
|
|
237
|
+
}
|
|
210
238
|
),
|
|
211
239
|
headers=self._client_wrapper.get_headers(),
|
|
212
240
|
timeout=60,
|
|
@@ -222,7 +250,12 @@ class AsyncConfigsClient:
|
|
|
222
250
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
223
251
|
|
|
224
252
|
async def save_config(
|
|
225
|
-
self,
|
|
253
|
+
self,
|
|
254
|
+
*,
|
|
255
|
+
base_id: str,
|
|
256
|
+
config_name: str,
|
|
257
|
+
parameters: typing.Dict[str, typing.Any],
|
|
258
|
+
overwrite: bool,
|
|
226
259
|
) -> typing.Any:
|
|
227
260
|
"""
|
|
228
261
|
Parameters:
|
|
@@ -251,7 +284,12 @@ class AsyncConfigsClient:
|
|
|
251
284
|
"POST",
|
|
252
285
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "configs"),
|
|
253
286
|
json=jsonable_encoder(
|
|
254
|
-
{
|
|
287
|
+
{
|
|
288
|
+
"base_id": base_id,
|
|
289
|
+
"config_name": config_name,
|
|
290
|
+
"parameters": parameters,
|
|
291
|
+
"overwrite": overwrite,
|
|
292
|
+
}
|
|
255
293
|
),
|
|
256
294
|
headers=self._client_wrapper.get_headers(),
|
|
257
295
|
timeout=60,
|
|
@@ -266,7 +304,9 @@ class AsyncConfigsClient:
|
|
|
266
304
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
267
305
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
268
306
|
|
|
269
|
-
async def get_config_deployment_revision(
|
|
307
|
+
async def get_config_deployment_revision(
|
|
308
|
+
self, deployment_revision_id: str
|
|
309
|
+
) -> typing.Any:
|
|
270
310
|
"""
|
|
271
311
|
Parameters:
|
|
272
312
|
- deployment_revision_id: str.
|
|
@@ -284,7 +324,8 @@ class AsyncConfigsClient:
|
|
|
284
324
|
_response = await self._client_wrapper.httpx_client.request(
|
|
285
325
|
"GET",
|
|
286
326
|
urllib.parse.urljoin(
|
|
287
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
327
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
328
|
+
f"configs/deployment/{deployment_revision_id}",
|
|
288
329
|
),
|
|
289
330
|
headers=self._client_wrapper.get_headers(),
|
|
290
331
|
timeout=60,
|
|
@@ -299,7 +340,9 @@ class AsyncConfigsClient:
|
|
|
299
340
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
300
341
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
301
342
|
|
|
302
|
-
async def revert_deployment_revision(
|
|
343
|
+
async def revert_deployment_revision(
|
|
344
|
+
self, deployment_revision_id: str
|
|
345
|
+
) -> typing.Any:
|
|
303
346
|
"""
|
|
304
347
|
Parameters:
|
|
305
348
|
- deployment_revision_id: str.
|
|
@@ -317,7 +360,8 @@ class AsyncConfigsClient:
|
|
|
317
360
|
_response = await self._client_wrapper.httpx_client.request(
|
|
318
361
|
"POST",
|
|
319
362
|
urllib.parse.urljoin(
|
|
320
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
363
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
364
|
+
f"configs/deployment/{deployment_revision_id}/revert",
|
|
321
365
|
),
|
|
322
366
|
headers=self._client_wrapper.get_headers(),
|
|
323
367
|
timeout=60,
|
|
@@ -60,7 +60,9 @@ class ContainersClient:
|
|
|
60
60
|
"""
|
|
61
61
|
_response = self._client_wrapper.httpx_client.request(
|
|
62
62
|
"POST",
|
|
63
|
-
urllib.parse.urljoin(
|
|
63
|
+
urllib.parse.urljoin(
|
|
64
|
+
f"{self._client_wrapper.get_base_url()}/", "containers/build_image"
|
|
65
|
+
),
|
|
64
66
|
params=remove_none_from_dict({"app_id": app_id, "base_name": base_name}),
|
|
65
67
|
data=jsonable_encoder({}),
|
|
66
68
|
files={"tar_file": tar_file},
|
|
@@ -99,7 +101,10 @@ class ContainersClient:
|
|
|
99
101
|
"""
|
|
100
102
|
_response = self._client_wrapper.httpx_client.request(
|
|
101
103
|
"POST",
|
|
102
|
-
urllib.parse.urljoin(
|
|
104
|
+
urllib.parse.urljoin(
|
|
105
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
106
|
+
"containers/restart_container",
|
|
107
|
+
),
|
|
103
108
|
json=jsonable_encoder({"variant_id": variant_id}),
|
|
104
109
|
headers=self._client_wrapper.get_headers(),
|
|
105
110
|
timeout=60,
|
|
@@ -127,7 +132,9 @@ class ContainersClient:
|
|
|
127
132
|
"""
|
|
128
133
|
_response = self._client_wrapper.httpx_client.request(
|
|
129
134
|
"GET",
|
|
130
|
-
urllib.parse.urljoin(
|
|
135
|
+
urllib.parse.urljoin(
|
|
136
|
+
f"{self._client_wrapper.get_base_url()}/", "containers/templates"
|
|
137
|
+
),
|
|
131
138
|
headers=self._client_wrapper.get_headers(),
|
|
132
139
|
timeout=60,
|
|
133
140
|
)
|
|
@@ -140,7 +147,10 @@ class ContainersClient:
|
|
|
140
147
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
141
148
|
|
|
142
149
|
def construct_app_container_url(
|
|
143
|
-
self,
|
|
150
|
+
self,
|
|
151
|
+
*,
|
|
152
|
+
base_id: typing.Optional[str] = None,
|
|
153
|
+
variant_id: typing.Optional[str] = None,
|
|
144
154
|
) -> Uri:
|
|
145
155
|
"""
|
|
146
156
|
Constructs the URL for an app container based on the provided base_id or variant_id.
|
|
@@ -171,8 +181,12 @@ class ContainersClient:
|
|
|
171
181
|
"""
|
|
172
182
|
_response = self._client_wrapper.httpx_client.request(
|
|
173
183
|
"GET",
|
|
174
|
-
urllib.parse.urljoin(
|
|
175
|
-
|
|
184
|
+
urllib.parse.urljoin(
|
|
185
|
+
f"{self._client_wrapper.get_base_url()}/", "containers/container_url"
|
|
186
|
+
),
|
|
187
|
+
params=remove_none_from_dict(
|
|
188
|
+
{"base_id": base_id, "variant_id": variant_id}
|
|
189
|
+
),
|
|
176
190
|
headers=self._client_wrapper.get_headers(),
|
|
177
191
|
timeout=60,
|
|
178
192
|
)
|
|
@@ -191,7 +205,9 @@ class AsyncContainersClient:
|
|
|
191
205
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
192
206
|
self._client_wrapper = client_wrapper
|
|
193
207
|
|
|
194
|
-
async def build_image(
|
|
208
|
+
async def build_image(
|
|
209
|
+
self, *, app_id: str, base_name: str, tar_file: typing.IO
|
|
210
|
+
) -> Image:
|
|
195
211
|
"""
|
|
196
212
|
Builds a Docker image from a tar file containing the application code.
|
|
197
213
|
|
|
@@ -224,7 +240,9 @@ class AsyncContainersClient:
|
|
|
224
240
|
"""
|
|
225
241
|
_response = await self._client_wrapper.httpx_client.request(
|
|
226
242
|
"POST",
|
|
227
|
-
urllib.parse.urljoin(
|
|
243
|
+
urllib.parse.urljoin(
|
|
244
|
+
f"{self._client_wrapper.get_base_url()}/", "containers/build_image"
|
|
245
|
+
),
|
|
228
246
|
params=remove_none_from_dict({"app_id": app_id, "base_name": base_name}),
|
|
229
247
|
data=jsonable_encoder({}),
|
|
230
248
|
files={"tar_file": tar_file},
|
|
@@ -241,7 +259,9 @@ class AsyncContainersClient:
|
|
|
241
259
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
242
260
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
243
261
|
|
|
244
|
-
async def restart_container(
|
|
262
|
+
async def restart_container(
|
|
263
|
+
self, *, variant_id: str
|
|
264
|
+
) -> typing.Dict[str, typing.Any]:
|
|
245
265
|
"""
|
|
246
266
|
Restart docker container.
|
|
247
267
|
|
|
@@ -263,7 +283,10 @@ class AsyncContainersClient:
|
|
|
263
283
|
"""
|
|
264
284
|
_response = await self._client_wrapper.httpx_client.request(
|
|
265
285
|
"POST",
|
|
266
|
-
urllib.parse.urljoin(
|
|
286
|
+
urllib.parse.urljoin(
|
|
287
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
288
|
+
"containers/restart_container",
|
|
289
|
+
),
|
|
267
290
|
json=jsonable_encoder({"variant_id": variant_id}),
|
|
268
291
|
headers=self._client_wrapper.get_headers(),
|
|
269
292
|
timeout=60,
|
|
@@ -291,7 +314,9 @@ class AsyncContainersClient:
|
|
|
291
314
|
"""
|
|
292
315
|
_response = await self._client_wrapper.httpx_client.request(
|
|
293
316
|
"GET",
|
|
294
|
-
urllib.parse.urljoin(
|
|
317
|
+
urllib.parse.urljoin(
|
|
318
|
+
f"{self._client_wrapper.get_base_url()}/", "containers/templates"
|
|
319
|
+
),
|
|
295
320
|
headers=self._client_wrapper.get_headers(),
|
|
296
321
|
timeout=60,
|
|
297
322
|
)
|
|
@@ -304,7 +329,10 @@ class AsyncContainersClient:
|
|
|
304
329
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
305
330
|
|
|
306
331
|
async def construct_app_container_url(
|
|
307
|
-
self,
|
|
332
|
+
self,
|
|
333
|
+
*,
|
|
334
|
+
base_id: typing.Optional[str] = None,
|
|
335
|
+
variant_id: typing.Optional[str] = None,
|
|
308
336
|
) -> Uri:
|
|
309
337
|
"""
|
|
310
338
|
Constructs the URL for an app container based on the provided base_id or variant_id.
|
|
@@ -335,8 +363,12 @@ class AsyncContainersClient:
|
|
|
335
363
|
"""
|
|
336
364
|
_response = await self._client_wrapper.httpx_client.request(
|
|
337
365
|
"GET",
|
|
338
|
-
urllib.parse.urljoin(
|
|
339
|
-
|
|
366
|
+
urllib.parse.urljoin(
|
|
367
|
+
f"{self._client_wrapper.get_base_url()}/", "containers/container_url"
|
|
368
|
+
),
|
|
369
|
+
params=remove_none_from_dict(
|
|
370
|
+
{"base_id": base_id, "variant_id": variant_id}
|
|
371
|
+
),
|
|
340
372
|
headers=self._client_wrapper.get_headers(),
|
|
341
373
|
timeout=60,
|
|
342
374
|
)
|
|
@@ -23,7 +23,9 @@ class EnvironmentsClient:
|
|
|
23
23
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
24
24
|
self._client_wrapper = client_wrapper
|
|
25
25
|
|
|
26
|
-
def deploy_to_environment(
|
|
26
|
+
def deploy_to_environment(
|
|
27
|
+
self, *, environment_name: str, variant_id: str
|
|
28
|
+
) -> typing.Any:
|
|
27
29
|
"""
|
|
28
30
|
Deploys a given variant to an environment
|
|
29
31
|
|
|
@@ -53,8 +55,12 @@ class EnvironmentsClient:
|
|
|
53
55
|
"""
|
|
54
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
55
57
|
"POST",
|
|
56
|
-
urllib.parse.urljoin(
|
|
57
|
-
|
|
58
|
+
urllib.parse.urljoin(
|
|
59
|
+
f"{self._client_wrapper.get_base_url()}/", "environments/deploy"
|
|
60
|
+
),
|
|
61
|
+
json=jsonable_encoder(
|
|
62
|
+
{"environment_name": environment_name, "variant_id": variant_id}
|
|
63
|
+
),
|
|
58
64
|
headers=self._client_wrapper.get_headers(),
|
|
59
65
|
timeout=60,
|
|
60
66
|
)
|
|
@@ -73,7 +79,9 @@ class AsyncEnvironmentsClient:
|
|
|
73
79
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
74
80
|
self._client_wrapper = client_wrapper
|
|
75
81
|
|
|
76
|
-
async def deploy_to_environment(
|
|
82
|
+
async def deploy_to_environment(
|
|
83
|
+
self, *, environment_name: str, variant_id: str
|
|
84
|
+
) -> typing.Any:
|
|
77
85
|
"""
|
|
78
86
|
Deploys a given variant to an environment
|
|
79
87
|
|
|
@@ -103,8 +111,12 @@ class AsyncEnvironmentsClient:
|
|
|
103
111
|
"""
|
|
104
112
|
_response = await self._client_wrapper.httpx_client.request(
|
|
105
113
|
"POST",
|
|
106
|
-
urllib.parse.urljoin(
|
|
107
|
-
|
|
114
|
+
urllib.parse.urljoin(
|
|
115
|
+
f"{self._client_wrapper.get_base_url()}/", "environments/deploy"
|
|
116
|
+
),
|
|
117
|
+
json=jsonable_encoder(
|
|
118
|
+
{"environment_name": environment_name, "variant_id": variant_id}
|
|
119
|
+
),
|
|
108
120
|
headers=self._client_wrapper.get_headers(),
|
|
109
121
|
timeout=60,
|
|
110
122
|
)
|