agenta 0.32.0a2__py3-none-any.whl → 0.33.0a3__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.

Files changed (63) hide show
  1. agenta/__init__.py +2 -0
  2. agenta/client/backend/__init__.py +35 -23
  3. agenta/client/backend/admin/__init__.py +1 -0
  4. agenta/client/backend/admin/client.py +576 -0
  5. agenta/client/backend/apps/client.py +384 -2
  6. agenta/client/backend/client.py +22 -40
  7. agenta/client/backend/core/http_client.py +3 -3
  8. agenta/client/backend/evaluations/client.py +0 -6
  9. agenta/client/backend/human_evaluations/client.py +2 -6
  10. agenta/client/backend/observability/__init__.py +4 -0
  11. agenta/client/backend/observability/client.py +221 -744
  12. agenta/client/backend/testsets/client.py +16 -180
  13. agenta/client/backend/types/__init__.py +32 -22
  14. agenta/client/backend/types/account_response.py +24 -0
  15. agenta/client/backend/types/app_variant_revision.py +2 -1
  16. agenta/client/backend/types/{create_trace_response.py → legacy_scope_request.py} +3 -4
  17. agenta/client/backend/types/legacy_scopes_response.py +29 -0
  18. agenta/client/backend/types/{span_variant.py → legacy_user_request.py} +4 -5
  19. agenta/client/backend/types/{llm_tokens.py → legacy_user_response.py} +2 -4
  20. agenta/client/backend/types/{with_pagination.py → organization_membership_request.py} +6 -7
  21. agenta/client/backend/types/organization_request.py +23 -0
  22. agenta/client/backend/types/permission.py +4 -0
  23. agenta/client/backend/types/project_membership_request.py +26 -0
  24. agenta/client/backend/types/project_request.py +26 -0
  25. agenta/client/backend/types/project_scope.py +29 -0
  26. agenta/client/backend/types/provider_kind.py +1 -1
  27. agenta/client/backend/types/reference.py +22 -0
  28. agenta/client/backend/types/role.py +15 -0
  29. agenta/client/backend/types/scopes_response_model.py +22 -0
  30. agenta/client/backend/types/score.py +1 -1
  31. agenta/client/backend/types/secret_response_dto.py +2 -2
  32. agenta/client/backend/types/user_request.py +22 -0
  33. agenta/client/backend/types/workspace_membership_request.py +26 -0
  34. agenta/client/backend/types/workspace_request.py +25 -0
  35. agenta/client/backend/variants/client.py +166 -12
  36. agenta/client/backend/vault/client.py +11 -9
  37. agenta/sdk/__init__.py +3 -0
  38. agenta/sdk/agenta_init.py +3 -1
  39. agenta/sdk/decorators/routing.py +97 -13
  40. agenta/sdk/managers/apps.py +64 -0
  41. agenta/sdk/managers/shared.py +2 -2
  42. agenta/sdk/middleware/auth.py +156 -57
  43. agenta/sdk/middleware/config.py +18 -14
  44. agenta/sdk/middleware/inline.py +1 -1
  45. agenta/sdk/middleware/mock.py +1 -1
  46. agenta/sdk/middleware/otel.py +1 -1
  47. agenta/sdk/middleware/vault.py +1 -1
  48. {agenta-0.32.0a2.dist-info → agenta-0.33.0a3.dist-info}/METADATA +19 -14
  49. {agenta-0.32.0a2.dist-info → agenta-0.33.0a3.dist-info}/RECORD +55 -48
  50. agenta/client/backend/observability_v_1/__init__.py +0 -5
  51. agenta/client/backend/observability_v_1/client.py +0 -763
  52. agenta/client/backend/types/create_span.py +0 -45
  53. agenta/client/backend/types/outputs.py +0 -5
  54. agenta/client/backend/types/span.py +0 -42
  55. agenta/client/backend/types/span_detail.py +0 -44
  56. agenta/client/backend/types/span_status_code.py +0 -5
  57. agenta/client/backend/types/trace_detail.py +0 -44
  58. /agenta/client/backend/{observability_v_1 → observability}/types/__init__.py +0 -0
  59. /agenta/client/backend/{observability_v_1 → observability}/types/format.py +0 -0
  60. /agenta/client/backend/{observability_v_1 → observability}/types/query_analytics_response.py +0 -0
  61. /agenta/client/backend/{observability_v_1 → observability}/types/query_traces_response.py +0 -0
  62. {agenta-0.32.0a2.dist-info → agenta-0.33.0a3.dist-info}/WHEEL +0 -0
  63. {agenta-0.32.0a2.dist-info → agenta-0.33.0a3.dist-info}/entry_points.txt +0 -0
@@ -1,763 +0,0 @@
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.collect_status_response import CollectStatusResponse
7
- from ..core.pydantic_utilities import parse_obj_as
8
- from json.decoder import JSONDecodeError
9
- from ..core.api_error import ApiError
10
- from .types.format import Format
11
- from .types.query_traces_response import QueryTracesResponse
12
- from ..errors.unprocessable_entity_error import UnprocessableEntityError
13
- from ..types.http_validation_error import HttpValidationError
14
- from .types.query_analytics_response import QueryAnalyticsResponse
15
- from ..core.client_wrapper import AsyncClientWrapper
16
-
17
-
18
- class ObservabilityV1Client:
19
- def __init__(self, *, client_wrapper: SyncClientWrapper):
20
- self._client_wrapper = client_wrapper
21
-
22
- def otlp_status(
23
- self, *, request_options: typing.Optional[RequestOptions] = None
24
- ) -> CollectStatusResponse:
25
- """
26
- Status of OTLP endpoint.
27
-
28
- Parameters
29
- ----------
30
- request_options : typing.Optional[RequestOptions]
31
- Request-specific configuration.
32
-
33
- Returns
34
- -------
35
- CollectStatusResponse
36
- Successful Response
37
-
38
- Examples
39
- --------
40
- from agenta import AgentaApi
41
-
42
- client = AgentaApi(
43
- api_key="YOUR_API_KEY",
44
- base_url="https://yourhost.com/path/to/api",
45
- )
46
- client.observability_v_1.otlp_status()
47
- """
48
- _response = self._client_wrapper.httpx_client.request(
49
- "observability/v1/otlp/traces",
50
- method="GET",
51
- request_options=request_options,
52
- )
53
- try:
54
- if 200 <= _response.status_code < 300:
55
- return typing.cast(
56
- CollectStatusResponse,
57
- parse_obj_as(
58
- type_=CollectStatusResponse, # type: ignore
59
- object_=_response.json(),
60
- ),
61
- )
62
- _response_json = _response.json()
63
- except JSONDecodeError:
64
- raise ApiError(status_code=_response.status_code, body=_response.text)
65
- raise ApiError(status_code=_response.status_code, body=_response_json)
66
-
67
- def otlp_receiver(
68
- self, *, request_options: typing.Optional[RequestOptions] = None
69
- ) -> CollectStatusResponse:
70
- """
71
- Receive traces via OTLP.
72
-
73
- Parameters
74
- ----------
75
- request_options : typing.Optional[RequestOptions]
76
- Request-specific configuration.
77
-
78
- Returns
79
- -------
80
- CollectStatusResponse
81
- Successful Response
82
-
83
- Examples
84
- --------
85
- from agenta import AgentaApi
86
-
87
- client = AgentaApi(
88
- api_key="YOUR_API_KEY",
89
- base_url="https://yourhost.com/path/to/api",
90
- )
91
- client.observability_v_1.otlp_receiver()
92
- """
93
- _response = self._client_wrapper.httpx_client.request(
94
- "observability/v1/otlp/traces",
95
- method="POST",
96
- request_options=request_options,
97
- )
98
- try:
99
- if 200 <= _response.status_code < 300:
100
- return typing.cast(
101
- CollectStatusResponse,
102
- parse_obj_as(
103
- type_=CollectStatusResponse, # type: ignore
104
- object_=_response.json(),
105
- ),
106
- )
107
- _response_json = _response.json()
108
- except JSONDecodeError:
109
- raise ApiError(status_code=_response.status_code, body=_response.text)
110
- raise ApiError(status_code=_response.status_code, body=_response_json)
111
-
112
- def query_traces(
113
- self,
114
- *,
115
- format: typing.Optional[Format] = None,
116
- focus: typing.Optional[str] = None,
117
- oldest: typing.Optional[str] = None,
118
- newest: typing.Optional[str] = None,
119
- filtering: typing.Optional[str] = None,
120
- page: typing.Optional[int] = None,
121
- size: typing.Optional[int] = None,
122
- next: typing.Optional[str] = None,
123
- stop: typing.Optional[str] = None,
124
- request_options: typing.Optional[RequestOptions] = None,
125
- ) -> QueryTracesResponse:
126
- """
127
- Query traces, with optional grouping, windowing, filtering, and pagination.
128
-
129
- Parameters
130
- ----------
131
- format : typing.Optional[Format]
132
-
133
- focus : typing.Optional[str]
134
-
135
- oldest : typing.Optional[str]
136
-
137
- newest : typing.Optional[str]
138
-
139
- filtering : typing.Optional[str]
140
-
141
- page : typing.Optional[int]
142
-
143
- size : typing.Optional[int]
144
-
145
- next : typing.Optional[str]
146
-
147
- stop : typing.Optional[str]
148
-
149
- request_options : typing.Optional[RequestOptions]
150
- Request-specific configuration.
151
-
152
- Returns
153
- -------
154
- QueryTracesResponse
155
- Successful Response
156
-
157
- Examples
158
- --------
159
- from agenta import AgentaApi
160
-
161
- client = AgentaApi(
162
- api_key="YOUR_API_KEY",
163
- base_url="https://yourhost.com/path/to/api",
164
- )
165
- client.observability_v_1.query_traces()
166
- """
167
- _response = self._client_wrapper.httpx_client.request(
168
- "observability/v1/traces",
169
- method="GET",
170
- params={
171
- "format": format,
172
- "focus": focus,
173
- "oldest": oldest,
174
- "newest": newest,
175
- "filtering": filtering,
176
- "page": page,
177
- "size": size,
178
- "next": next,
179
- "stop": stop,
180
- },
181
- request_options=request_options,
182
- )
183
- try:
184
- if 200 <= _response.status_code < 300:
185
- return typing.cast(
186
- QueryTracesResponse,
187
- parse_obj_as(
188
- type_=QueryTracesResponse, # type: ignore
189
- object_=_response.json(),
190
- ),
191
- )
192
- if _response.status_code == 422:
193
- raise UnprocessableEntityError(
194
- typing.cast(
195
- HttpValidationError,
196
- parse_obj_as(
197
- type_=HttpValidationError, # type: ignore
198
- object_=_response.json(),
199
- ),
200
- )
201
- )
202
- _response_json = _response.json()
203
- except JSONDecodeError:
204
- raise ApiError(status_code=_response.status_code, body=_response.text)
205
- raise ApiError(status_code=_response.status_code, body=_response_json)
206
-
207
- def delete_traces(
208
- self,
209
- *,
210
- node_id: typing.Optional[str] = None,
211
- node_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
212
- request_options: typing.Optional[RequestOptions] = None,
213
- ) -> CollectStatusResponse:
214
- """
215
- Delete trace.
216
-
217
- Parameters
218
- ----------
219
- node_id : typing.Optional[str]
220
-
221
- node_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
222
-
223
- request_options : typing.Optional[RequestOptions]
224
- Request-specific configuration.
225
-
226
- Returns
227
- -------
228
- CollectStatusResponse
229
- Successful Response
230
-
231
- Examples
232
- --------
233
- from agenta import AgentaApi
234
-
235
- client = AgentaApi(
236
- api_key="YOUR_API_KEY",
237
- base_url="https://yourhost.com/path/to/api",
238
- )
239
- client.observability_v_1.delete_traces()
240
- """
241
- _response = self._client_wrapper.httpx_client.request(
242
- "observability/v1/traces",
243
- method="DELETE",
244
- params={
245
- "node_id": node_id,
246
- "node_ids": node_ids,
247
- },
248
- request_options=request_options,
249
- )
250
- try:
251
- if 200 <= _response.status_code < 300:
252
- return typing.cast(
253
- CollectStatusResponse,
254
- parse_obj_as(
255
- type_=CollectStatusResponse, # type: ignore
256
- object_=_response.json(),
257
- ),
258
- )
259
- if _response.status_code == 422:
260
- raise UnprocessableEntityError(
261
- typing.cast(
262
- HttpValidationError,
263
- parse_obj_as(
264
- type_=HttpValidationError, # type: ignore
265
- object_=_response.json(),
266
- ),
267
- )
268
- )
269
- _response_json = _response.json()
270
- except JSONDecodeError:
271
- raise ApiError(status_code=_response.status_code, body=_response.text)
272
- raise ApiError(status_code=_response.status_code, body=_response_json)
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
-
371
-
372
- class AsyncObservabilityV1Client:
373
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
374
- self._client_wrapper = client_wrapper
375
-
376
- async def otlp_status(
377
- self, *, request_options: typing.Optional[RequestOptions] = None
378
- ) -> CollectStatusResponse:
379
- """
380
- Status of OTLP endpoint.
381
-
382
- Parameters
383
- ----------
384
- request_options : typing.Optional[RequestOptions]
385
- Request-specific configuration.
386
-
387
- Returns
388
- -------
389
- CollectStatusResponse
390
- Successful Response
391
-
392
- Examples
393
- --------
394
- import asyncio
395
-
396
- from agenta import AsyncAgentaApi
397
-
398
- client = AsyncAgentaApi(
399
- api_key="YOUR_API_KEY",
400
- base_url="https://yourhost.com/path/to/api",
401
- )
402
-
403
-
404
- async def main() -> None:
405
- await client.observability_v_1.otlp_status()
406
-
407
-
408
- asyncio.run(main())
409
- """
410
- _response = await self._client_wrapper.httpx_client.request(
411
- "observability/v1/otlp/traces",
412
- method="GET",
413
- request_options=request_options,
414
- )
415
- try:
416
- if 200 <= _response.status_code < 300:
417
- return typing.cast(
418
- CollectStatusResponse,
419
- parse_obj_as(
420
- type_=CollectStatusResponse, # type: ignore
421
- object_=_response.json(),
422
- ),
423
- )
424
- _response_json = _response.json()
425
- except JSONDecodeError:
426
- raise ApiError(status_code=_response.status_code, body=_response.text)
427
- raise ApiError(status_code=_response.status_code, body=_response_json)
428
-
429
- async def otlp_receiver(
430
- self, *, request_options: typing.Optional[RequestOptions] = None
431
- ) -> CollectStatusResponse:
432
- """
433
- Receive traces via OTLP.
434
-
435
- Parameters
436
- ----------
437
- request_options : typing.Optional[RequestOptions]
438
- Request-specific configuration.
439
-
440
- Returns
441
- -------
442
- CollectStatusResponse
443
- Successful Response
444
-
445
- Examples
446
- --------
447
- import asyncio
448
-
449
- from agenta import AsyncAgentaApi
450
-
451
- client = AsyncAgentaApi(
452
- api_key="YOUR_API_KEY",
453
- base_url="https://yourhost.com/path/to/api",
454
- )
455
-
456
-
457
- async def main() -> None:
458
- await client.observability_v_1.otlp_receiver()
459
-
460
-
461
- asyncio.run(main())
462
- """
463
- _response = await self._client_wrapper.httpx_client.request(
464
- "observability/v1/otlp/traces",
465
- method="POST",
466
- request_options=request_options,
467
- )
468
- try:
469
- if 200 <= _response.status_code < 300:
470
- return typing.cast(
471
- CollectStatusResponse,
472
- parse_obj_as(
473
- type_=CollectStatusResponse, # type: ignore
474
- object_=_response.json(),
475
- ),
476
- )
477
- _response_json = _response.json()
478
- except JSONDecodeError:
479
- raise ApiError(status_code=_response.status_code, body=_response.text)
480
- raise ApiError(status_code=_response.status_code, body=_response_json)
481
-
482
- async def query_traces(
483
- self,
484
- *,
485
- format: typing.Optional[Format] = None,
486
- focus: typing.Optional[str] = None,
487
- oldest: typing.Optional[str] = None,
488
- newest: typing.Optional[str] = None,
489
- filtering: typing.Optional[str] = None,
490
- page: typing.Optional[int] = None,
491
- size: typing.Optional[int] = None,
492
- next: typing.Optional[str] = None,
493
- stop: typing.Optional[str] = None,
494
- request_options: typing.Optional[RequestOptions] = None,
495
- ) -> QueryTracesResponse:
496
- """
497
- Query traces, with optional grouping, windowing, filtering, and pagination.
498
-
499
- Parameters
500
- ----------
501
- format : typing.Optional[Format]
502
-
503
- focus : typing.Optional[str]
504
-
505
- oldest : typing.Optional[str]
506
-
507
- newest : typing.Optional[str]
508
-
509
- filtering : typing.Optional[str]
510
-
511
- page : typing.Optional[int]
512
-
513
- size : typing.Optional[int]
514
-
515
- next : typing.Optional[str]
516
-
517
- stop : typing.Optional[str]
518
-
519
- request_options : typing.Optional[RequestOptions]
520
- Request-specific configuration.
521
-
522
- Returns
523
- -------
524
- QueryTracesResponse
525
- Successful Response
526
-
527
- Examples
528
- --------
529
- import asyncio
530
-
531
- from agenta import AsyncAgentaApi
532
-
533
- client = AsyncAgentaApi(
534
- api_key="YOUR_API_KEY",
535
- base_url="https://yourhost.com/path/to/api",
536
- )
537
-
538
-
539
- async def main() -> None:
540
- await client.observability_v_1.query_traces()
541
-
542
-
543
- asyncio.run(main())
544
- """
545
- _response = await self._client_wrapper.httpx_client.request(
546
- "observability/v1/traces",
547
- method="GET",
548
- params={
549
- "format": format,
550
- "focus": focus,
551
- "oldest": oldest,
552
- "newest": newest,
553
- "filtering": filtering,
554
- "page": page,
555
- "size": size,
556
- "next": next,
557
- "stop": stop,
558
- },
559
- request_options=request_options,
560
- )
561
- try:
562
- if 200 <= _response.status_code < 300:
563
- return typing.cast(
564
- QueryTracesResponse,
565
- parse_obj_as(
566
- type_=QueryTracesResponse, # type: ignore
567
- object_=_response.json(),
568
- ),
569
- )
570
- if _response.status_code == 422:
571
- raise UnprocessableEntityError(
572
- typing.cast(
573
- HttpValidationError,
574
- parse_obj_as(
575
- type_=HttpValidationError, # type: ignore
576
- object_=_response.json(),
577
- ),
578
- )
579
- )
580
- _response_json = _response.json()
581
- except JSONDecodeError:
582
- raise ApiError(status_code=_response.status_code, body=_response.text)
583
- raise ApiError(status_code=_response.status_code, body=_response_json)
584
-
585
- async def delete_traces(
586
- self,
587
- *,
588
- node_id: typing.Optional[str] = None,
589
- node_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
590
- request_options: typing.Optional[RequestOptions] = None,
591
- ) -> CollectStatusResponse:
592
- """
593
- Delete trace.
594
-
595
- Parameters
596
- ----------
597
- node_id : typing.Optional[str]
598
-
599
- node_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
600
-
601
- request_options : typing.Optional[RequestOptions]
602
- Request-specific configuration.
603
-
604
- Returns
605
- -------
606
- CollectStatusResponse
607
- Successful Response
608
-
609
- Examples
610
- --------
611
- import asyncio
612
-
613
- from agenta import AsyncAgentaApi
614
-
615
- client = AsyncAgentaApi(
616
- api_key="YOUR_API_KEY",
617
- base_url="https://yourhost.com/path/to/api",
618
- )
619
-
620
-
621
- async def main() -> None:
622
- await client.observability_v_1.delete_traces()
623
-
624
-
625
- asyncio.run(main())
626
- """
627
- _response = await self._client_wrapper.httpx_client.request(
628
- "observability/v1/traces",
629
- method="DELETE",
630
- params={
631
- "node_id": node_id,
632
- "node_ids": node_ids,
633
- },
634
- request_options=request_options,
635
- )
636
- try:
637
- if 200 <= _response.status_code < 300:
638
- return typing.cast(
639
- CollectStatusResponse,
640
- parse_obj_as(
641
- type_=CollectStatusResponse, # type: ignore
642
- object_=_response.json(),
643
- ),
644
- )
645
- if _response.status_code == 422:
646
- raise UnprocessableEntityError(
647
- typing.cast(
648
- HttpValidationError,
649
- parse_obj_as(
650
- type_=HttpValidationError, # type: ignore
651
- object_=_response.json(),
652
- ),
653
- )
654
- )
655
- _response_json = _response.json()
656
- except JSONDecodeError:
657
- raise ApiError(status_code=_response.status_code, body=_response.text)
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)