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
|
@@ -69,9 +69,15 @@ class EvaluationsClient:
|
|
|
69
69
|
"""
|
|
70
70
|
_response = self._client_wrapper.httpx_client.request(
|
|
71
71
|
"GET",
|
|
72
|
-
urllib.parse.urljoin(
|
|
72
|
+
urllib.parse.urljoin(
|
|
73
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluations/by_resource"
|
|
74
|
+
),
|
|
73
75
|
params=remove_none_from_dict(
|
|
74
|
-
{
|
|
76
|
+
{
|
|
77
|
+
"app_id": app_id,
|
|
78
|
+
"resource_type": resource_type,
|
|
79
|
+
"resource_ids": resource_ids,
|
|
80
|
+
}
|
|
75
81
|
),
|
|
76
82
|
headers=self._client_wrapper.get_headers(),
|
|
77
83
|
timeout=60,
|
|
@@ -111,7 +117,9 @@ class EvaluationsClient:
|
|
|
111
117
|
"""
|
|
112
118
|
_response = self._client_wrapper.httpx_client.request(
|
|
113
119
|
"GET",
|
|
114
|
-
urllib.parse.urljoin(
|
|
120
|
+
urllib.parse.urljoin(
|
|
121
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
122
|
+
),
|
|
115
123
|
params=remove_none_from_dict({"app_id": app_id}),
|
|
116
124
|
headers=self._client_wrapper.get_headers(),
|
|
117
125
|
timeout=60,
|
|
@@ -192,7 +200,9 @@ class EvaluationsClient:
|
|
|
192
200
|
_request["correct_answer_column"] = correct_answer_column
|
|
193
201
|
_response = self._client_wrapper.httpx_client.request(
|
|
194
202
|
"POST",
|
|
195
|
-
urllib.parse.urljoin(
|
|
203
|
+
urllib.parse.urljoin(
|
|
204
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
205
|
+
),
|
|
196
206
|
json=jsonable_encoder(_request),
|
|
197
207
|
headers=self._client_wrapper.get_headers(),
|
|
198
208
|
timeout=60,
|
|
@@ -207,7 +217,9 @@ class EvaluationsClient:
|
|
|
207
217
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
208
218
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
209
219
|
|
|
210
|
-
def delete_evaluations(
|
|
220
|
+
def delete_evaluations(
|
|
221
|
+
self, *, evaluations_ids: typing.List[str]
|
|
222
|
+
) -> typing.List[str]:
|
|
211
223
|
"""
|
|
212
224
|
Delete specific comparison tables based on their unique IDs.
|
|
213
225
|
|
|
@@ -232,7 +244,9 @@ class EvaluationsClient:
|
|
|
232
244
|
"""
|
|
233
245
|
_response = self._client_wrapper.httpx_client.request(
|
|
234
246
|
"DELETE",
|
|
235
|
-
urllib.parse.urljoin(
|
|
247
|
+
urllib.parse.urljoin(
|
|
248
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
249
|
+
),
|
|
236
250
|
json=jsonable_encoder({"evaluations_ids": evaluations_ids}),
|
|
237
251
|
headers=self._client_wrapper.get_headers(),
|
|
238
252
|
timeout=60,
|
|
@@ -273,7 +287,10 @@ class EvaluationsClient:
|
|
|
273
287
|
"""
|
|
274
288
|
_response = self._client_wrapper.httpx_client.request(
|
|
275
289
|
"GET",
|
|
276
|
-
urllib.parse.urljoin(
|
|
290
|
+
urllib.parse.urljoin(
|
|
291
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
292
|
+
f"evaluations/{evaluation_id}/status",
|
|
293
|
+
),
|
|
277
294
|
headers=self._client_wrapper.get_headers(),
|
|
278
295
|
timeout=60,
|
|
279
296
|
)
|
|
@@ -313,7 +330,10 @@ class EvaluationsClient:
|
|
|
313
330
|
"""
|
|
314
331
|
_response = self._client_wrapper.httpx_client.request(
|
|
315
332
|
"GET",
|
|
316
|
-
urllib.parse.urljoin(
|
|
333
|
+
urllib.parse.urljoin(
|
|
334
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
335
|
+
f"evaluations/{evaluation_id}/results",
|
|
336
|
+
),
|
|
317
337
|
headers=self._client_wrapper.get_headers(),
|
|
318
338
|
timeout=60,
|
|
319
339
|
)
|
|
@@ -327,7 +347,9 @@ class EvaluationsClient:
|
|
|
327
347
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
328
348
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
329
349
|
|
|
330
|
-
def fetch_evaluation_scenarios(
|
|
350
|
+
def fetch_evaluation_scenarios(
|
|
351
|
+
self, evaluation_id: str
|
|
352
|
+
) -> typing.List[EvaluationScenario]:
|
|
331
353
|
"""
|
|
332
354
|
Fetches evaluation scenarios for a given evaluation ID.
|
|
333
355
|
|
|
@@ -356,7 +378,8 @@ class EvaluationsClient:
|
|
|
356
378
|
_response = self._client_wrapper.httpx_client.request(
|
|
357
379
|
"GET",
|
|
358
380
|
urllib.parse.urljoin(
|
|
359
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
381
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
382
|
+
f"evaluations/{evaluation_id}/evaluation_scenarios",
|
|
360
383
|
),
|
|
361
384
|
headers=self._client_wrapper.get_headers(),
|
|
362
385
|
timeout=60,
|
|
@@ -396,7 +419,10 @@ class EvaluationsClient:
|
|
|
396
419
|
"""
|
|
397
420
|
_response = self._client_wrapper.httpx_client.request(
|
|
398
421
|
"GET",
|
|
399
|
-
urllib.parse.urljoin(
|
|
422
|
+
urllib.parse.urljoin(
|
|
423
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
424
|
+
f"evaluations/{evaluation_id}",
|
|
425
|
+
),
|
|
400
426
|
headers=self._client_wrapper.get_headers(),
|
|
401
427
|
timeout=60,
|
|
402
428
|
)
|
|
@@ -428,7 +454,10 @@ class EvaluationsClient:
|
|
|
428
454
|
"""
|
|
429
455
|
_response = self._client_wrapper.httpx_client.request(
|
|
430
456
|
"POST",
|
|
431
|
-
urllib.parse.urljoin(
|
|
457
|
+
urllib.parse.urljoin(
|
|
458
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
459
|
+
"evaluations/webhook_example_fake",
|
|
460
|
+
),
|
|
432
461
|
headers=self._client_wrapper.get_headers(),
|
|
433
462
|
timeout=60,
|
|
434
463
|
)
|
|
@@ -469,7 +498,8 @@ class EvaluationsClient:
|
|
|
469
498
|
_response = self._client_wrapper.httpx_client.request(
|
|
470
499
|
"GET",
|
|
471
500
|
urllib.parse.urljoin(
|
|
472
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
501
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
502
|
+
"evaluations/evaluation_scenarios/comparison-results",
|
|
473
503
|
),
|
|
474
504
|
params=remove_none_from_dict({"evaluations_ids": evaluations_ids}),
|
|
475
505
|
headers=self._client_wrapper.get_headers(),
|
|
@@ -531,9 +561,15 @@ class AsyncEvaluationsClient:
|
|
|
531
561
|
"""
|
|
532
562
|
_response = await self._client_wrapper.httpx_client.request(
|
|
533
563
|
"GET",
|
|
534
|
-
urllib.parse.urljoin(
|
|
564
|
+
urllib.parse.urljoin(
|
|
565
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluations/by_resource"
|
|
566
|
+
),
|
|
535
567
|
params=remove_none_from_dict(
|
|
536
|
-
{
|
|
568
|
+
{
|
|
569
|
+
"app_id": app_id,
|
|
570
|
+
"resource_type": resource_type,
|
|
571
|
+
"resource_ids": resource_ids,
|
|
572
|
+
}
|
|
537
573
|
),
|
|
538
574
|
headers=self._client_wrapper.get_headers(),
|
|
539
575
|
timeout=60,
|
|
@@ -573,7 +609,9 @@ class AsyncEvaluationsClient:
|
|
|
573
609
|
"""
|
|
574
610
|
_response = await self._client_wrapper.httpx_client.request(
|
|
575
611
|
"GET",
|
|
576
|
-
urllib.parse.urljoin(
|
|
612
|
+
urllib.parse.urljoin(
|
|
613
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
614
|
+
),
|
|
577
615
|
params=remove_none_from_dict({"app_id": app_id}),
|
|
578
616
|
headers=self._client_wrapper.get_headers(),
|
|
579
617
|
timeout=60,
|
|
@@ -654,7 +692,9 @@ class AsyncEvaluationsClient:
|
|
|
654
692
|
_request["correct_answer_column"] = correct_answer_column
|
|
655
693
|
_response = await self._client_wrapper.httpx_client.request(
|
|
656
694
|
"POST",
|
|
657
|
-
urllib.parse.urljoin(
|
|
695
|
+
urllib.parse.urljoin(
|
|
696
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
697
|
+
),
|
|
658
698
|
json=jsonable_encoder(_request),
|
|
659
699
|
headers=self._client_wrapper.get_headers(),
|
|
660
700
|
timeout=60,
|
|
@@ -669,7 +709,9 @@ class AsyncEvaluationsClient:
|
|
|
669
709
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
670
710
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
671
711
|
|
|
672
|
-
async def delete_evaluations(
|
|
712
|
+
async def delete_evaluations(
|
|
713
|
+
self, *, evaluations_ids: typing.List[str]
|
|
714
|
+
) -> typing.List[str]:
|
|
673
715
|
"""
|
|
674
716
|
Delete specific comparison tables based on their unique IDs.
|
|
675
717
|
|
|
@@ -694,7 +736,9 @@ class AsyncEvaluationsClient:
|
|
|
694
736
|
"""
|
|
695
737
|
_response = await self._client_wrapper.httpx_client.request(
|
|
696
738
|
"DELETE",
|
|
697
|
-
urllib.parse.urljoin(
|
|
739
|
+
urllib.parse.urljoin(
|
|
740
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluations"
|
|
741
|
+
),
|
|
698
742
|
json=jsonable_encoder({"evaluations_ids": evaluations_ids}),
|
|
699
743
|
headers=self._client_wrapper.get_headers(),
|
|
700
744
|
timeout=60,
|
|
@@ -735,7 +779,10 @@ class AsyncEvaluationsClient:
|
|
|
735
779
|
"""
|
|
736
780
|
_response = await self._client_wrapper.httpx_client.request(
|
|
737
781
|
"GET",
|
|
738
|
-
urllib.parse.urljoin(
|
|
782
|
+
urllib.parse.urljoin(
|
|
783
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
784
|
+
f"evaluations/{evaluation_id}/status",
|
|
785
|
+
),
|
|
739
786
|
headers=self._client_wrapper.get_headers(),
|
|
740
787
|
timeout=60,
|
|
741
788
|
)
|
|
@@ -775,7 +822,10 @@ class AsyncEvaluationsClient:
|
|
|
775
822
|
"""
|
|
776
823
|
_response = await self._client_wrapper.httpx_client.request(
|
|
777
824
|
"GET",
|
|
778
|
-
urllib.parse.urljoin(
|
|
825
|
+
urllib.parse.urljoin(
|
|
826
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
827
|
+
f"evaluations/{evaluation_id}/results",
|
|
828
|
+
),
|
|
779
829
|
headers=self._client_wrapper.get_headers(),
|
|
780
830
|
timeout=60,
|
|
781
831
|
)
|
|
@@ -789,7 +839,9 @@ class AsyncEvaluationsClient:
|
|
|
789
839
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
790
840
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
791
841
|
|
|
792
|
-
async def fetch_evaluation_scenarios(
|
|
842
|
+
async def fetch_evaluation_scenarios(
|
|
843
|
+
self, evaluation_id: str
|
|
844
|
+
) -> typing.List[EvaluationScenario]:
|
|
793
845
|
"""
|
|
794
846
|
Fetches evaluation scenarios for a given evaluation ID.
|
|
795
847
|
|
|
@@ -818,7 +870,8 @@ class AsyncEvaluationsClient:
|
|
|
818
870
|
_response = await self._client_wrapper.httpx_client.request(
|
|
819
871
|
"GET",
|
|
820
872
|
urllib.parse.urljoin(
|
|
821
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
873
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
874
|
+
f"evaluations/{evaluation_id}/evaluation_scenarios",
|
|
822
875
|
),
|
|
823
876
|
headers=self._client_wrapper.get_headers(),
|
|
824
877
|
timeout=60,
|
|
@@ -858,7 +911,10 @@ class AsyncEvaluationsClient:
|
|
|
858
911
|
"""
|
|
859
912
|
_response = await self._client_wrapper.httpx_client.request(
|
|
860
913
|
"GET",
|
|
861
|
-
urllib.parse.urljoin(
|
|
914
|
+
urllib.parse.urljoin(
|
|
915
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
916
|
+
f"evaluations/{evaluation_id}",
|
|
917
|
+
),
|
|
862
918
|
headers=self._client_wrapper.get_headers(),
|
|
863
919
|
timeout=60,
|
|
864
920
|
)
|
|
@@ -890,7 +946,10 @@ class AsyncEvaluationsClient:
|
|
|
890
946
|
"""
|
|
891
947
|
_response = await self._client_wrapper.httpx_client.request(
|
|
892
948
|
"POST",
|
|
893
|
-
urllib.parse.urljoin(
|
|
949
|
+
urllib.parse.urljoin(
|
|
950
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
951
|
+
"evaluations/webhook_example_fake",
|
|
952
|
+
),
|
|
894
953
|
headers=self._client_wrapper.get_headers(),
|
|
895
954
|
timeout=60,
|
|
896
955
|
)
|
|
@@ -931,7 +990,8 @@ class AsyncEvaluationsClient:
|
|
|
931
990
|
_response = await self._client_wrapper.httpx_client.request(
|
|
932
991
|
"GET",
|
|
933
992
|
urllib.parse.urljoin(
|
|
934
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
993
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
994
|
+
"evaluations/evaluation_scenarios/comparison-results",
|
|
935
995
|
),
|
|
936
996
|
params=remove_none_from_dict({"evaluations_ids": evaluations_ids}),
|
|
937
997
|
headers=self._client_wrapper.get_headers(),
|
|
@@ -44,7 +44,9 @@ class EvaluatorsClient:
|
|
|
44
44
|
"""
|
|
45
45
|
_response = self._client_wrapper.httpx_client.request(
|
|
46
46
|
"GET",
|
|
47
|
-
urllib.parse.urljoin(
|
|
47
|
+
urllib.parse.urljoin(
|
|
48
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators"
|
|
49
|
+
),
|
|
48
50
|
headers=self._client_wrapper.get_headers(),
|
|
49
51
|
timeout=60,
|
|
50
52
|
)
|
|
@@ -81,7 +83,9 @@ class EvaluatorsClient:
|
|
|
81
83
|
"""
|
|
82
84
|
_response = self._client_wrapper.httpx_client.request(
|
|
83
85
|
"GET",
|
|
84
|
-
urllib.parse.urljoin(
|
|
86
|
+
urllib.parse.urljoin(
|
|
87
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"
|
|
88
|
+
),
|
|
85
89
|
params=remove_none_from_dict({"app_id": app_id}),
|
|
86
90
|
headers=self._client_wrapper.get_headers(),
|
|
87
91
|
timeout=60,
|
|
@@ -97,7 +101,12 @@ class EvaluatorsClient:
|
|
|
97
101
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
98
102
|
|
|
99
103
|
def create_new_evaluator_config(
|
|
100
|
-
self,
|
|
104
|
+
self,
|
|
105
|
+
*,
|
|
106
|
+
app_id: str,
|
|
107
|
+
name: str,
|
|
108
|
+
evaluator_key: str,
|
|
109
|
+
settings_values: typing.Dict[str, typing.Any],
|
|
101
110
|
) -> EvaluatorConfig:
|
|
102
111
|
"""
|
|
103
112
|
Endpoint to fetch evaluator configurations for a specific app.
|
|
@@ -132,9 +141,16 @@ class EvaluatorsClient:
|
|
|
132
141
|
"""
|
|
133
142
|
_response = self._client_wrapper.httpx_client.request(
|
|
134
143
|
"POST",
|
|
135
|
-
urllib.parse.urljoin(
|
|
144
|
+
urllib.parse.urljoin(
|
|
145
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"
|
|
146
|
+
),
|
|
136
147
|
json=jsonable_encoder(
|
|
137
|
-
{
|
|
148
|
+
{
|
|
149
|
+
"app_id": app_id,
|
|
150
|
+
"name": name,
|
|
151
|
+
"evaluator_key": evaluator_key,
|
|
152
|
+
"settings_values": settings_values,
|
|
153
|
+
}
|
|
138
154
|
),
|
|
139
155
|
headers=self._client_wrapper.get_headers(),
|
|
140
156
|
timeout=60,
|
|
@@ -172,7 +188,8 @@ class EvaluatorsClient:
|
|
|
172
188
|
_response = self._client_wrapper.httpx_client.request(
|
|
173
189
|
"GET",
|
|
174
190
|
urllib.parse.urljoin(
|
|
175
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
191
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
192
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
176
193
|
),
|
|
177
194
|
headers=self._client_wrapper.get_headers(),
|
|
178
195
|
timeout=60,
|
|
@@ -230,7 +247,8 @@ class EvaluatorsClient:
|
|
|
230
247
|
_response = self._client_wrapper.httpx_client.request(
|
|
231
248
|
"PUT",
|
|
232
249
|
urllib.parse.urljoin(
|
|
233
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
250
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
251
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
234
252
|
),
|
|
235
253
|
json=jsonable_encoder(_request),
|
|
236
254
|
headers=self._client_wrapper.get_headers(),
|
|
@@ -272,7 +290,8 @@ class EvaluatorsClient:
|
|
|
272
290
|
_response = self._client_wrapper.httpx_client.request(
|
|
273
291
|
"DELETE",
|
|
274
292
|
urllib.parse.urljoin(
|
|
275
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
293
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
294
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
276
295
|
),
|
|
277
296
|
headers=self._client_wrapper.get_headers(),
|
|
278
297
|
timeout=60,
|
|
@@ -310,7 +329,9 @@ class AsyncEvaluatorsClient:
|
|
|
310
329
|
"""
|
|
311
330
|
_response = await self._client_wrapper.httpx_client.request(
|
|
312
331
|
"GET",
|
|
313
|
-
urllib.parse.urljoin(
|
|
332
|
+
urllib.parse.urljoin(
|
|
333
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators"
|
|
334
|
+
),
|
|
314
335
|
headers=self._client_wrapper.get_headers(),
|
|
315
336
|
timeout=60,
|
|
316
337
|
)
|
|
@@ -322,7 +343,9 @@ class AsyncEvaluatorsClient:
|
|
|
322
343
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
323
344
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
324
345
|
|
|
325
|
-
async def get_evaluator_configs(
|
|
346
|
+
async def get_evaluator_configs(
|
|
347
|
+
self, *, app_id: str
|
|
348
|
+
) -> typing.List[EvaluatorConfig]:
|
|
326
349
|
"""
|
|
327
350
|
Endpoint to fetch evaluator configurations for a specific app.
|
|
328
351
|
|
|
@@ -347,7 +370,9 @@ class AsyncEvaluatorsClient:
|
|
|
347
370
|
"""
|
|
348
371
|
_response = await self._client_wrapper.httpx_client.request(
|
|
349
372
|
"GET",
|
|
350
|
-
urllib.parse.urljoin(
|
|
373
|
+
urllib.parse.urljoin(
|
|
374
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"
|
|
375
|
+
),
|
|
351
376
|
params=remove_none_from_dict({"app_id": app_id}),
|
|
352
377
|
headers=self._client_wrapper.get_headers(),
|
|
353
378
|
timeout=60,
|
|
@@ -363,7 +388,12 @@ class AsyncEvaluatorsClient:
|
|
|
363
388
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
364
389
|
|
|
365
390
|
async def create_new_evaluator_config(
|
|
366
|
-
self,
|
|
391
|
+
self,
|
|
392
|
+
*,
|
|
393
|
+
app_id: str,
|
|
394
|
+
name: str,
|
|
395
|
+
evaluator_key: str,
|
|
396
|
+
settings_values: typing.Dict[str, typing.Any],
|
|
367
397
|
) -> EvaluatorConfig:
|
|
368
398
|
"""
|
|
369
399
|
Endpoint to fetch evaluator configurations for a specific app.
|
|
@@ -398,9 +428,16 @@ class AsyncEvaluatorsClient:
|
|
|
398
428
|
"""
|
|
399
429
|
_response = await self._client_wrapper.httpx_client.request(
|
|
400
430
|
"POST",
|
|
401
|
-
urllib.parse.urljoin(
|
|
431
|
+
urllib.parse.urljoin(
|
|
432
|
+
f"{self._client_wrapper.get_base_url()}/", "evaluators/configs"
|
|
433
|
+
),
|
|
402
434
|
json=jsonable_encoder(
|
|
403
|
-
{
|
|
435
|
+
{
|
|
436
|
+
"app_id": app_id,
|
|
437
|
+
"name": name,
|
|
438
|
+
"evaluator_key": evaluator_key,
|
|
439
|
+
"settings_values": settings_values,
|
|
440
|
+
}
|
|
404
441
|
),
|
|
405
442
|
headers=self._client_wrapper.get_headers(),
|
|
406
443
|
timeout=60,
|
|
@@ -438,7 +475,8 @@ class AsyncEvaluatorsClient:
|
|
|
438
475
|
_response = await self._client_wrapper.httpx_client.request(
|
|
439
476
|
"GET",
|
|
440
477
|
urllib.parse.urljoin(
|
|
441
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
478
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
479
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
442
480
|
),
|
|
443
481
|
headers=self._client_wrapper.get_headers(),
|
|
444
482
|
timeout=60,
|
|
@@ -496,7 +534,8 @@ class AsyncEvaluatorsClient:
|
|
|
496
534
|
_response = await self._client_wrapper.httpx_client.request(
|
|
497
535
|
"PUT",
|
|
498
536
|
urllib.parse.urljoin(
|
|
499
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
537
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
538
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
500
539
|
),
|
|
501
540
|
json=jsonable_encoder(_request),
|
|
502
541
|
headers=self._client_wrapper.get_headers(),
|
|
@@ -538,7 +577,8 @@ class AsyncEvaluatorsClient:
|
|
|
538
577
|
_response = await self._client_wrapper.httpx_client.request(
|
|
539
578
|
"DELETE",
|
|
540
579
|
urllib.parse.urljoin(
|
|
541
|
-
f"{self._client_wrapper.get_base_url()}/",
|
|
580
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
581
|
+
f"evaluators/configs/{evaluator_config_id}",
|
|
542
582
|
),
|
|
543
583
|
headers=self._client_wrapper.get_headers(),
|
|
544
584
|
timeout=60,
|