agenta 0.30.0a2__py3-none-any.whl → 0.30.0a4__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/__init__.py +32 -3
- agenta/client/backend/access_control/__init__.py +1 -0
- agenta/client/backend/access_control/client.py +167 -0
- agenta/client/backend/apps/client.py +70 -10
- agenta/client/backend/client.py +61 -45
- agenta/client/backend/configs/client.py +6 -0
- agenta/client/backend/containers/client.py +6 -0
- agenta/client/backend/core/file.py +13 -8
- agenta/client/backend/environments/client.py +6 -0
- agenta/client/backend/evaluations/client.py +14 -1
- agenta/client/backend/evaluators/client.py +24 -0
- agenta/client/backend/observability/client.py +22 -16
- agenta/client/backend/observability_v_1/__init__.py +2 -2
- agenta/client/backend/observability_v_1/client.py +203 -0
- agenta/client/backend/observability_v_1/types/__init__.py +2 -1
- agenta/client/backend/observability_v_1/types/format.py +1 -1
- agenta/client/backend/observability_v_1/types/query_analytics_response.py +7 -0
- agenta/client/backend/scopes/__init__.py +1 -0
- agenta/client/backend/scopes/client.py +114 -0
- agenta/client/backend/testsets/client.py +305 -121
- agenta/client/backend/types/__init__.py +24 -2
- agenta/client/backend/types/analytics_response.py +24 -0
- agenta/client/backend/types/app.py +2 -1
- agenta/client/backend/types/body_import_testset.py +0 -1
- agenta/client/backend/types/bucket_dto.py +26 -0
- agenta/client/backend/types/header_dto.py +22 -0
- agenta/client/backend/types/legacy_analytics_response.py +29 -0
- agenta/client/backend/types/legacy_data_point.py +27 -0
- agenta/client/backend/types/metrics_dto.py +24 -0
- agenta/client/backend/types/permission.py +1 -0
- agenta/client/backend/types/projects_response.py +28 -0
- agenta/client/backend/types/provider_key_dto.py +23 -0
- agenta/client/backend/types/provider_kind.py +21 -0
- agenta/client/backend/types/secret_dto.py +24 -0
- agenta/client/backend/types/secret_kind.py +5 -0
- agenta/client/backend/types/secret_response_dto.py +27 -0
- agenta/client/backend/variants/client.py +66 -0
- agenta/client/backend/vault/__init__.py +1 -0
- agenta/client/backend/vault/client.py +685 -0
- agenta/client/client.py +1 -1
- agenta/sdk/__init__.py +1 -0
- agenta/sdk/agenta_init.py +47 -118
- agenta/sdk/assets.py +57 -46
- agenta/sdk/context/exporting.py +25 -0
- agenta/sdk/context/routing.py +12 -12
- agenta/sdk/context/tracing.py +26 -1
- agenta/sdk/decorators/routing.py +279 -243
- agenta/sdk/decorators/tracing.py +53 -31
- agenta/sdk/managers/config.py +8 -118
- agenta/sdk/managers/secrets.py +38 -0
- agenta/sdk/middleware/auth.py +128 -93
- agenta/sdk/middleware/cache.py +4 -0
- agenta/sdk/middleware/config.py +254 -0
- agenta/sdk/middleware/cors.py +28 -0
- agenta/sdk/middleware/otel.py +40 -0
- agenta/sdk/middleware/vault.py +158 -0
- agenta/sdk/tracing/exporters.py +40 -2
- agenta/sdk/tracing/inline.py +2 -2
- agenta/sdk/tracing/processors.py +11 -3
- agenta/sdk/tracing/tracing.py +14 -12
- agenta/sdk/utils/constants.py +1 -0
- agenta/sdk/utils/exceptions.py +20 -19
- agenta/sdk/utils/globals.py +4 -8
- agenta/sdk/utils/timing.py +58 -0
- {agenta-0.30.0a2.dist-info → agenta-0.30.0a4.dist-info}/METADATA +3 -2
- {agenta-0.30.0a2.dist-info → agenta-0.30.0a4.dist-info}/RECORD +69 -44
- {agenta-0.30.0a2.dist-info → agenta-0.30.0a4.dist-info}/WHEEL +1 -1
- agenta/client/backend/types/lm_providers_enum.py +0 -21
- agenta/sdk/tracing/context.py +0 -24
- {agenta-0.30.0a2.dist-info → agenta-0.30.0a4.dist-info}/entry_points.txt +0 -0
|
@@ -66,7 +66,7 @@ class ObservabilityClient:
|
|
|
66
66
|
)
|
|
67
67
|
"""
|
|
68
68
|
_response = self._client_wrapper.httpx_client.request(
|
|
69
|
-
"observability/dashboard
|
|
69
|
+
"observability/dashboard",
|
|
70
70
|
method="GET",
|
|
71
71
|
params={
|
|
72
72
|
"app_id": app_id,
|
|
@@ -152,7 +152,7 @@ class ObservabilityClient:
|
|
|
152
152
|
)
|
|
153
153
|
"""
|
|
154
154
|
_response = self._client_wrapper.httpx_client.request(
|
|
155
|
-
"observability/trace
|
|
155
|
+
"observability/trace",
|
|
156
156
|
method="POST",
|
|
157
157
|
json={
|
|
158
158
|
"trace": trace,
|
|
@@ -162,6 +162,9 @@ class ObservabilityClient:
|
|
|
162
162
|
direction="write",
|
|
163
163
|
),
|
|
164
164
|
},
|
|
165
|
+
headers={
|
|
166
|
+
"content-type": "application/json",
|
|
167
|
+
},
|
|
165
168
|
request_options=request_options,
|
|
166
169
|
omit=OMIT,
|
|
167
170
|
)
|
|
@@ -242,7 +245,7 @@ class ObservabilityClient:
|
|
|
242
245
|
)
|
|
243
246
|
"""
|
|
244
247
|
_response = self._client_wrapper.httpx_client.request(
|
|
245
|
-
"observability/traces
|
|
248
|
+
"observability/traces",
|
|
246
249
|
method="GET",
|
|
247
250
|
params={
|
|
248
251
|
"app_id": app_id,
|
|
@@ -312,7 +315,7 @@ class ObservabilityClient:
|
|
|
312
315
|
)
|
|
313
316
|
"""
|
|
314
317
|
_response = self._client_wrapper.httpx_client.request(
|
|
315
|
-
"observability/traces
|
|
318
|
+
"observability/traces",
|
|
316
319
|
method="DELETE",
|
|
317
320
|
json=request,
|
|
318
321
|
request_options=request_options,
|
|
@@ -371,7 +374,7 @@ class ObservabilityClient:
|
|
|
371
374
|
)
|
|
372
375
|
"""
|
|
373
376
|
_response = self._client_wrapper.httpx_client.request(
|
|
374
|
-
f"observability/traces/{jsonable_encoder(trace_id)}
|
|
377
|
+
f"observability/traces/{jsonable_encoder(trace_id)}",
|
|
375
378
|
method="GET",
|
|
376
379
|
request_options=request_options,
|
|
377
380
|
)
|
|
@@ -452,7 +455,7 @@ class ObservabilityClient:
|
|
|
452
455
|
)
|
|
453
456
|
"""
|
|
454
457
|
_response = self._client_wrapper.httpx_client.request(
|
|
455
|
-
"observability/spans
|
|
458
|
+
"observability/spans",
|
|
456
459
|
method="GET",
|
|
457
460
|
params={
|
|
458
461
|
"app_id": app_id,
|
|
@@ -522,7 +525,7 @@ class ObservabilityClient:
|
|
|
522
525
|
)
|
|
523
526
|
"""
|
|
524
527
|
_response = self._client_wrapper.httpx_client.request(
|
|
525
|
-
"observability/spans
|
|
528
|
+
"observability/spans",
|
|
526
529
|
method="DELETE",
|
|
527
530
|
json=request,
|
|
528
531
|
request_options=request_options,
|
|
@@ -587,7 +590,7 @@ class ObservabilityClient:
|
|
|
587
590
|
)
|
|
588
591
|
"""
|
|
589
592
|
_response = self._client_wrapper.httpx_client.request(
|
|
590
|
-
f"observability/spans/{jsonable_encoder(span_id)}
|
|
593
|
+
f"observability/spans/{jsonable_encoder(span_id)}",
|
|
591
594
|
method="GET",
|
|
592
595
|
params={
|
|
593
596
|
"type": type,
|
|
@@ -672,7 +675,7 @@ class AsyncObservabilityClient:
|
|
|
672
675
|
asyncio.run(main())
|
|
673
676
|
"""
|
|
674
677
|
_response = await self._client_wrapper.httpx_client.request(
|
|
675
|
-
"observability/dashboard
|
|
678
|
+
"observability/dashboard",
|
|
676
679
|
method="GET",
|
|
677
680
|
params={
|
|
678
681
|
"app_id": app_id,
|
|
@@ -765,7 +768,7 @@ class AsyncObservabilityClient:
|
|
|
765
768
|
asyncio.run(main())
|
|
766
769
|
"""
|
|
767
770
|
_response = await self._client_wrapper.httpx_client.request(
|
|
768
|
-
"observability/trace
|
|
771
|
+
"observability/trace",
|
|
769
772
|
method="POST",
|
|
770
773
|
json={
|
|
771
774
|
"trace": trace,
|
|
@@ -775,6 +778,9 @@ class AsyncObservabilityClient:
|
|
|
775
778
|
direction="write",
|
|
776
779
|
),
|
|
777
780
|
},
|
|
781
|
+
headers={
|
|
782
|
+
"content-type": "application/json",
|
|
783
|
+
},
|
|
778
784
|
request_options=request_options,
|
|
779
785
|
omit=OMIT,
|
|
780
786
|
)
|
|
@@ -863,7 +869,7 @@ class AsyncObservabilityClient:
|
|
|
863
869
|
asyncio.run(main())
|
|
864
870
|
"""
|
|
865
871
|
_response = await self._client_wrapper.httpx_client.request(
|
|
866
|
-
"observability/traces
|
|
872
|
+
"observability/traces",
|
|
867
873
|
method="GET",
|
|
868
874
|
params={
|
|
869
875
|
"app_id": app_id,
|
|
@@ -941,7 +947,7 @@ class AsyncObservabilityClient:
|
|
|
941
947
|
asyncio.run(main())
|
|
942
948
|
"""
|
|
943
949
|
_response = await self._client_wrapper.httpx_client.request(
|
|
944
|
-
"observability/traces
|
|
950
|
+
"observability/traces",
|
|
945
951
|
method="DELETE",
|
|
946
952
|
json=request,
|
|
947
953
|
request_options=request_options,
|
|
@@ -1008,7 +1014,7 @@ class AsyncObservabilityClient:
|
|
|
1008
1014
|
asyncio.run(main())
|
|
1009
1015
|
"""
|
|
1010
1016
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1011
|
-
f"observability/traces/{jsonable_encoder(trace_id)}
|
|
1017
|
+
f"observability/traces/{jsonable_encoder(trace_id)}",
|
|
1012
1018
|
method="GET",
|
|
1013
1019
|
request_options=request_options,
|
|
1014
1020
|
)
|
|
@@ -1097,7 +1103,7 @@ class AsyncObservabilityClient:
|
|
|
1097
1103
|
asyncio.run(main())
|
|
1098
1104
|
"""
|
|
1099
1105
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1100
|
-
"observability/spans
|
|
1106
|
+
"observability/spans",
|
|
1101
1107
|
method="GET",
|
|
1102
1108
|
params={
|
|
1103
1109
|
"app_id": app_id,
|
|
@@ -1175,7 +1181,7 @@ class AsyncObservabilityClient:
|
|
|
1175
1181
|
asyncio.run(main())
|
|
1176
1182
|
"""
|
|
1177
1183
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1178
|
-
"observability/spans
|
|
1184
|
+
"observability/spans",
|
|
1179
1185
|
method="DELETE",
|
|
1180
1186
|
json=request,
|
|
1181
1187
|
request_options=request_options,
|
|
@@ -1248,7 +1254,7 @@ class AsyncObservabilityClient:
|
|
|
1248
1254
|
asyncio.run(main())
|
|
1249
1255
|
"""
|
|
1250
1256
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1251
|
-
f"observability/spans/{jsonable_encoder(span_id)}
|
|
1257
|
+
f"observability/spans/{jsonable_encoder(span_id)}",
|
|
1252
1258
|
method="GET",
|
|
1253
1259
|
params={
|
|
1254
1260
|
"type": type,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from .types import Format, QueryTracesResponse
|
|
3
|
+
from .types import Format, QueryAnalyticsResponse, QueryTracesResponse
|
|
4
4
|
|
|
5
|
-
__all__ = ["Format", "QueryTracesResponse"]
|
|
5
|
+
__all__ = ["Format", "QueryAnalyticsResponse", "QueryTracesResponse"]
|
|
@@ -11,6 +11,7 @@ from .types.format import Format
|
|
|
11
11
|
from .types.query_traces_response import QueryTracesResponse
|
|
12
12
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
13
13
|
from ..types.http_validation_error import HttpValidationError
|
|
14
|
+
from .types.query_analytics_response import QueryAnalyticsResponse
|
|
14
15
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
15
16
|
|
|
16
17
|
|
|
@@ -270,6 +271,103 @@ class ObservabilityV1Client:
|
|
|
270
271
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
271
272
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
272
273
|
|
|
274
|
+
def query_analytics(
|
|
275
|
+
self,
|
|
276
|
+
*,
|
|
277
|
+
format: typing.Optional[Format] = None,
|
|
278
|
+
focus: typing.Optional[str] = None,
|
|
279
|
+
oldest: typing.Optional[str] = None,
|
|
280
|
+
newest: typing.Optional[str] = None,
|
|
281
|
+
window: typing.Optional[int] = None,
|
|
282
|
+
filtering: typing.Optional[str] = None,
|
|
283
|
+
time_range: typing.Optional[str] = None,
|
|
284
|
+
app_id: typing.Optional[str] = None,
|
|
285
|
+
environment: typing.Optional[str] = None,
|
|
286
|
+
variant: typing.Optional[str] = None,
|
|
287
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
288
|
+
) -> QueryAnalyticsResponse:
|
|
289
|
+
"""
|
|
290
|
+
Parameters
|
|
291
|
+
----------
|
|
292
|
+
format : typing.Optional[Format]
|
|
293
|
+
|
|
294
|
+
focus : typing.Optional[str]
|
|
295
|
+
|
|
296
|
+
oldest : typing.Optional[str]
|
|
297
|
+
|
|
298
|
+
newest : typing.Optional[str]
|
|
299
|
+
|
|
300
|
+
window : typing.Optional[int]
|
|
301
|
+
|
|
302
|
+
filtering : typing.Optional[str]
|
|
303
|
+
|
|
304
|
+
time_range : typing.Optional[str]
|
|
305
|
+
|
|
306
|
+
app_id : typing.Optional[str]
|
|
307
|
+
|
|
308
|
+
environment : typing.Optional[str]
|
|
309
|
+
|
|
310
|
+
variant : typing.Optional[str]
|
|
311
|
+
|
|
312
|
+
request_options : typing.Optional[RequestOptions]
|
|
313
|
+
Request-specific configuration.
|
|
314
|
+
|
|
315
|
+
Returns
|
|
316
|
+
-------
|
|
317
|
+
QueryAnalyticsResponse
|
|
318
|
+
Successful Response
|
|
319
|
+
|
|
320
|
+
Examples
|
|
321
|
+
--------
|
|
322
|
+
from agenta import AgentaApi
|
|
323
|
+
|
|
324
|
+
client = AgentaApi(
|
|
325
|
+
api_key="YOUR_API_KEY",
|
|
326
|
+
base_url="https://yourhost.com/path/to/api",
|
|
327
|
+
)
|
|
328
|
+
client.observability_v_1.query_analytics()
|
|
329
|
+
"""
|
|
330
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
331
|
+
"observability/v1/analytics",
|
|
332
|
+
method="GET",
|
|
333
|
+
params={
|
|
334
|
+
"format": format,
|
|
335
|
+
"focus": focus,
|
|
336
|
+
"oldest": oldest,
|
|
337
|
+
"newest": newest,
|
|
338
|
+
"window": window,
|
|
339
|
+
"filtering": filtering,
|
|
340
|
+
"timeRange": time_range,
|
|
341
|
+
"app_id": app_id,
|
|
342
|
+
"environment": environment,
|
|
343
|
+
"variant": variant,
|
|
344
|
+
},
|
|
345
|
+
request_options=request_options,
|
|
346
|
+
)
|
|
347
|
+
try:
|
|
348
|
+
if 200 <= _response.status_code < 300:
|
|
349
|
+
return typing.cast(
|
|
350
|
+
QueryAnalyticsResponse,
|
|
351
|
+
parse_obj_as(
|
|
352
|
+
type_=QueryAnalyticsResponse, # type: ignore
|
|
353
|
+
object_=_response.json(),
|
|
354
|
+
),
|
|
355
|
+
)
|
|
356
|
+
if _response.status_code == 422:
|
|
357
|
+
raise UnprocessableEntityError(
|
|
358
|
+
typing.cast(
|
|
359
|
+
HttpValidationError,
|
|
360
|
+
parse_obj_as(
|
|
361
|
+
type_=HttpValidationError, # type: ignore
|
|
362
|
+
object_=_response.json(),
|
|
363
|
+
),
|
|
364
|
+
)
|
|
365
|
+
)
|
|
366
|
+
_response_json = _response.json()
|
|
367
|
+
except JSONDecodeError:
|
|
368
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
369
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
370
|
+
|
|
273
371
|
|
|
274
372
|
class AsyncObservabilityV1Client:
|
|
275
373
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -558,3 +656,108 @@ class AsyncObservabilityV1Client:
|
|
|
558
656
|
except JSONDecodeError:
|
|
559
657
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
560
658
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
659
|
+
|
|
660
|
+
async def query_analytics(
|
|
661
|
+
self,
|
|
662
|
+
*,
|
|
663
|
+
format: typing.Optional[Format] = None,
|
|
664
|
+
focus: typing.Optional[str] = None,
|
|
665
|
+
oldest: typing.Optional[str] = None,
|
|
666
|
+
newest: typing.Optional[str] = None,
|
|
667
|
+
window: typing.Optional[int] = None,
|
|
668
|
+
filtering: typing.Optional[str] = None,
|
|
669
|
+
time_range: typing.Optional[str] = None,
|
|
670
|
+
app_id: typing.Optional[str] = None,
|
|
671
|
+
environment: typing.Optional[str] = None,
|
|
672
|
+
variant: typing.Optional[str] = None,
|
|
673
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
674
|
+
) -> QueryAnalyticsResponse:
|
|
675
|
+
"""
|
|
676
|
+
Parameters
|
|
677
|
+
----------
|
|
678
|
+
format : typing.Optional[Format]
|
|
679
|
+
|
|
680
|
+
focus : typing.Optional[str]
|
|
681
|
+
|
|
682
|
+
oldest : typing.Optional[str]
|
|
683
|
+
|
|
684
|
+
newest : typing.Optional[str]
|
|
685
|
+
|
|
686
|
+
window : typing.Optional[int]
|
|
687
|
+
|
|
688
|
+
filtering : typing.Optional[str]
|
|
689
|
+
|
|
690
|
+
time_range : typing.Optional[str]
|
|
691
|
+
|
|
692
|
+
app_id : typing.Optional[str]
|
|
693
|
+
|
|
694
|
+
environment : typing.Optional[str]
|
|
695
|
+
|
|
696
|
+
variant : typing.Optional[str]
|
|
697
|
+
|
|
698
|
+
request_options : typing.Optional[RequestOptions]
|
|
699
|
+
Request-specific configuration.
|
|
700
|
+
|
|
701
|
+
Returns
|
|
702
|
+
-------
|
|
703
|
+
QueryAnalyticsResponse
|
|
704
|
+
Successful Response
|
|
705
|
+
|
|
706
|
+
Examples
|
|
707
|
+
--------
|
|
708
|
+
import asyncio
|
|
709
|
+
|
|
710
|
+
from agenta import AsyncAgentaApi
|
|
711
|
+
|
|
712
|
+
client = AsyncAgentaApi(
|
|
713
|
+
api_key="YOUR_API_KEY",
|
|
714
|
+
base_url="https://yourhost.com/path/to/api",
|
|
715
|
+
)
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
async def main() -> None:
|
|
719
|
+
await client.observability_v_1.query_analytics()
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
asyncio.run(main())
|
|
723
|
+
"""
|
|
724
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
725
|
+
"observability/v1/analytics",
|
|
726
|
+
method="GET",
|
|
727
|
+
params={
|
|
728
|
+
"format": format,
|
|
729
|
+
"focus": focus,
|
|
730
|
+
"oldest": oldest,
|
|
731
|
+
"newest": newest,
|
|
732
|
+
"window": window,
|
|
733
|
+
"filtering": filtering,
|
|
734
|
+
"timeRange": time_range,
|
|
735
|
+
"app_id": app_id,
|
|
736
|
+
"environment": environment,
|
|
737
|
+
"variant": variant,
|
|
738
|
+
},
|
|
739
|
+
request_options=request_options,
|
|
740
|
+
)
|
|
741
|
+
try:
|
|
742
|
+
if 200 <= _response.status_code < 300:
|
|
743
|
+
return typing.cast(
|
|
744
|
+
QueryAnalyticsResponse,
|
|
745
|
+
parse_obj_as(
|
|
746
|
+
type_=QueryAnalyticsResponse, # type: ignore
|
|
747
|
+
object_=_response.json(),
|
|
748
|
+
),
|
|
749
|
+
)
|
|
750
|
+
if _response.status_code == 422:
|
|
751
|
+
raise UnprocessableEntityError(
|
|
752
|
+
typing.cast(
|
|
753
|
+
HttpValidationError,
|
|
754
|
+
parse_obj_as(
|
|
755
|
+
type_=HttpValidationError, # type: ignore
|
|
756
|
+
object_=_response.json(),
|
|
757
|
+
),
|
|
758
|
+
)
|
|
759
|
+
)
|
|
760
|
+
_response_json = _response.json()
|
|
761
|
+
except JSONDecodeError:
|
|
762
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
763
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from .format import Format
|
|
4
|
+
from .query_analytics_response import QueryAnalyticsResponse
|
|
4
5
|
from .query_traces_response import QueryTracesResponse
|
|
5
6
|
|
|
6
|
-
__all__ = ["Format", "QueryTracesResponse"]
|
|
7
|
+
__all__ = ["Format", "QueryAnalyticsResponse", "QueryTracesResponse"]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ...types.legacy_analytics_response import LegacyAnalyticsResponse
|
|
5
|
+
from ...types.analytics_response import AnalyticsResponse
|
|
6
|
+
|
|
7
|
+
QueryAnalyticsResponse = typing.Union[LegacyAnalyticsResponse, AnalyticsResponse]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
4
|
+
import typing
|
|
5
|
+
from ..core.request_options import RequestOptions
|
|
6
|
+
from ..types.projects_response import ProjectsResponse
|
|
7
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ..core.api_error import ApiError
|
|
10
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ScopesClient:
|
|
14
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
15
|
+
self._client_wrapper = client_wrapper
|
|
16
|
+
|
|
17
|
+
def get_projects(
|
|
18
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
19
|
+
) -> typing.List[ProjectsResponse]:
|
|
20
|
+
"""
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
request_options : typing.Optional[RequestOptions]
|
|
24
|
+
Request-specific configuration.
|
|
25
|
+
|
|
26
|
+
Returns
|
|
27
|
+
-------
|
|
28
|
+
typing.List[ProjectsResponse]
|
|
29
|
+
Successful Response
|
|
30
|
+
|
|
31
|
+
Examples
|
|
32
|
+
--------
|
|
33
|
+
from agenta import AgentaApi
|
|
34
|
+
|
|
35
|
+
client = AgentaApi(
|
|
36
|
+
api_key="YOUR_API_KEY",
|
|
37
|
+
base_url="https://yourhost.com/path/to/api",
|
|
38
|
+
)
|
|
39
|
+
client.scopes.get_projects()
|
|
40
|
+
"""
|
|
41
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
42
|
+
"projects",
|
|
43
|
+
method="GET",
|
|
44
|
+
request_options=request_options,
|
|
45
|
+
)
|
|
46
|
+
try:
|
|
47
|
+
if 200 <= _response.status_code < 300:
|
|
48
|
+
return typing.cast(
|
|
49
|
+
typing.List[ProjectsResponse],
|
|
50
|
+
parse_obj_as(
|
|
51
|
+
type_=typing.List[ProjectsResponse], # type: ignore
|
|
52
|
+
object_=_response.json(),
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
_response_json = _response.json()
|
|
56
|
+
except JSONDecodeError:
|
|
57
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
58
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class AsyncScopesClient:
|
|
62
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
63
|
+
self._client_wrapper = client_wrapper
|
|
64
|
+
|
|
65
|
+
async def get_projects(
|
|
66
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
67
|
+
) -> typing.List[ProjectsResponse]:
|
|
68
|
+
"""
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
request_options : typing.Optional[RequestOptions]
|
|
72
|
+
Request-specific configuration.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
typing.List[ProjectsResponse]
|
|
77
|
+
Successful Response
|
|
78
|
+
|
|
79
|
+
Examples
|
|
80
|
+
--------
|
|
81
|
+
import asyncio
|
|
82
|
+
|
|
83
|
+
from agenta import AsyncAgentaApi
|
|
84
|
+
|
|
85
|
+
client = AsyncAgentaApi(
|
|
86
|
+
api_key="YOUR_API_KEY",
|
|
87
|
+
base_url="https://yourhost.com/path/to/api",
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
async def main() -> None:
|
|
92
|
+
await client.scopes.get_projects()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
asyncio.run(main())
|
|
96
|
+
"""
|
|
97
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
98
|
+
"projects",
|
|
99
|
+
method="GET",
|
|
100
|
+
request_options=request_options,
|
|
101
|
+
)
|
|
102
|
+
try:
|
|
103
|
+
if 200 <= _response.status_code < 300:
|
|
104
|
+
return typing.cast(
|
|
105
|
+
typing.List[ProjectsResponse],
|
|
106
|
+
parse_obj_as(
|
|
107
|
+
type_=typing.List[ProjectsResponse], # type: ignore
|
|
108
|
+
object_=_response.json(),
|
|
109
|
+
),
|
|
110
|
+
)
|
|
111
|
+
_response_json = _response.json()
|
|
112
|
+
except JSONDecodeError:
|
|
113
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
114
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|