agenta 0.32.0a1__py3-none-any.whl → 0.33.0__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.
- agenta/__init__.py +2 -0
- agenta/client/backend/__init__.py +39 -31
- agenta/client/backend/admin/__init__.py +1 -0
- agenta/client/backend/admin/client.py +576 -0
- agenta/client/backend/apps/client.py +450 -68
- agenta/client/backend/bases/client.py +10 -10
- agenta/client/backend/client.py +112 -122
- agenta/client/backend/containers/client.py +70 -28
- agenta/client/backend/core/http_client.py +3 -3
- agenta/client/backend/environments/client.py +8 -8
- agenta/client/backend/evaluations/client.py +46 -52
- agenta/client/backend/evaluators/client.py +32 -32
- agenta/client/backend/human_evaluations/__init__.py +1 -0
- agenta/client/backend/human_evaluations/client.py +1692 -0
- agenta/client/backend/observability/__init__.py +4 -0
- agenta/client/backend/observability/client.py +221 -744
- agenta/client/backend/testsets/client.py +38 -202
- agenta/client/backend/types/__init__.py +34 -28
- agenta/client/backend/types/account_response.py +24 -0
- agenta/client/backend/types/app_variant_revision.py +2 -1
- agenta/client/backend/types/{create_trace_response.py → delete_evaluation.py} +2 -3
- agenta/client/backend/types/{evaluation_scenario_score_update.py → legacy_scope_request.py} +2 -2
- agenta/client/backend/types/legacy_scopes_response.py +29 -0
- agenta/client/backend/types/{human_evaluation_update.py → legacy_user_request.py} +4 -4
- agenta/client/backend/types/{span_variant.py → legacy_user_response.py} +2 -4
- agenta/client/backend/types/organization_membership_request.py +25 -0
- agenta/client/backend/types/organization_request.py +23 -0
- agenta/client/backend/types/permission.py +4 -0
- agenta/client/backend/types/{llm_tokens.py → project_membership_request.py} +8 -5
- agenta/client/backend/types/project_request.py +26 -0
- agenta/client/backend/types/project_scope.py +29 -0
- agenta/client/backend/types/provider_kind.py +1 -1
- agenta/client/backend/types/reference.py +22 -0
- agenta/client/backend/types/role.py +15 -0
- agenta/client/backend/types/scopes_response_model.py +22 -0
- agenta/client/backend/types/score.py +1 -1
- agenta/client/backend/types/secret_response_dto.py +2 -2
- agenta/client/backend/types/user_request.py +22 -0
- agenta/client/backend/types/workspace_membership_request.py +26 -0
- agenta/client/backend/types/workspace_request.py +25 -0
- agenta/client/backend/variants/client.py +208 -42
- agenta/client/backend/vault/client.py +11 -9
- agenta/sdk/__init__.py +3 -0
- agenta/sdk/agenta_init.py +3 -1
- agenta/sdk/assets.py +4 -4
- agenta/sdk/decorators/routing.py +129 -23
- agenta/sdk/decorators/tracing.py +16 -4
- agenta/sdk/litellm/litellm.py +44 -8
- agenta/sdk/litellm/mockllm.py +2 -2
- agenta/sdk/litellm/mocks/__init__.py +9 -3
- agenta/sdk/managers/apps.py +64 -0
- agenta/sdk/managers/shared.py +2 -2
- agenta/sdk/middleware/auth.py +156 -53
- agenta/sdk/middleware/config.py +28 -16
- agenta/sdk/middleware/inline.py +1 -1
- agenta/sdk/middleware/mock.py +1 -1
- agenta/sdk/middleware/otel.py +1 -1
- agenta/sdk/middleware/vault.py +1 -1
- agenta/sdk/tracing/exporters.py +0 -1
- agenta/sdk/tracing/inline.py +26 -30
- agenta/sdk/types.py +12 -9
- {agenta-0.32.0a1.dist-info → agenta-0.33.0.dist-info}/METADATA +23 -20
- {agenta-0.32.0a1.dist-info → agenta-0.33.0.dist-info}/RECORD +69 -63
- agenta/client/backend/observability_v_1/__init__.py +0 -5
- agenta/client/backend/observability_v_1/client.py +0 -763
- agenta/client/backend/types/create_span.py +0 -45
- agenta/client/backend/types/human_evaluation_scenario_update.py +0 -30
- agenta/client/backend/types/new_human_evaluation.py +0 -27
- agenta/client/backend/types/outputs.py +0 -5
- agenta/client/backend/types/span.py +0 -42
- agenta/client/backend/types/span_detail.py +0 -44
- agenta/client/backend/types/span_status_code.py +0 -5
- agenta/client/backend/types/trace_detail.py +0 -44
- agenta/client/backend/types/with_pagination.py +0 -26
- /agenta/client/backend/{observability_v_1 → observability}/types/__init__.py +0 -0
- /agenta/client/backend/{observability_v_1 → observability}/types/format.py +0 -0
- /agenta/client/backend/{observability_v_1 → observability}/types/query_analytics_response.py +0 -0
- /agenta/client/backend/{observability_v_1 → observability}/types/query_traces_response.py +0 -0
- {agenta-0.32.0a1.dist-info → agenta-0.33.0.dist-info}/WHEEL +0 -0
- {agenta-0.32.0a1.dist-info → agenta-0.33.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,56 +1,38 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import typing
|
|
4
3
|
from ..core.client_wrapper import SyncClientWrapper
|
|
4
|
+
import typing
|
|
5
5
|
from ..core.request_options import RequestOptions
|
|
6
|
+
from ..types.collect_status_response import CollectStatusResponse
|
|
6
7
|
from ..core.pydantic_utilities import parse_obj_as
|
|
7
|
-
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
8
|
-
from ..types.http_validation_error import HttpValidationError
|
|
9
8
|
from json.decoder import JSONDecodeError
|
|
10
9
|
from ..core.api_error import ApiError
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from ..
|
|
14
|
-
from ..types.
|
|
15
|
-
from
|
|
16
|
-
from ..core.jsonable_encoder import jsonable_encoder
|
|
17
|
-
from ..types.span_detail import SpanDetail
|
|
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
|
|
18
15
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
19
16
|
|
|
20
|
-
# this is used as the default value for optional parameters
|
|
21
|
-
OMIT = typing.cast(typing.Any, ...)
|
|
22
|
-
|
|
23
17
|
|
|
24
18
|
class ObservabilityClient:
|
|
25
19
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
20
|
self._client_wrapper = client_wrapper
|
|
27
21
|
|
|
28
|
-
def
|
|
29
|
-
self,
|
|
30
|
-
|
|
31
|
-
app_id: str,
|
|
32
|
-
time_range: typing.Optional[str] = None,
|
|
33
|
-
environment: typing.Optional[str] = None,
|
|
34
|
-
variant: typing.Optional[str] = None,
|
|
35
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
-
) -> typing.Optional[typing.Any]:
|
|
22
|
+
def otlp_status(
|
|
23
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
24
|
+
) -> CollectStatusResponse:
|
|
37
25
|
"""
|
|
26
|
+
Status of OTLP endpoint.
|
|
27
|
+
|
|
38
28
|
Parameters
|
|
39
29
|
----------
|
|
40
|
-
app_id : str
|
|
41
|
-
|
|
42
|
-
time_range : typing.Optional[str]
|
|
43
|
-
|
|
44
|
-
environment : typing.Optional[str]
|
|
45
|
-
|
|
46
|
-
variant : typing.Optional[str]
|
|
47
|
-
|
|
48
30
|
request_options : typing.Optional[RequestOptions]
|
|
49
31
|
Request-specific configuration.
|
|
50
32
|
|
|
51
33
|
Returns
|
|
52
34
|
-------
|
|
53
|
-
|
|
35
|
+
CollectStatusResponse
|
|
54
36
|
Successful Response
|
|
55
37
|
|
|
56
38
|
Examples
|
|
@@ -61,175 +43,115 @@ class ObservabilityClient:
|
|
|
61
43
|
api_key="YOUR_API_KEY",
|
|
62
44
|
base_url="https://yourhost.com/path/to/api",
|
|
63
45
|
)
|
|
64
|
-
client.observability.
|
|
65
|
-
app_id="app_id",
|
|
66
|
-
)
|
|
46
|
+
client.observability.otlp_status()
|
|
67
47
|
"""
|
|
68
48
|
_response = self._client_wrapper.httpx_client.request(
|
|
69
|
-
"observability/
|
|
49
|
+
"observability/v1/otlp/traces",
|
|
70
50
|
method="GET",
|
|
71
|
-
params={
|
|
72
|
-
"app_id": app_id,
|
|
73
|
-
"timeRange": time_range,
|
|
74
|
-
"environment": environment,
|
|
75
|
-
"variant": variant,
|
|
76
|
-
},
|
|
77
51
|
request_options=request_options,
|
|
78
52
|
)
|
|
79
53
|
try:
|
|
80
54
|
if 200 <= _response.status_code < 300:
|
|
81
55
|
return typing.cast(
|
|
82
|
-
|
|
56
|
+
CollectStatusResponse,
|
|
83
57
|
parse_obj_as(
|
|
84
|
-
type_=
|
|
58
|
+
type_=CollectStatusResponse, # type: ignore
|
|
85
59
|
object_=_response.json(),
|
|
86
60
|
),
|
|
87
61
|
)
|
|
88
|
-
if _response.status_code == 422:
|
|
89
|
-
raise UnprocessableEntityError(
|
|
90
|
-
typing.cast(
|
|
91
|
-
HttpValidationError,
|
|
92
|
-
parse_obj_as(
|
|
93
|
-
type_=HttpValidationError, # type: ignore
|
|
94
|
-
object_=_response.json(),
|
|
95
|
-
),
|
|
96
|
-
)
|
|
97
|
-
)
|
|
98
62
|
_response_json = _response.json()
|
|
99
63
|
except JSONDecodeError:
|
|
100
64
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
101
65
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
102
66
|
|
|
103
|
-
def
|
|
104
|
-
self,
|
|
105
|
-
|
|
106
|
-
trace: str,
|
|
107
|
-
spans: typing.Sequence[CreateSpan],
|
|
108
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
109
|
-
) -> CreateTraceResponse:
|
|
67
|
+
def otlp_receiver(
|
|
68
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
69
|
+
) -> CollectStatusResponse:
|
|
110
70
|
"""
|
|
71
|
+
Receive traces via OTLP.
|
|
72
|
+
|
|
111
73
|
Parameters
|
|
112
74
|
----------
|
|
113
|
-
trace : str
|
|
114
|
-
|
|
115
|
-
spans : typing.Sequence[CreateSpan]
|
|
116
|
-
|
|
117
75
|
request_options : typing.Optional[RequestOptions]
|
|
118
76
|
Request-specific configuration.
|
|
119
77
|
|
|
120
78
|
Returns
|
|
121
79
|
-------
|
|
122
|
-
|
|
80
|
+
CollectStatusResponse
|
|
123
81
|
Successful Response
|
|
124
82
|
|
|
125
83
|
Examples
|
|
126
84
|
--------
|
|
127
|
-
import
|
|
128
|
-
|
|
129
|
-
from agenta import AgentaApi, CreateSpan
|
|
85
|
+
from agenta import AgentaApi
|
|
130
86
|
|
|
131
87
|
client = AgentaApi(
|
|
132
88
|
api_key="YOUR_API_KEY",
|
|
133
89
|
base_url="https://yourhost.com/path/to/api",
|
|
134
90
|
)
|
|
135
|
-
client.observability.
|
|
136
|
-
trace="trace",
|
|
137
|
-
spans=[
|
|
138
|
-
CreateSpan(
|
|
139
|
-
id="id",
|
|
140
|
-
app_id="app_id",
|
|
141
|
-
name="name",
|
|
142
|
-
spankind="spankind",
|
|
143
|
-
status="status",
|
|
144
|
-
start_time=datetime.datetime.fromisoformat(
|
|
145
|
-
"2024-01-15 09:30:00+00:00",
|
|
146
|
-
),
|
|
147
|
-
end_time=datetime.datetime.fromisoformat(
|
|
148
|
-
"2024-01-15 09:30:00+00:00",
|
|
149
|
-
),
|
|
150
|
-
)
|
|
151
|
-
],
|
|
152
|
-
)
|
|
91
|
+
client.observability.otlp_receiver()
|
|
153
92
|
"""
|
|
154
93
|
_response = self._client_wrapper.httpx_client.request(
|
|
155
|
-
"observability/
|
|
94
|
+
"observability/v1/otlp/traces",
|
|
156
95
|
method="POST",
|
|
157
|
-
json={
|
|
158
|
-
"trace": trace,
|
|
159
|
-
"spans": convert_and_respect_annotation_metadata(
|
|
160
|
-
object_=spans,
|
|
161
|
-
annotation=typing.Sequence[CreateSpan],
|
|
162
|
-
direction="write",
|
|
163
|
-
),
|
|
164
|
-
},
|
|
165
|
-
headers={
|
|
166
|
-
"content-type": "application/json",
|
|
167
|
-
},
|
|
168
96
|
request_options=request_options,
|
|
169
|
-
omit=OMIT,
|
|
170
97
|
)
|
|
171
98
|
try:
|
|
172
99
|
if 200 <= _response.status_code < 300:
|
|
173
100
|
return typing.cast(
|
|
174
|
-
|
|
101
|
+
CollectStatusResponse,
|
|
175
102
|
parse_obj_as(
|
|
176
|
-
type_=
|
|
103
|
+
type_=CollectStatusResponse, # type: ignore
|
|
177
104
|
object_=_response.json(),
|
|
178
105
|
),
|
|
179
106
|
)
|
|
180
|
-
if _response.status_code == 422:
|
|
181
|
-
raise UnprocessableEntityError(
|
|
182
|
-
typing.cast(
|
|
183
|
-
HttpValidationError,
|
|
184
|
-
parse_obj_as(
|
|
185
|
-
type_=HttpValidationError, # type: ignore
|
|
186
|
-
object_=_response.json(),
|
|
187
|
-
),
|
|
188
|
-
)
|
|
189
|
-
)
|
|
190
107
|
_response_json = _response.json()
|
|
191
108
|
except JSONDecodeError:
|
|
192
109
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
193
110
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
194
111
|
|
|
195
|
-
def
|
|
112
|
+
def query_traces(
|
|
196
113
|
self,
|
|
197
114
|
*,
|
|
198
|
-
|
|
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,
|
|
199
120
|
page: typing.Optional[int] = None,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
environment: typing.Optional[str] = None,
|
|
204
|
-
variant: typing.Optional[str] = None,
|
|
205
|
-
created_at: typing.Optional[str] = None,
|
|
121
|
+
size: typing.Optional[int] = None,
|
|
122
|
+
next: typing.Optional[str] = None,
|
|
123
|
+
stop: typing.Optional[str] = None,
|
|
206
124
|
request_options: typing.Optional[RequestOptions] = None,
|
|
207
|
-
) ->
|
|
125
|
+
) -> QueryTracesResponse:
|
|
208
126
|
"""
|
|
127
|
+
Query traces, with optional grouping, windowing, filtering, and pagination.
|
|
128
|
+
|
|
209
129
|
Parameters
|
|
210
130
|
----------
|
|
211
|
-
|
|
131
|
+
format : typing.Optional[Format]
|
|
212
132
|
|
|
213
|
-
|
|
133
|
+
focus : typing.Optional[str]
|
|
214
134
|
|
|
215
|
-
|
|
135
|
+
oldest : typing.Optional[str]
|
|
216
136
|
|
|
217
|
-
|
|
137
|
+
newest : typing.Optional[str]
|
|
218
138
|
|
|
219
|
-
|
|
139
|
+
filtering : typing.Optional[str]
|
|
220
140
|
|
|
221
|
-
|
|
141
|
+
page : typing.Optional[int]
|
|
222
142
|
|
|
223
|
-
|
|
143
|
+
size : typing.Optional[int]
|
|
224
144
|
|
|
225
|
-
|
|
145
|
+
next : typing.Optional[str]
|
|
146
|
+
|
|
147
|
+
stop : typing.Optional[str]
|
|
226
148
|
|
|
227
149
|
request_options : typing.Optional[RequestOptions]
|
|
228
150
|
Request-specific configuration.
|
|
229
151
|
|
|
230
152
|
Returns
|
|
231
153
|
-------
|
|
232
|
-
|
|
154
|
+
QueryTracesResponse
|
|
233
155
|
Successful Response
|
|
234
156
|
|
|
235
157
|
Examples
|
|
@@ -240,31 +162,30 @@ class ObservabilityClient:
|
|
|
240
162
|
api_key="YOUR_API_KEY",
|
|
241
163
|
base_url="https://yourhost.com/path/to/api",
|
|
242
164
|
)
|
|
243
|
-
client.observability.
|
|
244
|
-
app_id="app_id",
|
|
245
|
-
)
|
|
165
|
+
client.observability.query_traces()
|
|
246
166
|
"""
|
|
247
167
|
_response = self._client_wrapper.httpx_client.request(
|
|
248
|
-
"observability/traces",
|
|
168
|
+
"observability/v1/traces",
|
|
249
169
|
method="GET",
|
|
250
170
|
params={
|
|
251
|
-
"
|
|
171
|
+
"format": format,
|
|
172
|
+
"focus": focus,
|
|
173
|
+
"oldest": oldest,
|
|
174
|
+
"newest": newest,
|
|
175
|
+
"filtering": filtering,
|
|
252
176
|
"page": page,
|
|
253
|
-
"
|
|
254
|
-
"
|
|
255
|
-
"
|
|
256
|
-
"environment": environment,
|
|
257
|
-
"variant": variant,
|
|
258
|
-
"created_at": created_at,
|
|
177
|
+
"size": size,
|
|
178
|
+
"next": next,
|
|
179
|
+
"stop": stop,
|
|
259
180
|
},
|
|
260
181
|
request_options=request_options,
|
|
261
182
|
)
|
|
262
183
|
try:
|
|
263
184
|
if 200 <= _response.status_code < 300:
|
|
264
185
|
return typing.cast(
|
|
265
|
-
|
|
186
|
+
QueryTracesResponse,
|
|
266
187
|
parse_obj_as(
|
|
267
|
-
type_=
|
|
188
|
+
type_=QueryTracesResponse, # type: ignore
|
|
268
189
|
object_=_response.json(),
|
|
269
190
|
),
|
|
270
191
|
)
|
|
@@ -283,82 +204,28 @@ class ObservabilityClient:
|
|
|
283
204
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
284
205
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
285
206
|
|
|
286
|
-
def
|
|
207
|
+
def delete_traces(
|
|
287
208
|
self,
|
|
288
209
|
*,
|
|
289
|
-
|
|
210
|
+
node_id: typing.Optional[str] = None,
|
|
211
|
+
node_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
290
212
|
request_options: typing.Optional[RequestOptions] = None,
|
|
291
|
-
) ->
|
|
213
|
+
) -> CollectStatusResponse:
|
|
292
214
|
"""
|
|
293
|
-
|
|
294
|
-
----------
|
|
295
|
-
request : typing.Sequence[str]
|
|
215
|
+
Delete trace.
|
|
296
216
|
|
|
297
|
-
request_options : typing.Optional[RequestOptions]
|
|
298
|
-
Request-specific configuration.
|
|
299
|
-
|
|
300
|
-
Returns
|
|
301
|
-
-------
|
|
302
|
-
bool
|
|
303
|
-
Successful Response
|
|
304
|
-
|
|
305
|
-
Examples
|
|
306
|
-
--------
|
|
307
|
-
from agenta import AgentaApi
|
|
308
|
-
|
|
309
|
-
client = AgentaApi(
|
|
310
|
-
api_key="YOUR_API_KEY",
|
|
311
|
-
base_url="https://yourhost.com/path/to/api",
|
|
312
|
-
)
|
|
313
|
-
client.observability.delete_traces_legacy(
|
|
314
|
-
request=["string"],
|
|
315
|
-
)
|
|
316
|
-
"""
|
|
317
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
318
|
-
"observability/traces",
|
|
319
|
-
method="DELETE",
|
|
320
|
-
json=request,
|
|
321
|
-
request_options=request_options,
|
|
322
|
-
omit=OMIT,
|
|
323
|
-
)
|
|
324
|
-
try:
|
|
325
|
-
if 200 <= _response.status_code < 300:
|
|
326
|
-
return typing.cast(
|
|
327
|
-
bool,
|
|
328
|
-
parse_obj_as(
|
|
329
|
-
type_=bool, # type: ignore
|
|
330
|
-
object_=_response.json(),
|
|
331
|
-
),
|
|
332
|
-
)
|
|
333
|
-
if _response.status_code == 422:
|
|
334
|
-
raise UnprocessableEntityError(
|
|
335
|
-
typing.cast(
|
|
336
|
-
HttpValidationError,
|
|
337
|
-
parse_obj_as(
|
|
338
|
-
type_=HttpValidationError, # type: ignore
|
|
339
|
-
object_=_response.json(),
|
|
340
|
-
),
|
|
341
|
-
)
|
|
342
|
-
)
|
|
343
|
-
_response_json = _response.json()
|
|
344
|
-
except JSONDecodeError:
|
|
345
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
346
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
347
|
-
|
|
348
|
-
def get_trace_detail(
|
|
349
|
-
self, trace_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
350
|
-
) -> TraceDetail:
|
|
351
|
-
"""
|
|
352
217
|
Parameters
|
|
353
218
|
----------
|
|
354
|
-
|
|
219
|
+
node_id : typing.Optional[str]
|
|
220
|
+
|
|
221
|
+
node_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
355
222
|
|
|
356
223
|
request_options : typing.Optional[RequestOptions]
|
|
357
224
|
Request-specific configuration.
|
|
358
225
|
|
|
359
226
|
Returns
|
|
360
227
|
-------
|
|
361
|
-
|
|
228
|
+
CollectStatusResponse
|
|
362
229
|
Successful Response
|
|
363
230
|
|
|
364
231
|
Examples
|
|
@@ -369,21 +236,23 @@ class ObservabilityClient:
|
|
|
369
236
|
api_key="YOUR_API_KEY",
|
|
370
237
|
base_url="https://yourhost.com/path/to/api",
|
|
371
238
|
)
|
|
372
|
-
client.observability.
|
|
373
|
-
trace_id="trace_id",
|
|
374
|
-
)
|
|
239
|
+
client.observability.delete_traces()
|
|
375
240
|
"""
|
|
376
241
|
_response = self._client_wrapper.httpx_client.request(
|
|
377
|
-
|
|
378
|
-
method="
|
|
242
|
+
"observability/v1/traces",
|
|
243
|
+
method="DELETE",
|
|
244
|
+
params={
|
|
245
|
+
"node_id": node_id,
|
|
246
|
+
"node_ids": node_ids,
|
|
247
|
+
},
|
|
379
248
|
request_options=request_options,
|
|
380
249
|
)
|
|
381
250
|
try:
|
|
382
251
|
if 200 <= _response.status_code < 300:
|
|
383
252
|
return typing.cast(
|
|
384
|
-
|
|
253
|
+
CollectStatusResponse,
|
|
385
254
|
parse_obj_as(
|
|
386
|
-
type_=
|
|
255
|
+
type_=CollectStatusResponse, # type: ignore
|
|
387
256
|
object_=_response.json(),
|
|
388
257
|
),
|
|
389
258
|
)
|
|
@@ -402,44 +271,50 @@ class ObservabilityClient:
|
|
|
402
271
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
403
272
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
404
273
|
|
|
405
|
-
def
|
|
274
|
+
def query_analytics(
|
|
406
275
|
self,
|
|
407
276
|
*,
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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,
|
|
413
285
|
environment: typing.Optional[str] = None,
|
|
414
286
|
variant: typing.Optional[str] = None,
|
|
415
|
-
created_at: typing.Optional[str] = None,
|
|
416
287
|
request_options: typing.Optional[RequestOptions] = None,
|
|
417
|
-
) ->
|
|
288
|
+
) -> QueryAnalyticsResponse:
|
|
418
289
|
"""
|
|
419
290
|
Parameters
|
|
420
291
|
----------
|
|
421
|
-
|
|
292
|
+
format : typing.Optional[Format]
|
|
422
293
|
|
|
423
|
-
|
|
294
|
+
focus : typing.Optional[str]
|
|
295
|
+
|
|
296
|
+
oldest : typing.Optional[str]
|
|
424
297
|
|
|
425
|
-
|
|
298
|
+
newest : typing.Optional[str]
|
|
426
299
|
|
|
427
|
-
|
|
300
|
+
window : typing.Optional[int]
|
|
428
301
|
|
|
429
|
-
|
|
302
|
+
filtering : typing.Optional[str]
|
|
303
|
+
|
|
304
|
+
time_range : typing.Optional[str]
|
|
305
|
+
|
|
306
|
+
app_id : typing.Optional[str]
|
|
430
307
|
|
|
431
308
|
environment : typing.Optional[str]
|
|
432
309
|
|
|
433
310
|
variant : typing.Optional[str]
|
|
434
311
|
|
|
435
|
-
created_at : typing.Optional[str]
|
|
436
|
-
|
|
437
312
|
request_options : typing.Optional[RequestOptions]
|
|
438
313
|
Request-specific configuration.
|
|
439
314
|
|
|
440
315
|
Returns
|
|
441
316
|
-------
|
|
442
|
-
|
|
317
|
+
QueryAnalyticsResponse
|
|
443
318
|
Successful Response
|
|
444
319
|
|
|
445
320
|
Examples
|
|
@@ -450,159 +325,31 @@ class ObservabilityClient:
|
|
|
450
325
|
api_key="YOUR_API_KEY",
|
|
451
326
|
base_url="https://yourhost.com/path/to/api",
|
|
452
327
|
)
|
|
453
|
-
client.observability.
|
|
454
|
-
app_id="app_id",
|
|
455
|
-
)
|
|
328
|
+
client.observability.query_analytics()
|
|
456
329
|
"""
|
|
457
330
|
_response = self._client_wrapper.httpx_client.request(
|
|
458
|
-
"observability/
|
|
331
|
+
"observability/v1/analytics",
|
|
459
332
|
method="GET",
|
|
460
333
|
params={
|
|
334
|
+
"format": format,
|
|
335
|
+
"focus": focus,
|
|
336
|
+
"oldest": oldest,
|
|
337
|
+
"newest": newest,
|
|
338
|
+
"window": window,
|
|
339
|
+
"filtering": filtering,
|
|
340
|
+
"timeRange": time_range,
|
|
461
341
|
"app_id": app_id,
|
|
462
|
-
"page": page,
|
|
463
|
-
"pageSize": page_size,
|
|
464
|
-
"type": type,
|
|
465
|
-
"trace_id": trace_id,
|
|
466
342
|
"environment": environment,
|
|
467
343
|
"variant": variant,
|
|
468
|
-
"created_at": created_at,
|
|
469
|
-
},
|
|
470
|
-
request_options=request_options,
|
|
471
|
-
)
|
|
472
|
-
try:
|
|
473
|
-
if 200 <= _response.status_code < 300:
|
|
474
|
-
return typing.cast(
|
|
475
|
-
typing.Optional[typing.Any],
|
|
476
|
-
parse_obj_as(
|
|
477
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
478
|
-
object_=_response.json(),
|
|
479
|
-
),
|
|
480
|
-
)
|
|
481
|
-
if _response.status_code == 422:
|
|
482
|
-
raise UnprocessableEntityError(
|
|
483
|
-
typing.cast(
|
|
484
|
-
HttpValidationError,
|
|
485
|
-
parse_obj_as(
|
|
486
|
-
type_=HttpValidationError, # type: ignore
|
|
487
|
-
object_=_response.json(),
|
|
488
|
-
),
|
|
489
|
-
)
|
|
490
|
-
)
|
|
491
|
-
_response_json = _response.json()
|
|
492
|
-
except JSONDecodeError:
|
|
493
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
494
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
495
|
-
|
|
496
|
-
def delete_spans_of_trace(
|
|
497
|
-
self,
|
|
498
|
-
*,
|
|
499
|
-
request: typing.Sequence[str],
|
|
500
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
501
|
-
) -> bool:
|
|
502
|
-
"""
|
|
503
|
-
Parameters
|
|
504
|
-
----------
|
|
505
|
-
request : typing.Sequence[str]
|
|
506
|
-
|
|
507
|
-
request_options : typing.Optional[RequestOptions]
|
|
508
|
-
Request-specific configuration.
|
|
509
|
-
|
|
510
|
-
Returns
|
|
511
|
-
-------
|
|
512
|
-
bool
|
|
513
|
-
Successful Response
|
|
514
|
-
|
|
515
|
-
Examples
|
|
516
|
-
--------
|
|
517
|
-
from agenta import AgentaApi
|
|
518
|
-
|
|
519
|
-
client = AgentaApi(
|
|
520
|
-
api_key="YOUR_API_KEY",
|
|
521
|
-
base_url="https://yourhost.com/path/to/api",
|
|
522
|
-
)
|
|
523
|
-
client.observability.delete_spans_of_trace(
|
|
524
|
-
request=["string"],
|
|
525
|
-
)
|
|
526
|
-
"""
|
|
527
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
528
|
-
"observability/spans",
|
|
529
|
-
method="DELETE",
|
|
530
|
-
json=request,
|
|
531
|
-
request_options=request_options,
|
|
532
|
-
omit=OMIT,
|
|
533
|
-
)
|
|
534
|
-
try:
|
|
535
|
-
if 200 <= _response.status_code < 300:
|
|
536
|
-
return typing.cast(
|
|
537
|
-
bool,
|
|
538
|
-
parse_obj_as(
|
|
539
|
-
type_=bool, # type: ignore
|
|
540
|
-
object_=_response.json(),
|
|
541
|
-
),
|
|
542
|
-
)
|
|
543
|
-
if _response.status_code == 422:
|
|
544
|
-
raise UnprocessableEntityError(
|
|
545
|
-
typing.cast(
|
|
546
|
-
HttpValidationError,
|
|
547
|
-
parse_obj_as(
|
|
548
|
-
type_=HttpValidationError, # type: ignore
|
|
549
|
-
object_=_response.json(),
|
|
550
|
-
),
|
|
551
|
-
)
|
|
552
|
-
)
|
|
553
|
-
_response_json = _response.json()
|
|
554
|
-
except JSONDecodeError:
|
|
555
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
556
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
557
|
-
|
|
558
|
-
def get_span_of_generation(
|
|
559
|
-
self,
|
|
560
|
-
span_id: str,
|
|
561
|
-
*,
|
|
562
|
-
type: typing.Optional[str] = None,
|
|
563
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
564
|
-
) -> SpanDetail:
|
|
565
|
-
"""
|
|
566
|
-
Parameters
|
|
567
|
-
----------
|
|
568
|
-
span_id : str
|
|
569
|
-
|
|
570
|
-
type : typing.Optional[str]
|
|
571
|
-
|
|
572
|
-
request_options : typing.Optional[RequestOptions]
|
|
573
|
-
Request-specific configuration.
|
|
574
|
-
|
|
575
|
-
Returns
|
|
576
|
-
-------
|
|
577
|
-
SpanDetail
|
|
578
|
-
Successful Response
|
|
579
|
-
|
|
580
|
-
Examples
|
|
581
|
-
--------
|
|
582
|
-
from agenta import AgentaApi
|
|
583
|
-
|
|
584
|
-
client = AgentaApi(
|
|
585
|
-
api_key="YOUR_API_KEY",
|
|
586
|
-
base_url="https://yourhost.com/path/to/api",
|
|
587
|
-
)
|
|
588
|
-
client.observability.get_span_of_generation(
|
|
589
|
-
span_id="span_id",
|
|
590
|
-
)
|
|
591
|
-
"""
|
|
592
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
593
|
-
f"observability/spans/{jsonable_encoder(span_id)}",
|
|
594
|
-
method="GET",
|
|
595
|
-
params={
|
|
596
|
-
"type": type,
|
|
597
344
|
},
|
|
598
345
|
request_options=request_options,
|
|
599
346
|
)
|
|
600
347
|
try:
|
|
601
348
|
if 200 <= _response.status_code < 300:
|
|
602
349
|
return typing.cast(
|
|
603
|
-
|
|
350
|
+
QueryAnalyticsResponse,
|
|
604
351
|
parse_obj_as(
|
|
605
|
-
type_=
|
|
352
|
+
type_=QueryAnalyticsResponse, # type: ignore
|
|
606
353
|
object_=_response.json(),
|
|
607
354
|
),
|
|
608
355
|
)
|
|
@@ -626,32 +373,20 @@ class AsyncObservabilityClient:
|
|
|
626
373
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
627
374
|
self._client_wrapper = client_wrapper
|
|
628
375
|
|
|
629
|
-
async def
|
|
630
|
-
self,
|
|
631
|
-
|
|
632
|
-
app_id: str,
|
|
633
|
-
time_range: typing.Optional[str] = None,
|
|
634
|
-
environment: typing.Optional[str] = None,
|
|
635
|
-
variant: typing.Optional[str] = None,
|
|
636
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
637
|
-
) -> typing.Optional[typing.Any]:
|
|
376
|
+
async def otlp_status(
|
|
377
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
378
|
+
) -> CollectStatusResponse:
|
|
638
379
|
"""
|
|
380
|
+
Status of OTLP endpoint.
|
|
381
|
+
|
|
639
382
|
Parameters
|
|
640
383
|
----------
|
|
641
|
-
app_id : str
|
|
642
|
-
|
|
643
|
-
time_range : typing.Optional[str]
|
|
644
|
-
|
|
645
|
-
environment : typing.Optional[str]
|
|
646
|
-
|
|
647
|
-
variant : typing.Optional[str]
|
|
648
|
-
|
|
649
384
|
request_options : typing.Optional[RequestOptions]
|
|
650
385
|
Request-specific configuration.
|
|
651
386
|
|
|
652
387
|
Returns
|
|
653
388
|
-------
|
|
654
|
-
|
|
389
|
+
CollectStatusResponse
|
|
655
390
|
Successful Response
|
|
656
391
|
|
|
657
392
|
Examples
|
|
@@ -667,76 +402,51 @@ class AsyncObservabilityClient:
|
|
|
667
402
|
|
|
668
403
|
|
|
669
404
|
async def main() -> None:
|
|
670
|
-
await client.observability.
|
|
671
|
-
app_id="app_id",
|
|
672
|
-
)
|
|
405
|
+
await client.observability.otlp_status()
|
|
673
406
|
|
|
674
407
|
|
|
675
408
|
asyncio.run(main())
|
|
676
409
|
"""
|
|
677
410
|
_response = await self._client_wrapper.httpx_client.request(
|
|
678
|
-
"observability/
|
|
411
|
+
"observability/v1/otlp/traces",
|
|
679
412
|
method="GET",
|
|
680
|
-
params={
|
|
681
|
-
"app_id": app_id,
|
|
682
|
-
"timeRange": time_range,
|
|
683
|
-
"environment": environment,
|
|
684
|
-
"variant": variant,
|
|
685
|
-
},
|
|
686
413
|
request_options=request_options,
|
|
687
414
|
)
|
|
688
415
|
try:
|
|
689
416
|
if 200 <= _response.status_code < 300:
|
|
690
417
|
return typing.cast(
|
|
691
|
-
|
|
418
|
+
CollectStatusResponse,
|
|
692
419
|
parse_obj_as(
|
|
693
|
-
type_=
|
|
420
|
+
type_=CollectStatusResponse, # type: ignore
|
|
694
421
|
object_=_response.json(),
|
|
695
422
|
),
|
|
696
423
|
)
|
|
697
|
-
if _response.status_code == 422:
|
|
698
|
-
raise UnprocessableEntityError(
|
|
699
|
-
typing.cast(
|
|
700
|
-
HttpValidationError,
|
|
701
|
-
parse_obj_as(
|
|
702
|
-
type_=HttpValidationError, # type: ignore
|
|
703
|
-
object_=_response.json(),
|
|
704
|
-
),
|
|
705
|
-
)
|
|
706
|
-
)
|
|
707
424
|
_response_json = _response.json()
|
|
708
425
|
except JSONDecodeError:
|
|
709
426
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
710
427
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
711
428
|
|
|
712
|
-
async def
|
|
713
|
-
self,
|
|
714
|
-
|
|
715
|
-
trace: str,
|
|
716
|
-
spans: typing.Sequence[CreateSpan],
|
|
717
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
718
|
-
) -> CreateTraceResponse:
|
|
429
|
+
async def otlp_receiver(
|
|
430
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
431
|
+
) -> CollectStatusResponse:
|
|
719
432
|
"""
|
|
433
|
+
Receive traces via OTLP.
|
|
434
|
+
|
|
720
435
|
Parameters
|
|
721
436
|
----------
|
|
722
|
-
trace : str
|
|
723
|
-
|
|
724
|
-
spans : typing.Sequence[CreateSpan]
|
|
725
|
-
|
|
726
437
|
request_options : typing.Optional[RequestOptions]
|
|
727
438
|
Request-specific configuration.
|
|
728
439
|
|
|
729
440
|
Returns
|
|
730
441
|
-------
|
|
731
|
-
|
|
442
|
+
CollectStatusResponse
|
|
732
443
|
Successful Response
|
|
733
444
|
|
|
734
445
|
Examples
|
|
735
446
|
--------
|
|
736
447
|
import asyncio
|
|
737
|
-
import datetime
|
|
738
448
|
|
|
739
|
-
from agenta import AsyncAgentaApi
|
|
449
|
+
from agenta import AsyncAgentaApi
|
|
740
450
|
|
|
741
451
|
client = AsyncAgentaApi(
|
|
742
452
|
api_key="YOUR_API_KEY",
|
|
@@ -745,107 +455,73 @@ class AsyncObservabilityClient:
|
|
|
745
455
|
|
|
746
456
|
|
|
747
457
|
async def main() -> None:
|
|
748
|
-
await client.observability.
|
|
749
|
-
trace="trace",
|
|
750
|
-
spans=[
|
|
751
|
-
CreateSpan(
|
|
752
|
-
id="id",
|
|
753
|
-
app_id="app_id",
|
|
754
|
-
name="name",
|
|
755
|
-
spankind="spankind",
|
|
756
|
-
status="status",
|
|
757
|
-
start_time=datetime.datetime.fromisoformat(
|
|
758
|
-
"2024-01-15 09:30:00+00:00",
|
|
759
|
-
),
|
|
760
|
-
end_time=datetime.datetime.fromisoformat(
|
|
761
|
-
"2024-01-15 09:30:00+00:00",
|
|
762
|
-
),
|
|
763
|
-
)
|
|
764
|
-
],
|
|
765
|
-
)
|
|
458
|
+
await client.observability.otlp_receiver()
|
|
766
459
|
|
|
767
460
|
|
|
768
461
|
asyncio.run(main())
|
|
769
462
|
"""
|
|
770
463
|
_response = await self._client_wrapper.httpx_client.request(
|
|
771
|
-
"observability/
|
|
464
|
+
"observability/v1/otlp/traces",
|
|
772
465
|
method="POST",
|
|
773
|
-
json={
|
|
774
|
-
"trace": trace,
|
|
775
|
-
"spans": convert_and_respect_annotation_metadata(
|
|
776
|
-
object_=spans,
|
|
777
|
-
annotation=typing.Sequence[CreateSpan],
|
|
778
|
-
direction="write",
|
|
779
|
-
),
|
|
780
|
-
},
|
|
781
|
-
headers={
|
|
782
|
-
"content-type": "application/json",
|
|
783
|
-
},
|
|
784
466
|
request_options=request_options,
|
|
785
|
-
omit=OMIT,
|
|
786
467
|
)
|
|
787
468
|
try:
|
|
788
469
|
if 200 <= _response.status_code < 300:
|
|
789
470
|
return typing.cast(
|
|
790
|
-
|
|
471
|
+
CollectStatusResponse,
|
|
791
472
|
parse_obj_as(
|
|
792
|
-
type_=
|
|
473
|
+
type_=CollectStatusResponse, # type: ignore
|
|
793
474
|
object_=_response.json(),
|
|
794
475
|
),
|
|
795
476
|
)
|
|
796
|
-
if _response.status_code == 422:
|
|
797
|
-
raise UnprocessableEntityError(
|
|
798
|
-
typing.cast(
|
|
799
|
-
HttpValidationError,
|
|
800
|
-
parse_obj_as(
|
|
801
|
-
type_=HttpValidationError, # type: ignore
|
|
802
|
-
object_=_response.json(),
|
|
803
|
-
),
|
|
804
|
-
)
|
|
805
|
-
)
|
|
806
477
|
_response_json = _response.json()
|
|
807
478
|
except JSONDecodeError:
|
|
808
479
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
809
480
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
810
481
|
|
|
811
|
-
async def
|
|
482
|
+
async def query_traces(
|
|
812
483
|
self,
|
|
813
484
|
*,
|
|
814
|
-
|
|
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,
|
|
815
490
|
page: typing.Optional[int] = None,
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
environment: typing.Optional[str] = None,
|
|
820
|
-
variant: typing.Optional[str] = None,
|
|
821
|
-
created_at: typing.Optional[str] = None,
|
|
491
|
+
size: typing.Optional[int] = None,
|
|
492
|
+
next: typing.Optional[str] = None,
|
|
493
|
+
stop: typing.Optional[str] = None,
|
|
822
494
|
request_options: typing.Optional[RequestOptions] = None,
|
|
823
|
-
) ->
|
|
495
|
+
) -> QueryTracesResponse:
|
|
824
496
|
"""
|
|
497
|
+
Query traces, with optional grouping, windowing, filtering, and pagination.
|
|
498
|
+
|
|
825
499
|
Parameters
|
|
826
500
|
----------
|
|
827
|
-
|
|
501
|
+
format : typing.Optional[Format]
|
|
828
502
|
|
|
829
|
-
|
|
503
|
+
focus : typing.Optional[str]
|
|
830
504
|
|
|
831
|
-
|
|
505
|
+
oldest : typing.Optional[str]
|
|
832
506
|
|
|
833
|
-
|
|
507
|
+
newest : typing.Optional[str]
|
|
834
508
|
|
|
835
|
-
|
|
509
|
+
filtering : typing.Optional[str]
|
|
836
510
|
|
|
837
|
-
|
|
511
|
+
page : typing.Optional[int]
|
|
838
512
|
|
|
839
|
-
|
|
513
|
+
size : typing.Optional[int]
|
|
514
|
+
|
|
515
|
+
next : typing.Optional[str]
|
|
840
516
|
|
|
841
|
-
|
|
517
|
+
stop : typing.Optional[str]
|
|
842
518
|
|
|
843
519
|
request_options : typing.Optional[RequestOptions]
|
|
844
520
|
Request-specific configuration.
|
|
845
521
|
|
|
846
522
|
Returns
|
|
847
523
|
-------
|
|
848
|
-
|
|
524
|
+
QueryTracesResponse
|
|
849
525
|
Successful Response
|
|
850
526
|
|
|
851
527
|
Examples
|
|
@@ -861,34 +537,33 @@ class AsyncObservabilityClient:
|
|
|
861
537
|
|
|
862
538
|
|
|
863
539
|
async def main() -> None:
|
|
864
|
-
await client.observability.
|
|
865
|
-
app_id="app_id",
|
|
866
|
-
)
|
|
540
|
+
await client.observability.query_traces()
|
|
867
541
|
|
|
868
542
|
|
|
869
543
|
asyncio.run(main())
|
|
870
544
|
"""
|
|
871
545
|
_response = await self._client_wrapper.httpx_client.request(
|
|
872
|
-
"observability/traces",
|
|
546
|
+
"observability/v1/traces",
|
|
873
547
|
method="GET",
|
|
874
548
|
params={
|
|
875
|
-
"
|
|
549
|
+
"format": format,
|
|
550
|
+
"focus": focus,
|
|
551
|
+
"oldest": oldest,
|
|
552
|
+
"newest": newest,
|
|
553
|
+
"filtering": filtering,
|
|
876
554
|
"page": page,
|
|
877
|
-
"
|
|
878
|
-
"
|
|
879
|
-
"
|
|
880
|
-
"environment": environment,
|
|
881
|
-
"variant": variant,
|
|
882
|
-
"created_at": created_at,
|
|
555
|
+
"size": size,
|
|
556
|
+
"next": next,
|
|
557
|
+
"stop": stop,
|
|
883
558
|
},
|
|
884
559
|
request_options=request_options,
|
|
885
560
|
)
|
|
886
561
|
try:
|
|
887
562
|
if 200 <= _response.status_code < 300:
|
|
888
563
|
return typing.cast(
|
|
889
|
-
|
|
564
|
+
QueryTracesResponse,
|
|
890
565
|
parse_obj_as(
|
|
891
|
-
type_=
|
|
566
|
+
type_=QueryTracesResponse, # type: ignore
|
|
892
567
|
object_=_response.json(),
|
|
893
568
|
),
|
|
894
569
|
)
|
|
@@ -907,90 +582,28 @@ class AsyncObservabilityClient:
|
|
|
907
582
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
908
583
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
909
584
|
|
|
910
|
-
async def
|
|
585
|
+
async def delete_traces(
|
|
911
586
|
self,
|
|
912
587
|
*,
|
|
913
|
-
|
|
588
|
+
node_id: typing.Optional[str] = None,
|
|
589
|
+
node_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
914
590
|
request_options: typing.Optional[RequestOptions] = None,
|
|
915
|
-
) ->
|
|
916
|
-
"""
|
|
917
|
-
Parameters
|
|
918
|
-
----------
|
|
919
|
-
request : typing.Sequence[str]
|
|
920
|
-
|
|
921
|
-
request_options : typing.Optional[RequestOptions]
|
|
922
|
-
Request-specific configuration.
|
|
923
|
-
|
|
924
|
-
Returns
|
|
925
|
-
-------
|
|
926
|
-
bool
|
|
927
|
-
Successful Response
|
|
928
|
-
|
|
929
|
-
Examples
|
|
930
|
-
--------
|
|
931
|
-
import asyncio
|
|
932
|
-
|
|
933
|
-
from agenta import AsyncAgentaApi
|
|
934
|
-
|
|
935
|
-
client = AsyncAgentaApi(
|
|
936
|
-
api_key="YOUR_API_KEY",
|
|
937
|
-
base_url="https://yourhost.com/path/to/api",
|
|
938
|
-
)
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
async def main() -> None:
|
|
942
|
-
await client.observability.delete_traces_legacy(
|
|
943
|
-
request=["string"],
|
|
944
|
-
)
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
asyncio.run(main())
|
|
591
|
+
) -> CollectStatusResponse:
|
|
948
592
|
"""
|
|
949
|
-
|
|
950
|
-
"observability/traces",
|
|
951
|
-
method="DELETE",
|
|
952
|
-
json=request,
|
|
953
|
-
request_options=request_options,
|
|
954
|
-
omit=OMIT,
|
|
955
|
-
)
|
|
956
|
-
try:
|
|
957
|
-
if 200 <= _response.status_code < 300:
|
|
958
|
-
return typing.cast(
|
|
959
|
-
bool,
|
|
960
|
-
parse_obj_as(
|
|
961
|
-
type_=bool, # type: ignore
|
|
962
|
-
object_=_response.json(),
|
|
963
|
-
),
|
|
964
|
-
)
|
|
965
|
-
if _response.status_code == 422:
|
|
966
|
-
raise UnprocessableEntityError(
|
|
967
|
-
typing.cast(
|
|
968
|
-
HttpValidationError,
|
|
969
|
-
parse_obj_as(
|
|
970
|
-
type_=HttpValidationError, # type: ignore
|
|
971
|
-
object_=_response.json(),
|
|
972
|
-
),
|
|
973
|
-
)
|
|
974
|
-
)
|
|
975
|
-
_response_json = _response.json()
|
|
976
|
-
except JSONDecodeError:
|
|
977
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
978
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
593
|
+
Delete trace.
|
|
979
594
|
|
|
980
|
-
async def get_trace_detail(
|
|
981
|
-
self, trace_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
982
|
-
) -> TraceDetail:
|
|
983
|
-
"""
|
|
984
595
|
Parameters
|
|
985
596
|
----------
|
|
986
|
-
|
|
597
|
+
node_id : typing.Optional[str]
|
|
598
|
+
|
|
599
|
+
node_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
987
600
|
|
|
988
601
|
request_options : typing.Optional[RequestOptions]
|
|
989
602
|
Request-specific configuration.
|
|
990
603
|
|
|
991
604
|
Returns
|
|
992
605
|
-------
|
|
993
|
-
|
|
606
|
+
CollectStatusResponse
|
|
994
607
|
Successful Response
|
|
995
608
|
|
|
996
609
|
Examples
|
|
@@ -1006,24 +619,26 @@ class AsyncObservabilityClient:
|
|
|
1006
619
|
|
|
1007
620
|
|
|
1008
621
|
async def main() -> None:
|
|
1009
|
-
await client.observability.
|
|
1010
|
-
trace_id="trace_id",
|
|
1011
|
-
)
|
|
622
|
+
await client.observability.delete_traces()
|
|
1012
623
|
|
|
1013
624
|
|
|
1014
625
|
asyncio.run(main())
|
|
1015
626
|
"""
|
|
1016
627
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1017
|
-
|
|
1018
|
-
method="
|
|
628
|
+
"observability/v1/traces",
|
|
629
|
+
method="DELETE",
|
|
630
|
+
params={
|
|
631
|
+
"node_id": node_id,
|
|
632
|
+
"node_ids": node_ids,
|
|
633
|
+
},
|
|
1019
634
|
request_options=request_options,
|
|
1020
635
|
)
|
|
1021
636
|
try:
|
|
1022
637
|
if 200 <= _response.status_code < 300:
|
|
1023
638
|
return typing.cast(
|
|
1024
|
-
|
|
639
|
+
CollectStatusResponse,
|
|
1025
640
|
parse_obj_as(
|
|
1026
|
-
type_=
|
|
641
|
+
type_=CollectStatusResponse, # type: ignore
|
|
1027
642
|
object_=_response.json(),
|
|
1028
643
|
),
|
|
1029
644
|
)
|
|
@@ -1042,44 +657,50 @@ class AsyncObservabilityClient:
|
|
|
1042
657
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1043
658
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1044
659
|
|
|
1045
|
-
async def
|
|
660
|
+
async def query_analytics(
|
|
1046
661
|
self,
|
|
1047
662
|
*,
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
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,
|
|
1053
671
|
environment: typing.Optional[str] = None,
|
|
1054
672
|
variant: typing.Optional[str] = None,
|
|
1055
|
-
created_at: typing.Optional[str] = None,
|
|
1056
673
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1057
|
-
) ->
|
|
674
|
+
) -> QueryAnalyticsResponse:
|
|
1058
675
|
"""
|
|
1059
676
|
Parameters
|
|
1060
677
|
----------
|
|
1061
|
-
|
|
678
|
+
format : typing.Optional[Format]
|
|
1062
679
|
|
|
1063
|
-
|
|
680
|
+
focus : typing.Optional[str]
|
|
681
|
+
|
|
682
|
+
oldest : typing.Optional[str]
|
|
683
|
+
|
|
684
|
+
newest : typing.Optional[str]
|
|
1064
685
|
|
|
1065
|
-
|
|
686
|
+
window : typing.Optional[int]
|
|
1066
687
|
|
|
1067
|
-
|
|
688
|
+
filtering : typing.Optional[str]
|
|
1068
689
|
|
|
1069
|
-
|
|
690
|
+
time_range : typing.Optional[str]
|
|
691
|
+
|
|
692
|
+
app_id : typing.Optional[str]
|
|
1070
693
|
|
|
1071
694
|
environment : typing.Optional[str]
|
|
1072
695
|
|
|
1073
696
|
variant : typing.Optional[str]
|
|
1074
697
|
|
|
1075
|
-
created_at : typing.Optional[str]
|
|
1076
|
-
|
|
1077
698
|
request_options : typing.Optional[RequestOptions]
|
|
1078
699
|
Request-specific configuration.
|
|
1079
700
|
|
|
1080
701
|
Returns
|
|
1081
702
|
-------
|
|
1082
|
-
|
|
703
|
+
QueryAnalyticsResponse
|
|
1083
704
|
Successful Response
|
|
1084
705
|
|
|
1085
706
|
Examples
|
|
@@ -1095,178 +716,34 @@ class AsyncObservabilityClient:
|
|
|
1095
716
|
|
|
1096
717
|
|
|
1097
718
|
async def main() -> None:
|
|
1098
|
-
await client.observability.
|
|
1099
|
-
app_id="app_id",
|
|
1100
|
-
)
|
|
719
|
+
await client.observability.query_analytics()
|
|
1101
720
|
|
|
1102
721
|
|
|
1103
722
|
asyncio.run(main())
|
|
1104
723
|
"""
|
|
1105
724
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1106
|
-
"observability/
|
|
725
|
+
"observability/v1/analytics",
|
|
1107
726
|
method="GET",
|
|
1108
727
|
params={
|
|
728
|
+
"format": format,
|
|
729
|
+
"focus": focus,
|
|
730
|
+
"oldest": oldest,
|
|
731
|
+
"newest": newest,
|
|
732
|
+
"window": window,
|
|
733
|
+
"filtering": filtering,
|
|
734
|
+
"timeRange": time_range,
|
|
1109
735
|
"app_id": app_id,
|
|
1110
|
-
"page": page,
|
|
1111
|
-
"pageSize": page_size,
|
|
1112
|
-
"type": type,
|
|
1113
|
-
"trace_id": trace_id,
|
|
1114
736
|
"environment": environment,
|
|
1115
737
|
"variant": variant,
|
|
1116
|
-
"created_at": created_at,
|
|
1117
|
-
},
|
|
1118
|
-
request_options=request_options,
|
|
1119
|
-
)
|
|
1120
|
-
try:
|
|
1121
|
-
if 200 <= _response.status_code < 300:
|
|
1122
|
-
return typing.cast(
|
|
1123
|
-
typing.Optional[typing.Any],
|
|
1124
|
-
parse_obj_as(
|
|
1125
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
1126
|
-
object_=_response.json(),
|
|
1127
|
-
),
|
|
1128
|
-
)
|
|
1129
|
-
if _response.status_code == 422:
|
|
1130
|
-
raise UnprocessableEntityError(
|
|
1131
|
-
typing.cast(
|
|
1132
|
-
HttpValidationError,
|
|
1133
|
-
parse_obj_as(
|
|
1134
|
-
type_=HttpValidationError, # type: ignore
|
|
1135
|
-
object_=_response.json(),
|
|
1136
|
-
),
|
|
1137
|
-
)
|
|
1138
|
-
)
|
|
1139
|
-
_response_json = _response.json()
|
|
1140
|
-
except JSONDecodeError:
|
|
1141
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1142
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1143
|
-
|
|
1144
|
-
async def delete_spans_of_trace(
|
|
1145
|
-
self,
|
|
1146
|
-
*,
|
|
1147
|
-
request: typing.Sequence[str],
|
|
1148
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1149
|
-
) -> bool:
|
|
1150
|
-
"""
|
|
1151
|
-
Parameters
|
|
1152
|
-
----------
|
|
1153
|
-
request : typing.Sequence[str]
|
|
1154
|
-
|
|
1155
|
-
request_options : typing.Optional[RequestOptions]
|
|
1156
|
-
Request-specific configuration.
|
|
1157
|
-
|
|
1158
|
-
Returns
|
|
1159
|
-
-------
|
|
1160
|
-
bool
|
|
1161
|
-
Successful Response
|
|
1162
|
-
|
|
1163
|
-
Examples
|
|
1164
|
-
--------
|
|
1165
|
-
import asyncio
|
|
1166
|
-
|
|
1167
|
-
from agenta import AsyncAgentaApi
|
|
1168
|
-
|
|
1169
|
-
client = AsyncAgentaApi(
|
|
1170
|
-
api_key="YOUR_API_KEY",
|
|
1171
|
-
base_url="https://yourhost.com/path/to/api",
|
|
1172
|
-
)
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
async def main() -> None:
|
|
1176
|
-
await client.observability.delete_spans_of_trace(
|
|
1177
|
-
request=["string"],
|
|
1178
|
-
)
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
asyncio.run(main())
|
|
1182
|
-
"""
|
|
1183
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1184
|
-
"observability/spans",
|
|
1185
|
-
method="DELETE",
|
|
1186
|
-
json=request,
|
|
1187
|
-
request_options=request_options,
|
|
1188
|
-
omit=OMIT,
|
|
1189
|
-
)
|
|
1190
|
-
try:
|
|
1191
|
-
if 200 <= _response.status_code < 300:
|
|
1192
|
-
return typing.cast(
|
|
1193
|
-
bool,
|
|
1194
|
-
parse_obj_as(
|
|
1195
|
-
type_=bool, # type: ignore
|
|
1196
|
-
object_=_response.json(),
|
|
1197
|
-
),
|
|
1198
|
-
)
|
|
1199
|
-
if _response.status_code == 422:
|
|
1200
|
-
raise UnprocessableEntityError(
|
|
1201
|
-
typing.cast(
|
|
1202
|
-
HttpValidationError,
|
|
1203
|
-
parse_obj_as(
|
|
1204
|
-
type_=HttpValidationError, # type: ignore
|
|
1205
|
-
object_=_response.json(),
|
|
1206
|
-
),
|
|
1207
|
-
)
|
|
1208
|
-
)
|
|
1209
|
-
_response_json = _response.json()
|
|
1210
|
-
except JSONDecodeError:
|
|
1211
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1212
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1213
|
-
|
|
1214
|
-
async def get_span_of_generation(
|
|
1215
|
-
self,
|
|
1216
|
-
span_id: str,
|
|
1217
|
-
*,
|
|
1218
|
-
type: typing.Optional[str] = None,
|
|
1219
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1220
|
-
) -> SpanDetail:
|
|
1221
|
-
"""
|
|
1222
|
-
Parameters
|
|
1223
|
-
----------
|
|
1224
|
-
span_id : str
|
|
1225
|
-
|
|
1226
|
-
type : typing.Optional[str]
|
|
1227
|
-
|
|
1228
|
-
request_options : typing.Optional[RequestOptions]
|
|
1229
|
-
Request-specific configuration.
|
|
1230
|
-
|
|
1231
|
-
Returns
|
|
1232
|
-
-------
|
|
1233
|
-
SpanDetail
|
|
1234
|
-
Successful Response
|
|
1235
|
-
|
|
1236
|
-
Examples
|
|
1237
|
-
--------
|
|
1238
|
-
import asyncio
|
|
1239
|
-
|
|
1240
|
-
from agenta import AsyncAgentaApi
|
|
1241
|
-
|
|
1242
|
-
client = AsyncAgentaApi(
|
|
1243
|
-
api_key="YOUR_API_KEY",
|
|
1244
|
-
base_url="https://yourhost.com/path/to/api",
|
|
1245
|
-
)
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
async def main() -> None:
|
|
1249
|
-
await client.observability.get_span_of_generation(
|
|
1250
|
-
span_id="span_id",
|
|
1251
|
-
)
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
asyncio.run(main())
|
|
1255
|
-
"""
|
|
1256
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1257
|
-
f"observability/spans/{jsonable_encoder(span_id)}",
|
|
1258
|
-
method="GET",
|
|
1259
|
-
params={
|
|
1260
|
-
"type": type,
|
|
1261
738
|
},
|
|
1262
739
|
request_options=request_options,
|
|
1263
740
|
)
|
|
1264
741
|
try:
|
|
1265
742
|
if 200 <= _response.status_code < 300:
|
|
1266
743
|
return typing.cast(
|
|
1267
|
-
|
|
744
|
+
QueryAnalyticsResponse,
|
|
1268
745
|
parse_obj_as(
|
|
1269
|
-
type_=
|
|
746
|
+
type_=QueryAnalyticsResponse, # type: ignore
|
|
1270
747
|
object_=_response.json(),
|
|
1271
748
|
),
|
|
1272
749
|
)
|