scale-gp-beta 0.1.0a8__py3-none-any.whl → 0.1.0a10__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.
- scale_gp_beta/_base_client.py +40 -2
- scale_gp_beta/_client.py +9 -1
- scale_gp_beta/_models.py +0 -1
- scale_gp_beta/_utils/_transform.py +46 -1
- scale_gp_beta/_utils/_typing.py +3 -1
- scale_gp_beta/_version.py +1 -1
- scale_gp_beta/resources/__init__.py +14 -0
- scale_gp_beta/resources/chat/completions.py +6 -2
- scale_gp_beta/resources/completions.py +6 -2
- scale_gp_beta/resources/datasets.py +17 -1
- scale_gp_beta/resources/evaluations.py +40 -4
- scale_gp_beta/resources/spans.py +654 -0
- scale_gp_beta/types/__init__.py +5 -0
- scale_gp_beta/types/dataset.py +4 -1
- scale_gp_beta/types/dataset_create_params.py +4 -1
- scale_gp_beta/types/dataset_update_params.py +4 -0
- scale_gp_beta/types/evaluation.py +7 -0
- scale_gp_beta/types/evaluation_create_params.py +12 -0
- scale_gp_beta/types/evaluation_list_params.py +4 -2
- scale_gp_beta/types/evaluation_retrieve_params.py +4 -1
- scale_gp_beta/types/evaluation_task.py +205 -0
- scale_gp_beta/types/evaluation_task_param.py +39 -45
- scale_gp_beta/types/span.py +38 -0
- scale_gp_beta/types/span_create_params.py +58 -0
- scale_gp_beta/types/span_list_params.py +27 -0
- scale_gp_beta/types/span_update_params.py +21 -0
- {scale_gp_beta-0.1.0a8.dist-info → scale_gp_beta-0.1.0a10.dist-info}/METADATA +8 -8
- {scale_gp_beta-0.1.0a8.dist-info → scale_gp_beta-0.1.0a10.dist-info}/RECORD +30 -24
- {scale_gp_beta-0.1.0a8.dist-info → scale_gp_beta-0.1.0a10.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a8.dist-info → scale_gp_beta-0.1.0a10.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,654 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, Union, Optional
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing_extensions import overload
|
|
8
|
+
|
|
9
|
+
import httpx
|
|
10
|
+
|
|
11
|
+
from ..types import span_list_params, span_create_params, span_update_params
|
|
12
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
13
|
+
from .._utils import (
|
|
14
|
+
required_args,
|
|
15
|
+
maybe_transform,
|
|
16
|
+
async_maybe_transform,
|
|
17
|
+
)
|
|
18
|
+
from .._compat import cached_property
|
|
19
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
20
|
+
from .._response import (
|
|
21
|
+
to_raw_response_wrapper,
|
|
22
|
+
to_streamed_response_wrapper,
|
|
23
|
+
async_to_raw_response_wrapper,
|
|
24
|
+
async_to_streamed_response_wrapper,
|
|
25
|
+
)
|
|
26
|
+
from ..pagination import SyncCursorPage, AsyncCursorPage
|
|
27
|
+
from ..types.span import Span
|
|
28
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
29
|
+
|
|
30
|
+
__all__ = ["SpansResource", "AsyncSpansResource"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SpansResource(SyncAPIResource):
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_raw_response(self) -> SpansResourceWithRawResponse:
|
|
36
|
+
"""
|
|
37
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
38
|
+
the raw response object instead of the parsed content.
|
|
39
|
+
|
|
40
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
|
|
41
|
+
"""
|
|
42
|
+
return SpansResourceWithRawResponse(self)
|
|
43
|
+
|
|
44
|
+
@cached_property
|
|
45
|
+
def with_streaming_response(self) -> SpansResourceWithStreamingResponse:
|
|
46
|
+
"""
|
|
47
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
48
|
+
|
|
49
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
|
|
50
|
+
"""
|
|
51
|
+
return SpansResourceWithStreamingResponse(self)
|
|
52
|
+
|
|
53
|
+
@overload
|
|
54
|
+
def create(
|
|
55
|
+
self,
|
|
56
|
+
*,
|
|
57
|
+
name: str,
|
|
58
|
+
start_timestamp: Union[str, datetime],
|
|
59
|
+
trace_id: str,
|
|
60
|
+
data: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
61
|
+
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
62
|
+
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
63
|
+
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
64
|
+
parent_id: str | NotGiven = NOT_GIVEN,
|
|
65
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
66
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
67
|
+
extra_headers: Headers | None = None,
|
|
68
|
+
extra_query: Query | None = None,
|
|
69
|
+
extra_body: Body | None = None,
|
|
70
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
71
|
+
) -> Span:
|
|
72
|
+
"""
|
|
73
|
+
Create Span
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
trace_id: id for grouping traces together, uuid is recommended
|
|
77
|
+
|
|
78
|
+
parent_id: Reference to a parent span_id
|
|
79
|
+
|
|
80
|
+
extra_headers: Send extra headers
|
|
81
|
+
|
|
82
|
+
extra_query: Add additional query parameters to the request
|
|
83
|
+
|
|
84
|
+
extra_body: Add additional JSON properties to the request
|
|
85
|
+
|
|
86
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
87
|
+
"""
|
|
88
|
+
...
|
|
89
|
+
|
|
90
|
+
@overload
|
|
91
|
+
def create(
|
|
92
|
+
self,
|
|
93
|
+
*,
|
|
94
|
+
application_interaction_id: str,
|
|
95
|
+
application_variant_id: str,
|
|
96
|
+
name: str,
|
|
97
|
+
start_timestamp: Union[str, datetime],
|
|
98
|
+
trace_id: str,
|
|
99
|
+
data: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
100
|
+
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
101
|
+
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
102
|
+
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
103
|
+
parent_id: str | NotGiven = NOT_GIVEN,
|
|
104
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
105
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
106
|
+
extra_headers: Headers | None = None,
|
|
107
|
+
extra_query: Query | None = None,
|
|
108
|
+
extra_body: Body | None = None,
|
|
109
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
110
|
+
) -> Span:
|
|
111
|
+
"""
|
|
112
|
+
Create Span
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
trace_id: id for grouping traces together, uuid is recommended
|
|
116
|
+
|
|
117
|
+
parent_id: Reference to a parent span_id
|
|
118
|
+
|
|
119
|
+
extra_headers: Send extra headers
|
|
120
|
+
|
|
121
|
+
extra_query: Add additional query parameters to the request
|
|
122
|
+
|
|
123
|
+
extra_body: Add additional JSON properties to the request
|
|
124
|
+
|
|
125
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
126
|
+
"""
|
|
127
|
+
...
|
|
128
|
+
|
|
129
|
+
@required_args(
|
|
130
|
+
["name", "start_timestamp", "trace_id"],
|
|
131
|
+
["application_interaction_id", "application_variant_id", "name", "start_timestamp", "trace_id"],
|
|
132
|
+
)
|
|
133
|
+
def create(
|
|
134
|
+
self,
|
|
135
|
+
*,
|
|
136
|
+
name: str,
|
|
137
|
+
start_timestamp: Union[str, datetime],
|
|
138
|
+
trace_id: str,
|
|
139
|
+
data: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
140
|
+
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
141
|
+
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
142
|
+
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
143
|
+
parent_id: str | NotGiven = NOT_GIVEN,
|
|
144
|
+
application_interaction_id: str | NotGiven = NOT_GIVEN,
|
|
145
|
+
application_variant_id: str | NotGiven = NOT_GIVEN,
|
|
146
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
147
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
148
|
+
extra_headers: Headers | None = None,
|
|
149
|
+
extra_query: Query | None = None,
|
|
150
|
+
extra_body: Body | None = None,
|
|
151
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
152
|
+
) -> Span:
|
|
153
|
+
return self._post(
|
|
154
|
+
"/v5/spans",
|
|
155
|
+
body=maybe_transform(
|
|
156
|
+
{
|
|
157
|
+
"name": name,
|
|
158
|
+
"start_timestamp": start_timestamp,
|
|
159
|
+
"trace_id": trace_id,
|
|
160
|
+
"data": data,
|
|
161
|
+
"end_timestamp": end_timestamp,
|
|
162
|
+
"input": input,
|
|
163
|
+
"output": output,
|
|
164
|
+
"parent_id": parent_id,
|
|
165
|
+
"application_interaction_id": application_interaction_id,
|
|
166
|
+
"application_variant_id": application_variant_id,
|
|
167
|
+
},
|
|
168
|
+
span_create_params.SpanCreateParams,
|
|
169
|
+
),
|
|
170
|
+
options=make_request_options(
|
|
171
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
172
|
+
),
|
|
173
|
+
cast_to=Span,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
def retrieve(
|
|
177
|
+
self,
|
|
178
|
+
span_id: str,
|
|
179
|
+
*,
|
|
180
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
181
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
182
|
+
extra_headers: Headers | None = None,
|
|
183
|
+
extra_query: Query | None = None,
|
|
184
|
+
extra_body: Body | None = None,
|
|
185
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
186
|
+
) -> Span:
|
|
187
|
+
"""
|
|
188
|
+
Get Span
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
extra_headers: Send extra headers
|
|
192
|
+
|
|
193
|
+
extra_query: Add additional query parameters to the request
|
|
194
|
+
|
|
195
|
+
extra_body: Add additional JSON properties to the request
|
|
196
|
+
|
|
197
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
198
|
+
"""
|
|
199
|
+
if not span_id:
|
|
200
|
+
raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
|
|
201
|
+
return self._get(
|
|
202
|
+
f"/v5/spans/{span_id}",
|
|
203
|
+
options=make_request_options(
|
|
204
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
205
|
+
),
|
|
206
|
+
cast_to=Span,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
def update(
|
|
210
|
+
self,
|
|
211
|
+
span_id: str,
|
|
212
|
+
*,
|
|
213
|
+
data: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
214
|
+
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
215
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
216
|
+
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
217
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
218
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
219
|
+
extra_headers: Headers | None = None,
|
|
220
|
+
extra_query: Query | None = None,
|
|
221
|
+
extra_body: Body | None = None,
|
|
222
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
223
|
+
) -> Span:
|
|
224
|
+
"""
|
|
225
|
+
Update Span
|
|
226
|
+
|
|
227
|
+
Args:
|
|
228
|
+
extra_headers: Send extra headers
|
|
229
|
+
|
|
230
|
+
extra_query: Add additional query parameters to the request
|
|
231
|
+
|
|
232
|
+
extra_body: Add additional JSON properties to the request
|
|
233
|
+
|
|
234
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
235
|
+
"""
|
|
236
|
+
if not span_id:
|
|
237
|
+
raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
|
|
238
|
+
return self._patch(
|
|
239
|
+
f"/v5/spans/{span_id}",
|
|
240
|
+
body=maybe_transform(
|
|
241
|
+
{
|
|
242
|
+
"data": data,
|
|
243
|
+
"end_timestamp": end_timestamp,
|
|
244
|
+
"name": name,
|
|
245
|
+
"output": output,
|
|
246
|
+
},
|
|
247
|
+
span_update_params.SpanUpdateParams,
|
|
248
|
+
),
|
|
249
|
+
options=make_request_options(
|
|
250
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
251
|
+
),
|
|
252
|
+
cast_to=Span,
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
def list(
|
|
256
|
+
self,
|
|
257
|
+
*,
|
|
258
|
+
ending_before: Optional[str] | NotGiven = NOT_GIVEN,
|
|
259
|
+
from_ts: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
260
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
261
|
+
parents_only: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
262
|
+
starting_after: Optional[str] | NotGiven = NOT_GIVEN,
|
|
263
|
+
to_ts: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
264
|
+
trace_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
265
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
266
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
267
|
+
extra_headers: Headers | None = None,
|
|
268
|
+
extra_query: Query | None = None,
|
|
269
|
+
extra_body: Body | None = None,
|
|
270
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
271
|
+
) -> SyncCursorPage[Span]:
|
|
272
|
+
"""
|
|
273
|
+
List Spans
|
|
274
|
+
|
|
275
|
+
Args:
|
|
276
|
+
extra_headers: Send extra headers
|
|
277
|
+
|
|
278
|
+
extra_query: Add additional query parameters to the request
|
|
279
|
+
|
|
280
|
+
extra_body: Add additional JSON properties to the request
|
|
281
|
+
|
|
282
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
283
|
+
"""
|
|
284
|
+
return self._get_api_list(
|
|
285
|
+
"/v5/spans",
|
|
286
|
+
page=SyncCursorPage[Span],
|
|
287
|
+
options=make_request_options(
|
|
288
|
+
extra_headers=extra_headers,
|
|
289
|
+
extra_query=extra_query,
|
|
290
|
+
extra_body=extra_body,
|
|
291
|
+
timeout=timeout,
|
|
292
|
+
query=maybe_transform(
|
|
293
|
+
{
|
|
294
|
+
"ending_before": ending_before,
|
|
295
|
+
"from_ts": from_ts,
|
|
296
|
+
"limit": limit,
|
|
297
|
+
"parents_only": parents_only,
|
|
298
|
+
"starting_after": starting_after,
|
|
299
|
+
"to_ts": to_ts,
|
|
300
|
+
"trace_id": trace_id,
|
|
301
|
+
},
|
|
302
|
+
span_list_params.SpanListParams,
|
|
303
|
+
),
|
|
304
|
+
),
|
|
305
|
+
model=Span,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
class AsyncSpansResource(AsyncAPIResource):
|
|
310
|
+
@cached_property
|
|
311
|
+
def with_raw_response(self) -> AsyncSpansResourceWithRawResponse:
|
|
312
|
+
"""
|
|
313
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
314
|
+
the raw response object instead of the parsed content.
|
|
315
|
+
|
|
316
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
|
|
317
|
+
"""
|
|
318
|
+
return AsyncSpansResourceWithRawResponse(self)
|
|
319
|
+
|
|
320
|
+
@cached_property
|
|
321
|
+
def with_streaming_response(self) -> AsyncSpansResourceWithStreamingResponse:
|
|
322
|
+
"""
|
|
323
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
324
|
+
|
|
325
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
|
|
326
|
+
"""
|
|
327
|
+
return AsyncSpansResourceWithStreamingResponse(self)
|
|
328
|
+
|
|
329
|
+
@overload
|
|
330
|
+
async def create(
|
|
331
|
+
self,
|
|
332
|
+
*,
|
|
333
|
+
name: str,
|
|
334
|
+
start_timestamp: Union[str, datetime],
|
|
335
|
+
trace_id: str,
|
|
336
|
+
data: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
337
|
+
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
338
|
+
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
339
|
+
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
340
|
+
parent_id: str | NotGiven = NOT_GIVEN,
|
|
341
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
342
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
343
|
+
extra_headers: Headers | None = None,
|
|
344
|
+
extra_query: Query | None = None,
|
|
345
|
+
extra_body: Body | None = None,
|
|
346
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
347
|
+
) -> Span:
|
|
348
|
+
"""
|
|
349
|
+
Create Span
|
|
350
|
+
|
|
351
|
+
Args:
|
|
352
|
+
trace_id: id for grouping traces together, uuid is recommended
|
|
353
|
+
|
|
354
|
+
parent_id: Reference to a parent span_id
|
|
355
|
+
|
|
356
|
+
extra_headers: Send extra headers
|
|
357
|
+
|
|
358
|
+
extra_query: Add additional query parameters to the request
|
|
359
|
+
|
|
360
|
+
extra_body: Add additional JSON properties to the request
|
|
361
|
+
|
|
362
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
363
|
+
"""
|
|
364
|
+
...
|
|
365
|
+
|
|
366
|
+
@overload
|
|
367
|
+
async def create(
|
|
368
|
+
self,
|
|
369
|
+
*,
|
|
370
|
+
application_interaction_id: str,
|
|
371
|
+
application_variant_id: str,
|
|
372
|
+
name: str,
|
|
373
|
+
start_timestamp: Union[str, datetime],
|
|
374
|
+
trace_id: str,
|
|
375
|
+
data: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
376
|
+
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
377
|
+
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
378
|
+
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
379
|
+
parent_id: str | NotGiven = NOT_GIVEN,
|
|
380
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
381
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
382
|
+
extra_headers: Headers | None = None,
|
|
383
|
+
extra_query: Query | None = None,
|
|
384
|
+
extra_body: Body | None = None,
|
|
385
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
386
|
+
) -> Span:
|
|
387
|
+
"""
|
|
388
|
+
Create Span
|
|
389
|
+
|
|
390
|
+
Args:
|
|
391
|
+
trace_id: id for grouping traces together, uuid is recommended
|
|
392
|
+
|
|
393
|
+
parent_id: Reference to a parent span_id
|
|
394
|
+
|
|
395
|
+
extra_headers: Send extra headers
|
|
396
|
+
|
|
397
|
+
extra_query: Add additional query parameters to the request
|
|
398
|
+
|
|
399
|
+
extra_body: Add additional JSON properties to the request
|
|
400
|
+
|
|
401
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
402
|
+
"""
|
|
403
|
+
...
|
|
404
|
+
|
|
405
|
+
@required_args(
|
|
406
|
+
["name", "start_timestamp", "trace_id"],
|
|
407
|
+
["application_interaction_id", "application_variant_id", "name", "start_timestamp", "trace_id"],
|
|
408
|
+
)
|
|
409
|
+
async def create(
|
|
410
|
+
self,
|
|
411
|
+
*,
|
|
412
|
+
name: str,
|
|
413
|
+
start_timestamp: Union[str, datetime],
|
|
414
|
+
trace_id: str,
|
|
415
|
+
data: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
416
|
+
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
417
|
+
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
418
|
+
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
419
|
+
parent_id: str | NotGiven = NOT_GIVEN,
|
|
420
|
+
application_interaction_id: str | NotGiven = NOT_GIVEN,
|
|
421
|
+
application_variant_id: str | NotGiven = NOT_GIVEN,
|
|
422
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
423
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
424
|
+
extra_headers: Headers | None = None,
|
|
425
|
+
extra_query: Query | None = None,
|
|
426
|
+
extra_body: Body | None = None,
|
|
427
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
428
|
+
) -> Span:
|
|
429
|
+
return await self._post(
|
|
430
|
+
"/v5/spans",
|
|
431
|
+
body=await async_maybe_transform(
|
|
432
|
+
{
|
|
433
|
+
"name": name,
|
|
434
|
+
"start_timestamp": start_timestamp,
|
|
435
|
+
"trace_id": trace_id,
|
|
436
|
+
"data": data,
|
|
437
|
+
"end_timestamp": end_timestamp,
|
|
438
|
+
"input": input,
|
|
439
|
+
"output": output,
|
|
440
|
+
"parent_id": parent_id,
|
|
441
|
+
"application_interaction_id": application_interaction_id,
|
|
442
|
+
"application_variant_id": application_variant_id,
|
|
443
|
+
},
|
|
444
|
+
span_create_params.SpanCreateParams,
|
|
445
|
+
),
|
|
446
|
+
options=make_request_options(
|
|
447
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
448
|
+
),
|
|
449
|
+
cast_to=Span,
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
async def retrieve(
|
|
453
|
+
self,
|
|
454
|
+
span_id: str,
|
|
455
|
+
*,
|
|
456
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
457
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
458
|
+
extra_headers: Headers | None = None,
|
|
459
|
+
extra_query: Query | None = None,
|
|
460
|
+
extra_body: Body | None = None,
|
|
461
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
462
|
+
) -> Span:
|
|
463
|
+
"""
|
|
464
|
+
Get Span
|
|
465
|
+
|
|
466
|
+
Args:
|
|
467
|
+
extra_headers: Send extra headers
|
|
468
|
+
|
|
469
|
+
extra_query: Add additional query parameters to the request
|
|
470
|
+
|
|
471
|
+
extra_body: Add additional JSON properties to the request
|
|
472
|
+
|
|
473
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
474
|
+
"""
|
|
475
|
+
if not span_id:
|
|
476
|
+
raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
|
|
477
|
+
return await self._get(
|
|
478
|
+
f"/v5/spans/{span_id}",
|
|
479
|
+
options=make_request_options(
|
|
480
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
481
|
+
),
|
|
482
|
+
cast_to=Span,
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
async def update(
|
|
486
|
+
self,
|
|
487
|
+
span_id: str,
|
|
488
|
+
*,
|
|
489
|
+
data: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
490
|
+
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
491
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
492
|
+
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
493
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
494
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
495
|
+
extra_headers: Headers | None = None,
|
|
496
|
+
extra_query: Query | None = None,
|
|
497
|
+
extra_body: Body | None = None,
|
|
498
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
499
|
+
) -> Span:
|
|
500
|
+
"""
|
|
501
|
+
Update Span
|
|
502
|
+
|
|
503
|
+
Args:
|
|
504
|
+
extra_headers: Send extra headers
|
|
505
|
+
|
|
506
|
+
extra_query: Add additional query parameters to the request
|
|
507
|
+
|
|
508
|
+
extra_body: Add additional JSON properties to the request
|
|
509
|
+
|
|
510
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
511
|
+
"""
|
|
512
|
+
if not span_id:
|
|
513
|
+
raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
|
|
514
|
+
return await self._patch(
|
|
515
|
+
f"/v5/spans/{span_id}",
|
|
516
|
+
body=await async_maybe_transform(
|
|
517
|
+
{
|
|
518
|
+
"data": data,
|
|
519
|
+
"end_timestamp": end_timestamp,
|
|
520
|
+
"name": name,
|
|
521
|
+
"output": output,
|
|
522
|
+
},
|
|
523
|
+
span_update_params.SpanUpdateParams,
|
|
524
|
+
),
|
|
525
|
+
options=make_request_options(
|
|
526
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
527
|
+
),
|
|
528
|
+
cast_to=Span,
|
|
529
|
+
)
|
|
530
|
+
|
|
531
|
+
def list(
|
|
532
|
+
self,
|
|
533
|
+
*,
|
|
534
|
+
ending_before: Optional[str] | NotGiven = NOT_GIVEN,
|
|
535
|
+
from_ts: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
536
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
537
|
+
parents_only: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
538
|
+
starting_after: Optional[str] | NotGiven = NOT_GIVEN,
|
|
539
|
+
to_ts: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
540
|
+
trace_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
541
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
542
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
543
|
+
extra_headers: Headers | None = None,
|
|
544
|
+
extra_query: Query | None = None,
|
|
545
|
+
extra_body: Body | None = None,
|
|
546
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
547
|
+
) -> AsyncPaginator[Span, AsyncCursorPage[Span]]:
|
|
548
|
+
"""
|
|
549
|
+
List Spans
|
|
550
|
+
|
|
551
|
+
Args:
|
|
552
|
+
extra_headers: Send extra headers
|
|
553
|
+
|
|
554
|
+
extra_query: Add additional query parameters to the request
|
|
555
|
+
|
|
556
|
+
extra_body: Add additional JSON properties to the request
|
|
557
|
+
|
|
558
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
559
|
+
"""
|
|
560
|
+
return self._get_api_list(
|
|
561
|
+
"/v5/spans",
|
|
562
|
+
page=AsyncCursorPage[Span],
|
|
563
|
+
options=make_request_options(
|
|
564
|
+
extra_headers=extra_headers,
|
|
565
|
+
extra_query=extra_query,
|
|
566
|
+
extra_body=extra_body,
|
|
567
|
+
timeout=timeout,
|
|
568
|
+
query=maybe_transform(
|
|
569
|
+
{
|
|
570
|
+
"ending_before": ending_before,
|
|
571
|
+
"from_ts": from_ts,
|
|
572
|
+
"limit": limit,
|
|
573
|
+
"parents_only": parents_only,
|
|
574
|
+
"starting_after": starting_after,
|
|
575
|
+
"to_ts": to_ts,
|
|
576
|
+
"trace_id": trace_id,
|
|
577
|
+
},
|
|
578
|
+
span_list_params.SpanListParams,
|
|
579
|
+
),
|
|
580
|
+
),
|
|
581
|
+
model=Span,
|
|
582
|
+
)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
class SpansResourceWithRawResponse:
|
|
586
|
+
def __init__(self, spans: SpansResource) -> None:
|
|
587
|
+
self._spans = spans
|
|
588
|
+
|
|
589
|
+
self.create = to_raw_response_wrapper(
|
|
590
|
+
spans.create,
|
|
591
|
+
)
|
|
592
|
+
self.retrieve = to_raw_response_wrapper(
|
|
593
|
+
spans.retrieve,
|
|
594
|
+
)
|
|
595
|
+
self.update = to_raw_response_wrapper(
|
|
596
|
+
spans.update,
|
|
597
|
+
)
|
|
598
|
+
self.list = to_raw_response_wrapper(
|
|
599
|
+
spans.list,
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
class AsyncSpansResourceWithRawResponse:
|
|
604
|
+
def __init__(self, spans: AsyncSpansResource) -> None:
|
|
605
|
+
self._spans = spans
|
|
606
|
+
|
|
607
|
+
self.create = async_to_raw_response_wrapper(
|
|
608
|
+
spans.create,
|
|
609
|
+
)
|
|
610
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
611
|
+
spans.retrieve,
|
|
612
|
+
)
|
|
613
|
+
self.update = async_to_raw_response_wrapper(
|
|
614
|
+
spans.update,
|
|
615
|
+
)
|
|
616
|
+
self.list = async_to_raw_response_wrapper(
|
|
617
|
+
spans.list,
|
|
618
|
+
)
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
class SpansResourceWithStreamingResponse:
|
|
622
|
+
def __init__(self, spans: SpansResource) -> None:
|
|
623
|
+
self._spans = spans
|
|
624
|
+
|
|
625
|
+
self.create = to_streamed_response_wrapper(
|
|
626
|
+
spans.create,
|
|
627
|
+
)
|
|
628
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
629
|
+
spans.retrieve,
|
|
630
|
+
)
|
|
631
|
+
self.update = to_streamed_response_wrapper(
|
|
632
|
+
spans.update,
|
|
633
|
+
)
|
|
634
|
+
self.list = to_streamed_response_wrapper(
|
|
635
|
+
spans.list,
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
class AsyncSpansResourceWithStreamingResponse:
|
|
640
|
+
def __init__(self, spans: AsyncSpansResource) -> None:
|
|
641
|
+
self._spans = spans
|
|
642
|
+
|
|
643
|
+
self.create = async_to_streamed_response_wrapper(
|
|
644
|
+
spans.create,
|
|
645
|
+
)
|
|
646
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
647
|
+
spans.retrieve,
|
|
648
|
+
)
|
|
649
|
+
self.update = async_to_streamed_response_wrapper(
|
|
650
|
+
spans.update,
|
|
651
|
+
)
|
|
652
|
+
self.list = async_to_streamed_response_wrapper(
|
|
653
|
+
spans.list,
|
|
654
|
+
)
|
scale_gp_beta/types/__init__.py
CHANGED
|
@@ -3,18 +3,23 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from .file import File as File
|
|
6
|
+
from .span import Span as Span
|
|
6
7
|
from .dataset import Dataset as Dataset
|
|
7
8
|
from .file_list import FileList as FileList
|
|
8
9
|
from .completion import Completion as Completion
|
|
9
10
|
from .evaluation import Evaluation as Evaluation
|
|
10
11
|
from .dataset_item import DatasetItem as DatasetItem
|
|
11
12
|
from .evaluation_item import EvaluationItem as EvaluationItem
|
|
13
|
+
from .evaluation_task import EvaluationTask as EvaluationTask
|
|
12
14
|
from .inference_model import InferenceModel as InferenceModel
|
|
13
15
|
from .file_list_params import FileListParams as FileListParams
|
|
16
|
+
from .span_list_params import SpanListParams as SpanListParams
|
|
14
17
|
from .model_list_params import ModelListParams as ModelListParams
|
|
15
18
|
from .file_create_params import FileCreateParams as FileCreateParams
|
|
16
19
|
from .file_update_params import FileUpdateParams as FileUpdateParams
|
|
17
20
|
from .inference_response import InferenceResponse as InferenceResponse
|
|
21
|
+
from .span_create_params import SpanCreateParams as SpanCreateParams
|
|
22
|
+
from .span_update_params import SpanUpdateParams as SpanUpdateParams
|
|
18
23
|
from .dataset_list_params import DatasetListParams as DatasetListParams
|
|
19
24
|
from .model_create_params import ModelCreateParams as ModelCreateParams
|
|
20
25
|
from .model_update_params import ModelUpdateParams as ModelUpdateParams
|
scale_gp_beta/types/dataset.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
from typing import Optional
|
|
3
|
+
from typing import List, Optional
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
from typing_extensions import Literal
|
|
6
6
|
|
|
@@ -20,6 +20,9 @@ class Dataset(BaseModel):
|
|
|
20
20
|
|
|
21
21
|
name: str
|
|
22
22
|
|
|
23
|
+
tags: List[str]
|
|
24
|
+
"""The tags associated with the entity"""
|
|
25
|
+
|
|
23
26
|
archived_at: Optional[datetime] = None
|
|
24
27
|
|
|
25
28
|
description: Optional[str] = None
|