agenta 0.30.0__py3-none-any.whl → 0.30.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/client/backend/__init__.py +3 -32
- agenta/client/backend/apps/client.py +10 -70
- agenta/client/backend/client.py +45 -61
- agenta/client/backend/configs/client.py +0 -6
- agenta/client/backend/containers/client.py +0 -6
- agenta/client/backend/core/file.py +8 -13
- agenta/client/backend/environments/client.py +0 -6
- agenta/client/backend/evaluations/client.py +1 -14
- agenta/client/backend/evaluators/client.py +0 -24
- agenta/client/backend/observability/client.py +16 -22
- agenta/client/backend/observability_v_1/__init__.py +2 -2
- agenta/client/backend/observability_v_1/client.py +0 -203
- agenta/client/backend/observability_v_1/types/__init__.py +1 -2
- agenta/client/backend/observability_v_1/types/format.py +1 -1
- agenta/client/backend/testsets/client.py +121 -305
- agenta/client/backend/types/__init__.py +2 -24
- agenta/client/backend/types/app.py +1 -2
- agenta/client/backend/types/body_import_testset.py +1 -0
- agenta/client/backend/types/lm_providers_enum.py +21 -0
- agenta/client/backend/types/permission.py +0 -1
- agenta/client/backend/variants/client.py +0 -66
- agenta/sdk/decorators/routing.py +0 -102
- {agenta-0.30.0.dist-info → agenta-0.30.0a2.dist-info}/METADATA +3 -4
- {agenta-0.30.0.dist-info → agenta-0.30.0a2.dist-info}/RECORD +26 -44
- {agenta-0.30.0.dist-info → agenta-0.30.0a2.dist-info}/WHEEL +1 -1
- agenta/client/backend/access_control/__init__.py +0 -1
- agenta/client/backend/access_control/client.py +0 -167
- agenta/client/backend/observability_v_1/types/query_analytics_response.py +0 -7
- agenta/client/backend/scopes/__init__.py +0 -1
- agenta/client/backend/scopes/client.py +0 -114
- agenta/client/backend/types/analytics_response.py +0 -24
- agenta/client/backend/types/bucket_dto.py +0 -26
- agenta/client/backend/types/header_dto.py +0 -22
- agenta/client/backend/types/legacy_analytics_response.py +0 -29
- agenta/client/backend/types/legacy_data_point.py +0 -27
- agenta/client/backend/types/metrics_dto.py +0 -24
- agenta/client/backend/types/projects_response.py +0 -28
- agenta/client/backend/types/provider_key_dto.py +0 -23
- agenta/client/backend/types/provider_kind.py +0 -21
- agenta/client/backend/types/secret_dto.py +0 -24
- agenta/client/backend/types/secret_kind.py +0 -5
- agenta/client/backend/types/secret_response_dto.py +0 -27
- agenta/client/backend/vault/__init__.py +0 -1
- agenta/client/backend/vault/client.py +0 -685
- {agenta-0.30.0.dist-info → agenta-0.30.0a2.dist-info}/entry_points.txt +0 -0
|
@@ -10,8 +10,8 @@ from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
|
10
10
|
from ..types.http_validation_error import HttpValidationError
|
|
11
11
|
from json.decoder import JSONDecodeError
|
|
12
12
|
from ..core.api_error import ApiError
|
|
13
|
-
from ..types.test_set_output_response import TestSetOutputResponse
|
|
14
13
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
14
|
+
from ..types.test_set_output_response import TestSetOutputResponse
|
|
15
15
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
16
16
|
|
|
17
17
|
# this is used as the default value for optional parameters
|
|
@@ -106,11 +106,7 @@ class TestsetsClient:
|
|
|
106
106
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
107
107
|
|
|
108
108
|
def import_testset(
|
|
109
|
-
self,
|
|
110
|
-
*,
|
|
111
|
-
endpoint: typing.Optional[str] = OMIT,
|
|
112
|
-
testset_name: typing.Optional[str] = OMIT,
|
|
113
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
109
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
114
110
|
) -> TestSetSimpleResponse:
|
|
115
111
|
"""
|
|
116
112
|
Import JSON testset data from an endpoint and save it to MongoDB.
|
|
@@ -124,10 +120,6 @@ class TestsetsClient:
|
|
|
124
120
|
|
|
125
121
|
Parameters
|
|
126
122
|
----------
|
|
127
|
-
endpoint : typing.Optional[str]
|
|
128
|
-
|
|
129
|
-
testset_name : typing.Optional[str]
|
|
130
|
-
|
|
131
123
|
request_options : typing.Optional[RequestOptions]
|
|
132
124
|
Request-specific configuration.
|
|
133
125
|
|
|
@@ -149,12 +141,7 @@ class TestsetsClient:
|
|
|
149
141
|
_response = self._client_wrapper.httpx_client.request(
|
|
150
142
|
"testsets/endpoint",
|
|
151
143
|
method="POST",
|
|
152
|
-
json={
|
|
153
|
-
"endpoint": endpoint,
|
|
154
|
-
"testset_name": testset_name,
|
|
155
|
-
},
|
|
156
144
|
request_options=request_options,
|
|
157
|
-
omit=OMIT,
|
|
158
145
|
)
|
|
159
146
|
try:
|
|
160
147
|
if 200 <= _response.status_code < 300:
|
|
@@ -180,59 +167,6 @@ class TestsetsClient:
|
|
|
180
167
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
181
168
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
182
169
|
|
|
183
|
-
def get_testsets(
|
|
184
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
185
|
-
) -> typing.List[TestSetOutputResponse]:
|
|
186
|
-
"""
|
|
187
|
-
Get all testsets.
|
|
188
|
-
|
|
189
|
-
Returns:
|
|
190
|
-
|
|
191
|
-
- A list of testset objects.
|
|
192
|
-
|
|
193
|
-
Raises:
|
|
194
|
-
|
|
195
|
-
- `HTTPException` with status code 404 if no testsets are found.
|
|
196
|
-
|
|
197
|
-
Parameters
|
|
198
|
-
----------
|
|
199
|
-
request_options : typing.Optional[RequestOptions]
|
|
200
|
-
Request-specific configuration.
|
|
201
|
-
|
|
202
|
-
Returns
|
|
203
|
-
-------
|
|
204
|
-
typing.List[TestSetOutputResponse]
|
|
205
|
-
Successful Response
|
|
206
|
-
|
|
207
|
-
Examples
|
|
208
|
-
--------
|
|
209
|
-
from agenta import AgentaApi
|
|
210
|
-
|
|
211
|
-
client = AgentaApi(
|
|
212
|
-
api_key="YOUR_API_KEY",
|
|
213
|
-
base_url="https://yourhost.com/path/to/api",
|
|
214
|
-
)
|
|
215
|
-
client.testsets.get_testsets()
|
|
216
|
-
"""
|
|
217
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
218
|
-
"testsets",
|
|
219
|
-
method="GET",
|
|
220
|
-
request_options=request_options,
|
|
221
|
-
)
|
|
222
|
-
try:
|
|
223
|
-
if 200 <= _response.status_code < 300:
|
|
224
|
-
return typing.cast(
|
|
225
|
-
typing.List[TestSetOutputResponse],
|
|
226
|
-
parse_obj_as(
|
|
227
|
-
type_=typing.List[TestSetOutputResponse], # type: ignore
|
|
228
|
-
object_=_response.json(),
|
|
229
|
-
),
|
|
230
|
-
)
|
|
231
|
-
_response_json = _response.json()
|
|
232
|
-
except JSONDecodeError:
|
|
233
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
234
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
235
|
-
|
|
236
170
|
def create_testset(
|
|
237
171
|
self,
|
|
238
172
|
*,
|
|
@@ -311,31 +245,31 @@ class TestsetsClient:
|
|
|
311
245
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
312
246
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
313
247
|
|
|
314
|
-
def
|
|
248
|
+
def get_single_testset(
|
|
315
249
|
self,
|
|
250
|
+
testset_id: str,
|
|
316
251
|
*,
|
|
317
|
-
testset_ids: typing.Sequence[str],
|
|
318
252
|
request_options: typing.Optional[RequestOptions] = None,
|
|
319
|
-
) -> typing.
|
|
253
|
+
) -> typing.Optional[typing.Any]:
|
|
320
254
|
"""
|
|
321
|
-
|
|
255
|
+
Fetch a specific testset in a MongoDB collection using its \_id.
|
|
322
256
|
|
|
323
257
|
Args:
|
|
324
|
-
|
|
258
|
+
testset_id (str): The \_id of the testset to fetch.
|
|
325
259
|
|
|
326
260
|
Returns:
|
|
327
|
-
|
|
261
|
+
The requested testset if found, else an HTTPException.
|
|
328
262
|
|
|
329
263
|
Parameters
|
|
330
264
|
----------
|
|
331
|
-
|
|
265
|
+
testset_id : str
|
|
332
266
|
|
|
333
267
|
request_options : typing.Optional[RequestOptions]
|
|
334
268
|
Request-specific configuration.
|
|
335
269
|
|
|
336
270
|
Returns
|
|
337
271
|
-------
|
|
338
|
-
typing.
|
|
272
|
+
typing.Optional[typing.Any]
|
|
339
273
|
Successful Response
|
|
340
274
|
|
|
341
275
|
Examples
|
|
@@ -346,28 +280,21 @@ class TestsetsClient:
|
|
|
346
280
|
api_key="YOUR_API_KEY",
|
|
347
281
|
base_url="https://yourhost.com/path/to/api",
|
|
348
282
|
)
|
|
349
|
-
client.testsets.
|
|
350
|
-
|
|
283
|
+
client.testsets.get_single_testset(
|
|
284
|
+
testset_id="testset_id",
|
|
351
285
|
)
|
|
352
286
|
"""
|
|
353
287
|
_response = self._client_wrapper.httpx_client.request(
|
|
354
|
-
"testsets",
|
|
355
|
-
method="
|
|
356
|
-
json={
|
|
357
|
-
"testset_ids": testset_ids,
|
|
358
|
-
},
|
|
359
|
-
headers={
|
|
360
|
-
"content-type": "application/json",
|
|
361
|
-
},
|
|
288
|
+
f"testsets/{jsonable_encoder(testset_id)}",
|
|
289
|
+
method="GET",
|
|
362
290
|
request_options=request_options,
|
|
363
|
-
omit=OMIT,
|
|
364
291
|
)
|
|
365
292
|
try:
|
|
366
293
|
if 200 <= _response.status_code < 300:
|
|
367
294
|
return typing.cast(
|
|
368
|
-
typing.
|
|
295
|
+
typing.Optional[typing.Any],
|
|
369
296
|
parse_obj_as(
|
|
370
|
-
type_=typing.
|
|
297
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
371
298
|
object_=_response.json(),
|
|
372
299
|
),
|
|
373
300
|
)
|
|
@@ -386,27 +313,27 @@ class TestsetsClient:
|
|
|
386
313
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
387
314
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
388
315
|
|
|
389
|
-
def
|
|
316
|
+
def update_testset(
|
|
390
317
|
self,
|
|
391
|
-
|
|
318
|
+
testset_id: str,
|
|
392
319
|
*,
|
|
393
320
|
name: str,
|
|
394
321
|
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
395
322
|
request_options: typing.Optional[RequestOptions] = None,
|
|
396
|
-
) ->
|
|
323
|
+
) -> typing.Optional[typing.Any]:
|
|
397
324
|
"""
|
|
398
|
-
|
|
325
|
+
Update a testset with given id, update the testset in MongoDB.
|
|
399
326
|
|
|
400
327
|
Args:
|
|
401
|
-
|
|
402
|
-
|
|
328
|
+
testset_id (str): id of the test set to be updated.
|
|
329
|
+
csvdata (NewTestset): New data to replace the old testset.
|
|
403
330
|
|
|
404
331
|
Returns:
|
|
405
|
-
str: The id of the test set
|
|
332
|
+
str: The id of the test set updated.
|
|
406
333
|
|
|
407
334
|
Parameters
|
|
408
335
|
----------
|
|
409
|
-
|
|
336
|
+
testset_id : str
|
|
410
337
|
|
|
411
338
|
name : str
|
|
412
339
|
|
|
@@ -417,7 +344,7 @@ class TestsetsClient:
|
|
|
417
344
|
|
|
418
345
|
Returns
|
|
419
346
|
-------
|
|
420
|
-
|
|
347
|
+
typing.Optional[typing.Any]
|
|
421
348
|
Successful Response
|
|
422
349
|
|
|
423
350
|
Examples
|
|
@@ -428,15 +355,15 @@ class TestsetsClient:
|
|
|
428
355
|
api_key="YOUR_API_KEY",
|
|
429
356
|
base_url="https://yourhost.com/path/to/api",
|
|
430
357
|
)
|
|
431
|
-
client.testsets.
|
|
432
|
-
|
|
358
|
+
client.testsets.update_testset(
|
|
359
|
+
testset_id="testset_id",
|
|
433
360
|
name="name",
|
|
434
361
|
csvdata=[{"key": "value"}],
|
|
435
362
|
)
|
|
436
363
|
"""
|
|
437
364
|
_response = self._client_wrapper.httpx_client.request(
|
|
438
|
-
f"testsets/{jsonable_encoder(
|
|
439
|
-
method="
|
|
365
|
+
f"testsets/{jsonable_encoder(testset_id)}",
|
|
366
|
+
method="PUT",
|
|
440
367
|
json={
|
|
441
368
|
"name": name,
|
|
442
369
|
"csvdata": csvdata,
|
|
@@ -447,9 +374,9 @@ class TestsetsClient:
|
|
|
447
374
|
try:
|
|
448
375
|
if 200 <= _response.status_code < 300:
|
|
449
376
|
return typing.cast(
|
|
450
|
-
|
|
377
|
+
typing.Optional[typing.Any],
|
|
451
378
|
parse_obj_as(
|
|
452
|
-
type_=
|
|
379
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
453
380
|
object_=_response.json(),
|
|
454
381
|
),
|
|
455
382
|
)
|
|
@@ -468,31 +395,28 @@ class TestsetsClient:
|
|
|
468
395
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
469
396
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
470
397
|
|
|
471
|
-
def
|
|
472
|
-
self,
|
|
473
|
-
|
|
474
|
-
*,
|
|
475
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
476
|
-
) -> typing.Optional[typing.Any]:
|
|
398
|
+
def get_testsets(
|
|
399
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
400
|
+
) -> typing.List[TestSetOutputResponse]:
|
|
477
401
|
"""
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
Args:
|
|
481
|
-
testset_id (str): The \_id of the testset to fetch.
|
|
402
|
+
Get all testsets.
|
|
482
403
|
|
|
483
404
|
Returns:
|
|
484
|
-
|
|
405
|
+
|
|
406
|
+
- A list of testset objects.
|
|
407
|
+
|
|
408
|
+
Raises:
|
|
409
|
+
|
|
410
|
+
- `HTTPException` with status code 404 if no testsets are found.
|
|
485
411
|
|
|
486
412
|
Parameters
|
|
487
413
|
----------
|
|
488
|
-
testset_id : str
|
|
489
|
-
|
|
490
414
|
request_options : typing.Optional[RequestOptions]
|
|
491
415
|
Request-specific configuration.
|
|
492
416
|
|
|
493
417
|
Returns
|
|
494
418
|
-------
|
|
495
|
-
typing.
|
|
419
|
+
typing.List[TestSetOutputResponse]
|
|
496
420
|
Successful Response
|
|
497
421
|
|
|
498
422
|
Examples
|
|
@@ -503,21 +427,19 @@ class TestsetsClient:
|
|
|
503
427
|
api_key="YOUR_API_KEY",
|
|
504
428
|
base_url="https://yourhost.com/path/to/api",
|
|
505
429
|
)
|
|
506
|
-
client.testsets.
|
|
507
|
-
testset_id="testset_id",
|
|
508
|
-
)
|
|
430
|
+
client.testsets.get_testsets()
|
|
509
431
|
"""
|
|
510
432
|
_response = self._client_wrapper.httpx_client.request(
|
|
511
|
-
|
|
433
|
+
"testsets",
|
|
512
434
|
method="GET",
|
|
513
435
|
request_options=request_options,
|
|
514
436
|
)
|
|
515
437
|
try:
|
|
516
438
|
if 200 <= _response.status_code < 300:
|
|
517
439
|
return typing.cast(
|
|
518
|
-
typing.
|
|
440
|
+
typing.List[TestSetOutputResponse],
|
|
519
441
|
parse_obj_as(
|
|
520
|
-
type_=typing.
|
|
442
|
+
type_=typing.List[TestSetOutputResponse], # type: ignore
|
|
521
443
|
object_=_response.json(),
|
|
522
444
|
),
|
|
523
445
|
)
|
|
@@ -536,38 +458,31 @@ class TestsetsClient:
|
|
|
536
458
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
537
459
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
538
460
|
|
|
539
|
-
def
|
|
461
|
+
def delete_testsets(
|
|
540
462
|
self,
|
|
541
|
-
testset_id: str,
|
|
542
463
|
*,
|
|
543
|
-
|
|
544
|
-
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
464
|
+
testset_ids: typing.Sequence[str],
|
|
545
465
|
request_options: typing.Optional[RequestOptions] = None,
|
|
546
|
-
) -> typing.
|
|
466
|
+
) -> typing.List[str]:
|
|
547
467
|
"""
|
|
548
|
-
|
|
468
|
+
Delete specific testsets based on their unique IDs.
|
|
549
469
|
|
|
550
470
|
Args:
|
|
551
|
-
|
|
552
|
-
csvdata (NewTestset): New data to replace the old testset.
|
|
471
|
+
testset_ids (List[str]): The unique identifiers of the testsets to delete.
|
|
553
472
|
|
|
554
473
|
Returns:
|
|
555
|
-
|
|
474
|
+
A list of the deleted testsets' IDs.
|
|
556
475
|
|
|
557
476
|
Parameters
|
|
558
477
|
----------
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
name : str
|
|
562
|
-
|
|
563
|
-
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
478
|
+
testset_ids : typing.Sequence[str]
|
|
564
479
|
|
|
565
480
|
request_options : typing.Optional[RequestOptions]
|
|
566
481
|
Request-specific configuration.
|
|
567
482
|
|
|
568
483
|
Returns
|
|
569
484
|
-------
|
|
570
|
-
typing.
|
|
485
|
+
typing.List[str]
|
|
571
486
|
Successful Response
|
|
572
487
|
|
|
573
488
|
Examples
|
|
@@ -578,18 +493,15 @@ class TestsetsClient:
|
|
|
578
493
|
api_key="YOUR_API_KEY",
|
|
579
494
|
base_url="https://yourhost.com/path/to/api",
|
|
580
495
|
)
|
|
581
|
-
client.testsets.
|
|
582
|
-
|
|
583
|
-
name="name",
|
|
584
|
-
csvdata=[{"key": "value"}],
|
|
496
|
+
client.testsets.delete_testsets(
|
|
497
|
+
testset_ids=["testset_ids"],
|
|
585
498
|
)
|
|
586
499
|
"""
|
|
587
500
|
_response = self._client_wrapper.httpx_client.request(
|
|
588
|
-
|
|
589
|
-
method="
|
|
501
|
+
"testsets",
|
|
502
|
+
method="DELETE",
|
|
590
503
|
json={
|
|
591
|
-
"
|
|
592
|
-
"csvdata": csvdata,
|
|
504
|
+
"testset_ids": testset_ids,
|
|
593
505
|
},
|
|
594
506
|
request_options=request_options,
|
|
595
507
|
omit=OMIT,
|
|
@@ -597,9 +509,9 @@ class TestsetsClient:
|
|
|
597
509
|
try:
|
|
598
510
|
if 200 <= _response.status_code < 300:
|
|
599
511
|
return typing.cast(
|
|
600
|
-
typing.
|
|
512
|
+
typing.List[str],
|
|
601
513
|
parse_obj_as(
|
|
602
|
-
type_=typing.
|
|
514
|
+
type_=typing.List[str], # type: ignore
|
|
603
515
|
object_=_response.json(),
|
|
604
516
|
),
|
|
605
517
|
)
|
|
@@ -715,11 +627,7 @@ class AsyncTestsetsClient:
|
|
|
715
627
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
716
628
|
|
|
717
629
|
async def import_testset(
|
|
718
|
-
self,
|
|
719
|
-
*,
|
|
720
|
-
endpoint: typing.Optional[str] = OMIT,
|
|
721
|
-
testset_name: typing.Optional[str] = OMIT,
|
|
722
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
630
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
723
631
|
) -> TestSetSimpleResponse:
|
|
724
632
|
"""
|
|
725
633
|
Import JSON testset data from an endpoint and save it to MongoDB.
|
|
@@ -733,10 +641,6 @@ class AsyncTestsetsClient:
|
|
|
733
641
|
|
|
734
642
|
Parameters
|
|
735
643
|
----------
|
|
736
|
-
endpoint : typing.Optional[str]
|
|
737
|
-
|
|
738
|
-
testset_name : typing.Optional[str]
|
|
739
|
-
|
|
740
644
|
request_options : typing.Optional[RequestOptions]
|
|
741
645
|
Request-specific configuration.
|
|
742
646
|
|
|
@@ -766,12 +670,7 @@ class AsyncTestsetsClient:
|
|
|
766
670
|
_response = await self._client_wrapper.httpx_client.request(
|
|
767
671
|
"testsets/endpoint",
|
|
768
672
|
method="POST",
|
|
769
|
-
json={
|
|
770
|
-
"endpoint": endpoint,
|
|
771
|
-
"testset_name": testset_name,
|
|
772
|
-
},
|
|
773
673
|
request_options=request_options,
|
|
774
|
-
omit=OMIT,
|
|
775
674
|
)
|
|
776
675
|
try:
|
|
777
676
|
if 200 <= _response.status_code < 300:
|
|
@@ -797,67 +696,6 @@ class AsyncTestsetsClient:
|
|
|
797
696
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
798
697
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
799
698
|
|
|
800
|
-
async def get_testsets(
|
|
801
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
802
|
-
) -> typing.List[TestSetOutputResponse]:
|
|
803
|
-
"""
|
|
804
|
-
Get all testsets.
|
|
805
|
-
|
|
806
|
-
Returns:
|
|
807
|
-
|
|
808
|
-
- A list of testset objects.
|
|
809
|
-
|
|
810
|
-
Raises:
|
|
811
|
-
|
|
812
|
-
- `HTTPException` with status code 404 if no testsets are found.
|
|
813
|
-
|
|
814
|
-
Parameters
|
|
815
|
-
----------
|
|
816
|
-
request_options : typing.Optional[RequestOptions]
|
|
817
|
-
Request-specific configuration.
|
|
818
|
-
|
|
819
|
-
Returns
|
|
820
|
-
-------
|
|
821
|
-
typing.List[TestSetOutputResponse]
|
|
822
|
-
Successful Response
|
|
823
|
-
|
|
824
|
-
Examples
|
|
825
|
-
--------
|
|
826
|
-
import asyncio
|
|
827
|
-
|
|
828
|
-
from agenta import AsyncAgentaApi
|
|
829
|
-
|
|
830
|
-
client = AsyncAgentaApi(
|
|
831
|
-
api_key="YOUR_API_KEY",
|
|
832
|
-
base_url="https://yourhost.com/path/to/api",
|
|
833
|
-
)
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
async def main() -> None:
|
|
837
|
-
await client.testsets.get_testsets()
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
asyncio.run(main())
|
|
841
|
-
"""
|
|
842
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
843
|
-
"testsets",
|
|
844
|
-
method="GET",
|
|
845
|
-
request_options=request_options,
|
|
846
|
-
)
|
|
847
|
-
try:
|
|
848
|
-
if 200 <= _response.status_code < 300:
|
|
849
|
-
return typing.cast(
|
|
850
|
-
typing.List[TestSetOutputResponse],
|
|
851
|
-
parse_obj_as(
|
|
852
|
-
type_=typing.List[TestSetOutputResponse], # type: ignore
|
|
853
|
-
object_=_response.json(),
|
|
854
|
-
),
|
|
855
|
-
)
|
|
856
|
-
_response_json = _response.json()
|
|
857
|
-
except JSONDecodeError:
|
|
858
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
859
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
860
|
-
|
|
861
699
|
async def create_testset(
|
|
862
700
|
self,
|
|
863
701
|
*,
|
|
@@ -944,31 +782,31 @@ class AsyncTestsetsClient:
|
|
|
944
782
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
945
783
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
946
784
|
|
|
947
|
-
async def
|
|
785
|
+
async def get_single_testset(
|
|
948
786
|
self,
|
|
787
|
+
testset_id: str,
|
|
949
788
|
*,
|
|
950
|
-
testset_ids: typing.Sequence[str],
|
|
951
789
|
request_options: typing.Optional[RequestOptions] = None,
|
|
952
|
-
) -> typing.
|
|
790
|
+
) -> typing.Optional[typing.Any]:
|
|
953
791
|
"""
|
|
954
|
-
|
|
792
|
+
Fetch a specific testset in a MongoDB collection using its \_id.
|
|
955
793
|
|
|
956
794
|
Args:
|
|
957
|
-
|
|
795
|
+
testset_id (str): The \_id of the testset to fetch.
|
|
958
796
|
|
|
959
797
|
Returns:
|
|
960
|
-
|
|
798
|
+
The requested testset if found, else an HTTPException.
|
|
961
799
|
|
|
962
800
|
Parameters
|
|
963
801
|
----------
|
|
964
|
-
|
|
802
|
+
testset_id : str
|
|
965
803
|
|
|
966
804
|
request_options : typing.Optional[RequestOptions]
|
|
967
805
|
Request-specific configuration.
|
|
968
806
|
|
|
969
807
|
Returns
|
|
970
808
|
-------
|
|
971
|
-
typing.
|
|
809
|
+
typing.Optional[typing.Any]
|
|
972
810
|
Successful Response
|
|
973
811
|
|
|
974
812
|
Examples
|
|
@@ -984,31 +822,24 @@ class AsyncTestsetsClient:
|
|
|
984
822
|
|
|
985
823
|
|
|
986
824
|
async def main() -> None:
|
|
987
|
-
await client.testsets.
|
|
988
|
-
|
|
825
|
+
await client.testsets.get_single_testset(
|
|
826
|
+
testset_id="testset_id",
|
|
989
827
|
)
|
|
990
828
|
|
|
991
829
|
|
|
992
830
|
asyncio.run(main())
|
|
993
831
|
"""
|
|
994
832
|
_response = await self._client_wrapper.httpx_client.request(
|
|
995
|
-
"testsets",
|
|
996
|
-
method="
|
|
997
|
-
json={
|
|
998
|
-
"testset_ids": testset_ids,
|
|
999
|
-
},
|
|
1000
|
-
headers={
|
|
1001
|
-
"content-type": "application/json",
|
|
1002
|
-
},
|
|
833
|
+
f"testsets/{jsonable_encoder(testset_id)}",
|
|
834
|
+
method="GET",
|
|
1003
835
|
request_options=request_options,
|
|
1004
|
-
omit=OMIT,
|
|
1005
836
|
)
|
|
1006
837
|
try:
|
|
1007
838
|
if 200 <= _response.status_code < 300:
|
|
1008
839
|
return typing.cast(
|
|
1009
|
-
typing.
|
|
840
|
+
typing.Optional[typing.Any],
|
|
1010
841
|
parse_obj_as(
|
|
1011
|
-
type_=typing.
|
|
842
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1012
843
|
object_=_response.json(),
|
|
1013
844
|
),
|
|
1014
845
|
)
|
|
@@ -1027,27 +858,27 @@ class AsyncTestsetsClient:
|
|
|
1027
858
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1028
859
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1029
860
|
|
|
1030
|
-
async def
|
|
861
|
+
async def update_testset(
|
|
1031
862
|
self,
|
|
1032
|
-
|
|
863
|
+
testset_id: str,
|
|
1033
864
|
*,
|
|
1034
865
|
name: str,
|
|
1035
866
|
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
1036
867
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1037
|
-
) ->
|
|
868
|
+
) -> typing.Optional[typing.Any]:
|
|
1038
869
|
"""
|
|
1039
|
-
|
|
870
|
+
Update a testset with given id, update the testset in MongoDB.
|
|
1040
871
|
|
|
1041
872
|
Args:
|
|
1042
|
-
|
|
1043
|
-
|
|
873
|
+
testset_id (str): id of the test set to be updated.
|
|
874
|
+
csvdata (NewTestset): New data to replace the old testset.
|
|
1044
875
|
|
|
1045
876
|
Returns:
|
|
1046
|
-
str: The id of the test set
|
|
877
|
+
str: The id of the test set updated.
|
|
1047
878
|
|
|
1048
879
|
Parameters
|
|
1049
880
|
----------
|
|
1050
|
-
|
|
881
|
+
testset_id : str
|
|
1051
882
|
|
|
1052
883
|
name : str
|
|
1053
884
|
|
|
@@ -1058,7 +889,7 @@ class AsyncTestsetsClient:
|
|
|
1058
889
|
|
|
1059
890
|
Returns
|
|
1060
891
|
-------
|
|
1061
|
-
|
|
892
|
+
typing.Optional[typing.Any]
|
|
1062
893
|
Successful Response
|
|
1063
894
|
|
|
1064
895
|
Examples
|
|
@@ -1074,8 +905,8 @@ class AsyncTestsetsClient:
|
|
|
1074
905
|
|
|
1075
906
|
|
|
1076
907
|
async def main() -> None:
|
|
1077
|
-
await client.testsets.
|
|
1078
|
-
|
|
908
|
+
await client.testsets.update_testset(
|
|
909
|
+
testset_id="testset_id",
|
|
1079
910
|
name="name",
|
|
1080
911
|
csvdata=[{"key": "value"}],
|
|
1081
912
|
)
|
|
@@ -1084,8 +915,8 @@ class AsyncTestsetsClient:
|
|
|
1084
915
|
asyncio.run(main())
|
|
1085
916
|
"""
|
|
1086
917
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1087
|
-
f"testsets/{jsonable_encoder(
|
|
1088
|
-
method="
|
|
918
|
+
f"testsets/{jsonable_encoder(testset_id)}",
|
|
919
|
+
method="PUT",
|
|
1089
920
|
json={
|
|
1090
921
|
"name": name,
|
|
1091
922
|
"csvdata": csvdata,
|
|
@@ -1096,9 +927,9 @@ class AsyncTestsetsClient:
|
|
|
1096
927
|
try:
|
|
1097
928
|
if 200 <= _response.status_code < 300:
|
|
1098
929
|
return typing.cast(
|
|
1099
|
-
|
|
930
|
+
typing.Optional[typing.Any],
|
|
1100
931
|
parse_obj_as(
|
|
1101
|
-
type_=
|
|
932
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1102
933
|
object_=_response.json(),
|
|
1103
934
|
),
|
|
1104
935
|
)
|
|
@@ -1117,31 +948,28 @@ class AsyncTestsetsClient:
|
|
|
1117
948
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1118
949
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1119
950
|
|
|
1120
|
-
async def
|
|
1121
|
-
self,
|
|
1122
|
-
|
|
1123
|
-
*,
|
|
1124
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1125
|
-
) -> typing.Optional[typing.Any]:
|
|
951
|
+
async def get_testsets(
|
|
952
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
953
|
+
) -> typing.List[TestSetOutputResponse]:
|
|
1126
954
|
"""
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
Args:
|
|
1130
|
-
testset_id (str): The \_id of the testset to fetch.
|
|
955
|
+
Get all testsets.
|
|
1131
956
|
|
|
1132
957
|
Returns:
|
|
1133
|
-
|
|
958
|
+
|
|
959
|
+
- A list of testset objects.
|
|
960
|
+
|
|
961
|
+
Raises:
|
|
962
|
+
|
|
963
|
+
- `HTTPException` with status code 404 if no testsets are found.
|
|
1134
964
|
|
|
1135
965
|
Parameters
|
|
1136
966
|
----------
|
|
1137
|
-
testset_id : str
|
|
1138
|
-
|
|
1139
967
|
request_options : typing.Optional[RequestOptions]
|
|
1140
968
|
Request-specific configuration.
|
|
1141
969
|
|
|
1142
970
|
Returns
|
|
1143
971
|
-------
|
|
1144
|
-
typing.
|
|
972
|
+
typing.List[TestSetOutputResponse]
|
|
1145
973
|
Successful Response
|
|
1146
974
|
|
|
1147
975
|
Examples
|
|
@@ -1157,24 +985,22 @@ class AsyncTestsetsClient:
|
|
|
1157
985
|
|
|
1158
986
|
|
|
1159
987
|
async def main() -> None:
|
|
1160
|
-
await client.testsets.
|
|
1161
|
-
testset_id="testset_id",
|
|
1162
|
-
)
|
|
988
|
+
await client.testsets.get_testsets()
|
|
1163
989
|
|
|
1164
990
|
|
|
1165
991
|
asyncio.run(main())
|
|
1166
992
|
"""
|
|
1167
993
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1168
|
-
|
|
994
|
+
"testsets",
|
|
1169
995
|
method="GET",
|
|
1170
996
|
request_options=request_options,
|
|
1171
997
|
)
|
|
1172
998
|
try:
|
|
1173
999
|
if 200 <= _response.status_code < 300:
|
|
1174
1000
|
return typing.cast(
|
|
1175
|
-
typing.
|
|
1001
|
+
typing.List[TestSetOutputResponse],
|
|
1176
1002
|
parse_obj_as(
|
|
1177
|
-
type_=typing.
|
|
1003
|
+
type_=typing.List[TestSetOutputResponse], # type: ignore
|
|
1178
1004
|
object_=_response.json(),
|
|
1179
1005
|
),
|
|
1180
1006
|
)
|
|
@@ -1193,38 +1019,31 @@ class AsyncTestsetsClient:
|
|
|
1193
1019
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1194
1020
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1195
1021
|
|
|
1196
|
-
async def
|
|
1022
|
+
async def delete_testsets(
|
|
1197
1023
|
self,
|
|
1198
|
-
testset_id: str,
|
|
1199
1024
|
*,
|
|
1200
|
-
|
|
1201
|
-
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
1025
|
+
testset_ids: typing.Sequence[str],
|
|
1202
1026
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1203
|
-
) -> typing.
|
|
1027
|
+
) -> typing.List[str]:
|
|
1204
1028
|
"""
|
|
1205
|
-
|
|
1029
|
+
Delete specific testsets based on their unique IDs.
|
|
1206
1030
|
|
|
1207
1031
|
Args:
|
|
1208
|
-
|
|
1209
|
-
csvdata (NewTestset): New data to replace the old testset.
|
|
1032
|
+
testset_ids (List[str]): The unique identifiers of the testsets to delete.
|
|
1210
1033
|
|
|
1211
1034
|
Returns:
|
|
1212
|
-
|
|
1035
|
+
A list of the deleted testsets' IDs.
|
|
1213
1036
|
|
|
1214
1037
|
Parameters
|
|
1215
1038
|
----------
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
name : str
|
|
1219
|
-
|
|
1220
|
-
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1039
|
+
testset_ids : typing.Sequence[str]
|
|
1221
1040
|
|
|
1222
1041
|
request_options : typing.Optional[RequestOptions]
|
|
1223
1042
|
Request-specific configuration.
|
|
1224
1043
|
|
|
1225
1044
|
Returns
|
|
1226
1045
|
-------
|
|
1227
|
-
typing.
|
|
1046
|
+
typing.List[str]
|
|
1228
1047
|
Successful Response
|
|
1229
1048
|
|
|
1230
1049
|
Examples
|
|
@@ -1240,21 +1059,18 @@ class AsyncTestsetsClient:
|
|
|
1240
1059
|
|
|
1241
1060
|
|
|
1242
1061
|
async def main() -> None:
|
|
1243
|
-
await client.testsets.
|
|
1244
|
-
|
|
1245
|
-
name="name",
|
|
1246
|
-
csvdata=[{"key": "value"}],
|
|
1062
|
+
await client.testsets.delete_testsets(
|
|
1063
|
+
testset_ids=["testset_ids"],
|
|
1247
1064
|
)
|
|
1248
1065
|
|
|
1249
1066
|
|
|
1250
1067
|
asyncio.run(main())
|
|
1251
1068
|
"""
|
|
1252
1069
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1253
|
-
|
|
1254
|
-
method="
|
|
1070
|
+
"testsets",
|
|
1071
|
+
method="DELETE",
|
|
1255
1072
|
json={
|
|
1256
|
-
"
|
|
1257
|
-
"csvdata": csvdata,
|
|
1073
|
+
"testset_ids": testset_ids,
|
|
1258
1074
|
},
|
|
1259
1075
|
request_options=request_options,
|
|
1260
1076
|
omit=OMIT,
|
|
@@ -1262,9 +1078,9 @@ class AsyncTestsetsClient:
|
|
|
1262
1078
|
try:
|
|
1263
1079
|
if 200 <= _response.status_code < 300:
|
|
1264
1080
|
return typing.cast(
|
|
1265
|
-
typing.
|
|
1081
|
+
typing.List[str],
|
|
1266
1082
|
parse_obj_as(
|
|
1267
|
-
type_=typing.
|
|
1083
|
+
type_=typing.List[str], # type: ignore
|
|
1268
1084
|
object_=_response.json(),
|
|
1269
1085
|
),
|
|
1270
1086
|
)
|