scale-gp-beta 0.1.0a14__py3-none-any.whl → 0.1.0a16__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 +6 -0
- scale_gp_beta/_models.py +2 -0
- scale_gp_beta/_types.py +2 -0
- scale_gp_beta/_version.py +1 -1
- scale_gp_beta/pagination.py +18 -0
- scale_gp_beta/resources/dataset_items.py +10 -13
- scale_gp_beta/resources/spans.py +31 -405
- scale_gp_beta/types/__init__.py +2 -1
- scale_gp_beta/types/chat/model_definition.py +3 -3
- scale_gp_beta/types/dataset_item_batch_create_response.py +15 -0
- scale_gp_beta/types/evaluation_task.py +43 -5
- scale_gp_beta/types/evaluation_task_param.py +35 -3
- scale_gp_beta/types/inference_model.py +5 -5
- scale_gp_beta/types/span.py +3 -0
- scale_gp_beta/types/span_batch_params.py +10 -62
- scale_gp_beta/types/span_batch_response.py +15 -0
- scale_gp_beta/types/span_create_params.py +10 -62
- {scale_gp_beta-0.1.0a14.dist-info → scale_gp_beta-0.1.0a16.dist-info}/METADATA +2 -5
- {scale_gp_beta-0.1.0a14.dist-info → scale_gp_beta-0.1.0a16.dist-info}/RECORD +21 -20
- scale_gp_beta/types/span_list_params.py +0 -27
- {scale_gp_beta-0.1.0a14.dist-info → scale_gp_beta-0.1.0a16.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a14.dist-info → scale_gp_beta-0.1.0a16.dist-info}/licenses/LICENSE +0 -0
scale_gp_beta/resources/spans.py
CHANGED
|
@@ -4,13 +4,13 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from typing import Dict, Union, Iterable
|
|
6
6
|
from datetime import datetime
|
|
7
|
-
from typing_extensions import Literal
|
|
7
|
+
from typing_extensions import Literal
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
|
|
11
|
-
from ..types import
|
|
11
|
+
from ..types import span_batch_params, span_create_params, span_update_params
|
|
12
12
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
13
|
-
from .._utils import
|
|
13
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
14
14
|
from .._compat import cached_property
|
|
15
15
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
16
16
|
from .._response import (
|
|
@@ -19,9 +19,9 @@ from .._response import (
|
|
|
19
19
|
async_to_raw_response_wrapper,
|
|
20
20
|
async_to_streamed_response_wrapper,
|
|
21
21
|
)
|
|
22
|
-
from ..pagination import SyncCursorPage, AsyncCursorPage, SyncAPIListPage, AsyncAPIListPage
|
|
23
22
|
from ..types.span import Span
|
|
24
|
-
from .._base_client import
|
|
23
|
+
from .._base_client import make_request_options
|
|
24
|
+
from ..types.span_batch_response import SpanBatchResponse
|
|
25
25
|
|
|
26
26
|
__all__ = ["SpansResource", "AsyncSpansResource"]
|
|
27
27
|
|
|
@@ -46,7 +46,6 @@ class SpansResource(SyncAPIResource):
|
|
|
46
46
|
"""
|
|
47
47
|
return SpansResourceWithStreamingResponse(self)
|
|
48
48
|
|
|
49
|
-
@overload
|
|
50
49
|
def create(
|
|
51
50
|
self,
|
|
52
51
|
*,
|
|
@@ -54,7 +53,10 @@ class SpansResource(SyncAPIResource):
|
|
|
54
53
|
start_timestamp: Union[str, datetime],
|
|
55
54
|
trace_id: str,
|
|
56
55
|
id: str | NotGiven = NOT_GIVEN,
|
|
56
|
+
application_interaction_id: str | NotGiven = NOT_GIVEN,
|
|
57
|
+
application_variant_id: str | NotGiven = NOT_GIVEN,
|
|
57
58
|
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
59
|
+
group_id: str | NotGiven = NOT_GIVEN,
|
|
58
60
|
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
59
61
|
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
60
62
|
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -104,77 +106,11 @@ class SpansResource(SyncAPIResource):
|
|
|
104
106
|
|
|
105
107
|
id: The id of the span
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
extra_headers: Send extra headers
|
|
110
|
-
|
|
111
|
-
extra_query: Add additional query parameters to the request
|
|
109
|
+
application_interaction_id: The optional application interaction ID this span belongs to
|
|
112
110
|
|
|
113
|
-
|
|
111
|
+
application_variant_id: The optional application variant ID this span belongs to
|
|
114
112
|
|
|
115
|
-
|
|
116
|
-
"""
|
|
117
|
-
...
|
|
118
|
-
|
|
119
|
-
@overload
|
|
120
|
-
def create(
|
|
121
|
-
self,
|
|
122
|
-
*,
|
|
123
|
-
application_interaction_id: str,
|
|
124
|
-
application_variant_id: str,
|
|
125
|
-
name: str,
|
|
126
|
-
start_timestamp: Union[str, datetime],
|
|
127
|
-
trace_id: str,
|
|
128
|
-
id: str | NotGiven = NOT_GIVEN,
|
|
129
|
-
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
130
|
-
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
131
|
-
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
132
|
-
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
133
|
-
parent_id: str | NotGiven = NOT_GIVEN,
|
|
134
|
-
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
135
|
-
type: Literal[
|
|
136
|
-
"TEXT_INPUT",
|
|
137
|
-
"TEXT_OUTPUT",
|
|
138
|
-
"COMPLETION_INPUT",
|
|
139
|
-
"COMPLETION",
|
|
140
|
-
"KB_RETRIEVAL",
|
|
141
|
-
"KB_INPUT",
|
|
142
|
-
"RERANKING",
|
|
143
|
-
"EXTERNAL_ENDPOINT",
|
|
144
|
-
"PROMPT_ENGINEERING",
|
|
145
|
-
"DOCUMENT_INPUT",
|
|
146
|
-
"MAP_REDUCE",
|
|
147
|
-
"DOCUMENT_SEARCH",
|
|
148
|
-
"DOCUMENT_PROMPT",
|
|
149
|
-
"CUSTOM",
|
|
150
|
-
"INPUT_GUARDRAIL",
|
|
151
|
-
"OUTPUT_GUARDRAIL",
|
|
152
|
-
"CODE_EXECUTION",
|
|
153
|
-
"DATA_MANIPULATION",
|
|
154
|
-
"EVALUATION",
|
|
155
|
-
"FILE_RETRIEVAL",
|
|
156
|
-
"KB_ADD_CHUNK",
|
|
157
|
-
"KB_MANAGEMENT",
|
|
158
|
-
"TRACER",
|
|
159
|
-
"AGENT_TRACER",
|
|
160
|
-
"AGENT_WORKFLOW",
|
|
161
|
-
"STANDALONE",
|
|
162
|
-
]
|
|
163
|
-
| NotGiven = NOT_GIVEN,
|
|
164
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
165
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
166
|
-
extra_headers: Headers | None = None,
|
|
167
|
-
extra_query: Query | None = None,
|
|
168
|
-
extra_body: Body | None = None,
|
|
169
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
170
|
-
) -> Span:
|
|
171
|
-
"""
|
|
172
|
-
Create Span
|
|
173
|
-
|
|
174
|
-
Args:
|
|
175
|
-
trace_id: id for grouping traces together, uuid is recommended
|
|
176
|
-
|
|
177
|
-
id: The id of the span
|
|
113
|
+
group_id: Reference to a group_id
|
|
178
114
|
|
|
179
115
|
parent_id: Reference to a parent span_id
|
|
180
116
|
|
|
@@ -186,63 +122,6 @@ class SpansResource(SyncAPIResource):
|
|
|
186
122
|
|
|
187
123
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
188
124
|
"""
|
|
189
|
-
...
|
|
190
|
-
|
|
191
|
-
@required_args(
|
|
192
|
-
["name", "start_timestamp", "trace_id"],
|
|
193
|
-
["application_interaction_id", "application_variant_id", "name", "start_timestamp", "trace_id"],
|
|
194
|
-
)
|
|
195
|
-
def create(
|
|
196
|
-
self,
|
|
197
|
-
*,
|
|
198
|
-
name: str,
|
|
199
|
-
start_timestamp: Union[str, datetime],
|
|
200
|
-
trace_id: str,
|
|
201
|
-
id: str | NotGiven = NOT_GIVEN,
|
|
202
|
-
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
203
|
-
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
204
|
-
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
205
|
-
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
206
|
-
parent_id: str | NotGiven = NOT_GIVEN,
|
|
207
|
-
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
208
|
-
type: Literal[
|
|
209
|
-
"TEXT_INPUT",
|
|
210
|
-
"TEXT_OUTPUT",
|
|
211
|
-
"COMPLETION_INPUT",
|
|
212
|
-
"COMPLETION",
|
|
213
|
-
"KB_RETRIEVAL",
|
|
214
|
-
"KB_INPUT",
|
|
215
|
-
"RERANKING",
|
|
216
|
-
"EXTERNAL_ENDPOINT",
|
|
217
|
-
"PROMPT_ENGINEERING",
|
|
218
|
-
"DOCUMENT_INPUT",
|
|
219
|
-
"MAP_REDUCE",
|
|
220
|
-
"DOCUMENT_SEARCH",
|
|
221
|
-
"DOCUMENT_PROMPT",
|
|
222
|
-
"CUSTOM",
|
|
223
|
-
"INPUT_GUARDRAIL",
|
|
224
|
-
"OUTPUT_GUARDRAIL",
|
|
225
|
-
"CODE_EXECUTION",
|
|
226
|
-
"DATA_MANIPULATION",
|
|
227
|
-
"EVALUATION",
|
|
228
|
-
"FILE_RETRIEVAL",
|
|
229
|
-
"KB_ADD_CHUNK",
|
|
230
|
-
"KB_MANAGEMENT",
|
|
231
|
-
"TRACER",
|
|
232
|
-
"AGENT_TRACER",
|
|
233
|
-
"AGENT_WORKFLOW",
|
|
234
|
-
"STANDALONE",
|
|
235
|
-
]
|
|
236
|
-
| NotGiven = NOT_GIVEN,
|
|
237
|
-
application_interaction_id: str | NotGiven = NOT_GIVEN,
|
|
238
|
-
application_variant_id: str | NotGiven = NOT_GIVEN,
|
|
239
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
240
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
241
|
-
extra_headers: Headers | None = None,
|
|
242
|
-
extra_query: Query | None = None,
|
|
243
|
-
extra_body: Body | None = None,
|
|
244
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
245
|
-
) -> Span:
|
|
246
125
|
return self._post(
|
|
247
126
|
"/v5/spans",
|
|
248
127
|
body=maybe_transform(
|
|
@@ -251,15 +130,16 @@ class SpansResource(SyncAPIResource):
|
|
|
251
130
|
"start_timestamp": start_timestamp,
|
|
252
131
|
"trace_id": trace_id,
|
|
253
132
|
"id": id,
|
|
133
|
+
"application_interaction_id": application_interaction_id,
|
|
134
|
+
"application_variant_id": application_variant_id,
|
|
254
135
|
"end_timestamp": end_timestamp,
|
|
136
|
+
"group_id": group_id,
|
|
255
137
|
"input": input,
|
|
256
138
|
"metadata": metadata,
|
|
257
139
|
"output": output,
|
|
258
140
|
"parent_id": parent_id,
|
|
259
141
|
"status": status,
|
|
260
142
|
"type": type,
|
|
261
|
-
"application_interaction_id": application_interaction_id,
|
|
262
|
-
"application_variant_id": application_variant_id,
|
|
263
143
|
},
|
|
264
144
|
span_create_params.SpanCreateParams,
|
|
265
145
|
),
|
|
@@ -350,65 +230,6 @@ class SpansResource(SyncAPIResource):
|
|
|
350
230
|
cast_to=Span,
|
|
351
231
|
)
|
|
352
232
|
|
|
353
|
-
def list(
|
|
354
|
-
self,
|
|
355
|
-
*,
|
|
356
|
-
ending_before: str | NotGiven = NOT_GIVEN,
|
|
357
|
-
from_ts: int | NotGiven = NOT_GIVEN,
|
|
358
|
-
limit: int | NotGiven = NOT_GIVEN,
|
|
359
|
-
parents_only: bool | NotGiven = NOT_GIVEN,
|
|
360
|
-
sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
361
|
-
starting_after: str | NotGiven = NOT_GIVEN,
|
|
362
|
-
to_ts: int | NotGiven = NOT_GIVEN,
|
|
363
|
-
trace_id: str | NotGiven = NOT_GIVEN,
|
|
364
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
365
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
366
|
-
extra_headers: Headers | None = None,
|
|
367
|
-
extra_query: Query | None = None,
|
|
368
|
-
extra_body: Body | None = None,
|
|
369
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
370
|
-
) -> SyncCursorPage[Span]:
|
|
371
|
-
"""
|
|
372
|
-
List Spans
|
|
373
|
-
|
|
374
|
-
Args:
|
|
375
|
-
from_ts: The starting (oldest) timestamp window in seconds.
|
|
376
|
-
|
|
377
|
-
to_ts: The ending (most recent) timestamp in seconds.
|
|
378
|
-
|
|
379
|
-
extra_headers: Send extra headers
|
|
380
|
-
|
|
381
|
-
extra_query: Add additional query parameters to the request
|
|
382
|
-
|
|
383
|
-
extra_body: Add additional JSON properties to the request
|
|
384
|
-
|
|
385
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
386
|
-
"""
|
|
387
|
-
return self._get_api_list(
|
|
388
|
-
"/v5/spans",
|
|
389
|
-
page=SyncCursorPage[Span],
|
|
390
|
-
options=make_request_options(
|
|
391
|
-
extra_headers=extra_headers,
|
|
392
|
-
extra_query=extra_query,
|
|
393
|
-
extra_body=extra_body,
|
|
394
|
-
timeout=timeout,
|
|
395
|
-
query=maybe_transform(
|
|
396
|
-
{
|
|
397
|
-
"ending_before": ending_before,
|
|
398
|
-
"from_ts": from_ts,
|
|
399
|
-
"limit": limit,
|
|
400
|
-
"parents_only": parents_only,
|
|
401
|
-
"sort_order": sort_order,
|
|
402
|
-
"starting_after": starting_after,
|
|
403
|
-
"to_ts": to_ts,
|
|
404
|
-
"trace_id": trace_id,
|
|
405
|
-
},
|
|
406
|
-
span_list_params.SpanListParams,
|
|
407
|
-
),
|
|
408
|
-
),
|
|
409
|
-
model=Span,
|
|
410
|
-
)
|
|
411
|
-
|
|
412
233
|
def batch(
|
|
413
234
|
self,
|
|
414
235
|
*,
|
|
@@ -419,7 +240,7 @@ class SpansResource(SyncAPIResource):
|
|
|
419
240
|
extra_query: Query | None = None,
|
|
420
241
|
extra_body: Body | None = None,
|
|
421
242
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
422
|
-
) ->
|
|
243
|
+
) -> SpanBatchResponse:
|
|
423
244
|
"""
|
|
424
245
|
Create Spans in Batch
|
|
425
246
|
|
|
@@ -432,15 +253,13 @@ class SpansResource(SyncAPIResource):
|
|
|
432
253
|
|
|
433
254
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
434
255
|
"""
|
|
435
|
-
return self.
|
|
256
|
+
return self._post(
|
|
436
257
|
"/v5/spans/batch",
|
|
437
|
-
page=SyncAPIListPage[Span],
|
|
438
258
|
body=maybe_transform({"items": items}, span_batch_params.SpanBatchParams),
|
|
439
259
|
options=make_request_options(
|
|
440
260
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
441
261
|
),
|
|
442
|
-
|
|
443
|
-
method="post",
|
|
262
|
+
cast_to=SpanBatchResponse,
|
|
444
263
|
)
|
|
445
264
|
|
|
446
265
|
|
|
@@ -464,7 +283,6 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
464
283
|
"""
|
|
465
284
|
return AsyncSpansResourceWithStreamingResponse(self)
|
|
466
285
|
|
|
467
|
-
@overload
|
|
468
286
|
async def create(
|
|
469
287
|
self,
|
|
470
288
|
*,
|
|
@@ -472,7 +290,10 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
472
290
|
start_timestamp: Union[str, datetime],
|
|
473
291
|
trace_id: str,
|
|
474
292
|
id: str | NotGiven = NOT_GIVEN,
|
|
293
|
+
application_interaction_id: str | NotGiven = NOT_GIVEN,
|
|
294
|
+
application_variant_id: str | NotGiven = NOT_GIVEN,
|
|
475
295
|
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
296
|
+
group_id: str | NotGiven = NOT_GIVEN,
|
|
476
297
|
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
477
298
|
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
478
299
|
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -522,77 +343,11 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
522
343
|
|
|
523
344
|
id: The id of the span
|
|
524
345
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
extra_headers: Send extra headers
|
|
346
|
+
application_interaction_id: The optional application interaction ID this span belongs to
|
|
528
347
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
extra_body: Add additional JSON properties to the request
|
|
348
|
+
application_variant_id: The optional application variant ID this span belongs to
|
|
532
349
|
|
|
533
|
-
|
|
534
|
-
"""
|
|
535
|
-
...
|
|
536
|
-
|
|
537
|
-
@overload
|
|
538
|
-
async def create(
|
|
539
|
-
self,
|
|
540
|
-
*,
|
|
541
|
-
application_interaction_id: str,
|
|
542
|
-
application_variant_id: str,
|
|
543
|
-
name: str,
|
|
544
|
-
start_timestamp: Union[str, datetime],
|
|
545
|
-
trace_id: str,
|
|
546
|
-
id: str | NotGiven = NOT_GIVEN,
|
|
547
|
-
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
548
|
-
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
549
|
-
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
550
|
-
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
551
|
-
parent_id: str | NotGiven = NOT_GIVEN,
|
|
552
|
-
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
553
|
-
type: Literal[
|
|
554
|
-
"TEXT_INPUT",
|
|
555
|
-
"TEXT_OUTPUT",
|
|
556
|
-
"COMPLETION_INPUT",
|
|
557
|
-
"COMPLETION",
|
|
558
|
-
"KB_RETRIEVAL",
|
|
559
|
-
"KB_INPUT",
|
|
560
|
-
"RERANKING",
|
|
561
|
-
"EXTERNAL_ENDPOINT",
|
|
562
|
-
"PROMPT_ENGINEERING",
|
|
563
|
-
"DOCUMENT_INPUT",
|
|
564
|
-
"MAP_REDUCE",
|
|
565
|
-
"DOCUMENT_SEARCH",
|
|
566
|
-
"DOCUMENT_PROMPT",
|
|
567
|
-
"CUSTOM",
|
|
568
|
-
"INPUT_GUARDRAIL",
|
|
569
|
-
"OUTPUT_GUARDRAIL",
|
|
570
|
-
"CODE_EXECUTION",
|
|
571
|
-
"DATA_MANIPULATION",
|
|
572
|
-
"EVALUATION",
|
|
573
|
-
"FILE_RETRIEVAL",
|
|
574
|
-
"KB_ADD_CHUNK",
|
|
575
|
-
"KB_MANAGEMENT",
|
|
576
|
-
"TRACER",
|
|
577
|
-
"AGENT_TRACER",
|
|
578
|
-
"AGENT_WORKFLOW",
|
|
579
|
-
"STANDALONE",
|
|
580
|
-
]
|
|
581
|
-
| NotGiven = NOT_GIVEN,
|
|
582
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
583
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
584
|
-
extra_headers: Headers | None = None,
|
|
585
|
-
extra_query: Query | None = None,
|
|
586
|
-
extra_body: Body | None = None,
|
|
587
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
588
|
-
) -> Span:
|
|
589
|
-
"""
|
|
590
|
-
Create Span
|
|
591
|
-
|
|
592
|
-
Args:
|
|
593
|
-
trace_id: id for grouping traces together, uuid is recommended
|
|
594
|
-
|
|
595
|
-
id: The id of the span
|
|
350
|
+
group_id: Reference to a group_id
|
|
596
351
|
|
|
597
352
|
parent_id: Reference to a parent span_id
|
|
598
353
|
|
|
@@ -604,63 +359,6 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
604
359
|
|
|
605
360
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
606
361
|
"""
|
|
607
|
-
...
|
|
608
|
-
|
|
609
|
-
@required_args(
|
|
610
|
-
["name", "start_timestamp", "trace_id"],
|
|
611
|
-
["application_interaction_id", "application_variant_id", "name", "start_timestamp", "trace_id"],
|
|
612
|
-
)
|
|
613
|
-
async def create(
|
|
614
|
-
self,
|
|
615
|
-
*,
|
|
616
|
-
name: str,
|
|
617
|
-
start_timestamp: Union[str, datetime],
|
|
618
|
-
trace_id: str,
|
|
619
|
-
id: str | NotGiven = NOT_GIVEN,
|
|
620
|
-
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
621
|
-
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
622
|
-
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
623
|
-
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
624
|
-
parent_id: str | NotGiven = NOT_GIVEN,
|
|
625
|
-
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
626
|
-
type: Literal[
|
|
627
|
-
"TEXT_INPUT",
|
|
628
|
-
"TEXT_OUTPUT",
|
|
629
|
-
"COMPLETION_INPUT",
|
|
630
|
-
"COMPLETION",
|
|
631
|
-
"KB_RETRIEVAL",
|
|
632
|
-
"KB_INPUT",
|
|
633
|
-
"RERANKING",
|
|
634
|
-
"EXTERNAL_ENDPOINT",
|
|
635
|
-
"PROMPT_ENGINEERING",
|
|
636
|
-
"DOCUMENT_INPUT",
|
|
637
|
-
"MAP_REDUCE",
|
|
638
|
-
"DOCUMENT_SEARCH",
|
|
639
|
-
"DOCUMENT_PROMPT",
|
|
640
|
-
"CUSTOM",
|
|
641
|
-
"INPUT_GUARDRAIL",
|
|
642
|
-
"OUTPUT_GUARDRAIL",
|
|
643
|
-
"CODE_EXECUTION",
|
|
644
|
-
"DATA_MANIPULATION",
|
|
645
|
-
"EVALUATION",
|
|
646
|
-
"FILE_RETRIEVAL",
|
|
647
|
-
"KB_ADD_CHUNK",
|
|
648
|
-
"KB_MANAGEMENT",
|
|
649
|
-
"TRACER",
|
|
650
|
-
"AGENT_TRACER",
|
|
651
|
-
"AGENT_WORKFLOW",
|
|
652
|
-
"STANDALONE",
|
|
653
|
-
]
|
|
654
|
-
| NotGiven = NOT_GIVEN,
|
|
655
|
-
application_interaction_id: str | NotGiven = NOT_GIVEN,
|
|
656
|
-
application_variant_id: str | NotGiven = NOT_GIVEN,
|
|
657
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
658
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
659
|
-
extra_headers: Headers | None = None,
|
|
660
|
-
extra_query: Query | None = None,
|
|
661
|
-
extra_body: Body | None = None,
|
|
662
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
663
|
-
) -> Span:
|
|
664
362
|
return await self._post(
|
|
665
363
|
"/v5/spans",
|
|
666
364
|
body=await async_maybe_transform(
|
|
@@ -669,15 +367,16 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
669
367
|
"start_timestamp": start_timestamp,
|
|
670
368
|
"trace_id": trace_id,
|
|
671
369
|
"id": id,
|
|
370
|
+
"application_interaction_id": application_interaction_id,
|
|
371
|
+
"application_variant_id": application_variant_id,
|
|
672
372
|
"end_timestamp": end_timestamp,
|
|
373
|
+
"group_id": group_id,
|
|
673
374
|
"input": input,
|
|
674
375
|
"metadata": metadata,
|
|
675
376
|
"output": output,
|
|
676
377
|
"parent_id": parent_id,
|
|
677
378
|
"status": status,
|
|
678
379
|
"type": type,
|
|
679
|
-
"application_interaction_id": application_interaction_id,
|
|
680
|
-
"application_variant_id": application_variant_id,
|
|
681
380
|
},
|
|
682
381
|
span_create_params.SpanCreateParams,
|
|
683
382
|
),
|
|
@@ -768,66 +467,7 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
768
467
|
cast_to=Span,
|
|
769
468
|
)
|
|
770
469
|
|
|
771
|
-
def
|
|
772
|
-
self,
|
|
773
|
-
*,
|
|
774
|
-
ending_before: str | NotGiven = NOT_GIVEN,
|
|
775
|
-
from_ts: int | NotGiven = NOT_GIVEN,
|
|
776
|
-
limit: int | NotGiven = NOT_GIVEN,
|
|
777
|
-
parents_only: bool | NotGiven = NOT_GIVEN,
|
|
778
|
-
sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
779
|
-
starting_after: str | NotGiven = NOT_GIVEN,
|
|
780
|
-
to_ts: int | NotGiven = NOT_GIVEN,
|
|
781
|
-
trace_id: str | NotGiven = NOT_GIVEN,
|
|
782
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
783
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
784
|
-
extra_headers: Headers | None = None,
|
|
785
|
-
extra_query: Query | None = None,
|
|
786
|
-
extra_body: Body | None = None,
|
|
787
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
788
|
-
) -> AsyncPaginator[Span, AsyncCursorPage[Span]]:
|
|
789
|
-
"""
|
|
790
|
-
List Spans
|
|
791
|
-
|
|
792
|
-
Args:
|
|
793
|
-
from_ts: The starting (oldest) timestamp window in seconds.
|
|
794
|
-
|
|
795
|
-
to_ts: The ending (most recent) timestamp in seconds.
|
|
796
|
-
|
|
797
|
-
extra_headers: Send extra headers
|
|
798
|
-
|
|
799
|
-
extra_query: Add additional query parameters to the request
|
|
800
|
-
|
|
801
|
-
extra_body: Add additional JSON properties to the request
|
|
802
|
-
|
|
803
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
804
|
-
"""
|
|
805
|
-
return self._get_api_list(
|
|
806
|
-
"/v5/spans",
|
|
807
|
-
page=AsyncCursorPage[Span],
|
|
808
|
-
options=make_request_options(
|
|
809
|
-
extra_headers=extra_headers,
|
|
810
|
-
extra_query=extra_query,
|
|
811
|
-
extra_body=extra_body,
|
|
812
|
-
timeout=timeout,
|
|
813
|
-
query=maybe_transform(
|
|
814
|
-
{
|
|
815
|
-
"ending_before": ending_before,
|
|
816
|
-
"from_ts": from_ts,
|
|
817
|
-
"limit": limit,
|
|
818
|
-
"parents_only": parents_only,
|
|
819
|
-
"sort_order": sort_order,
|
|
820
|
-
"starting_after": starting_after,
|
|
821
|
-
"to_ts": to_ts,
|
|
822
|
-
"trace_id": trace_id,
|
|
823
|
-
},
|
|
824
|
-
span_list_params.SpanListParams,
|
|
825
|
-
),
|
|
826
|
-
),
|
|
827
|
-
model=Span,
|
|
828
|
-
)
|
|
829
|
-
|
|
830
|
-
def batch(
|
|
470
|
+
async def batch(
|
|
831
471
|
self,
|
|
832
472
|
*,
|
|
833
473
|
items: Iterable[span_batch_params.Item],
|
|
@@ -837,7 +477,7 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
837
477
|
extra_query: Query | None = None,
|
|
838
478
|
extra_body: Body | None = None,
|
|
839
479
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
840
|
-
) ->
|
|
480
|
+
) -> SpanBatchResponse:
|
|
841
481
|
"""
|
|
842
482
|
Create Spans in Batch
|
|
843
483
|
|
|
@@ -850,15 +490,13 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
850
490
|
|
|
851
491
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
852
492
|
"""
|
|
853
|
-
return self.
|
|
493
|
+
return await self._post(
|
|
854
494
|
"/v5/spans/batch",
|
|
855
|
-
|
|
856
|
-
body=maybe_transform({"items": items}, span_batch_params.SpanBatchParams),
|
|
495
|
+
body=await async_maybe_transform({"items": items}, span_batch_params.SpanBatchParams),
|
|
857
496
|
options=make_request_options(
|
|
858
497
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
859
498
|
),
|
|
860
|
-
|
|
861
|
-
method="post",
|
|
499
|
+
cast_to=SpanBatchResponse,
|
|
862
500
|
)
|
|
863
501
|
|
|
864
502
|
|
|
@@ -875,9 +513,6 @@ class SpansResourceWithRawResponse:
|
|
|
875
513
|
self.update = to_raw_response_wrapper(
|
|
876
514
|
spans.update,
|
|
877
515
|
)
|
|
878
|
-
self.list = to_raw_response_wrapper(
|
|
879
|
-
spans.list,
|
|
880
|
-
)
|
|
881
516
|
self.batch = to_raw_response_wrapper(
|
|
882
517
|
spans.batch,
|
|
883
518
|
)
|
|
@@ -896,9 +531,6 @@ class AsyncSpansResourceWithRawResponse:
|
|
|
896
531
|
self.update = async_to_raw_response_wrapper(
|
|
897
532
|
spans.update,
|
|
898
533
|
)
|
|
899
|
-
self.list = async_to_raw_response_wrapper(
|
|
900
|
-
spans.list,
|
|
901
|
-
)
|
|
902
534
|
self.batch = async_to_raw_response_wrapper(
|
|
903
535
|
spans.batch,
|
|
904
536
|
)
|
|
@@ -917,9 +549,6 @@ class SpansResourceWithStreamingResponse:
|
|
|
917
549
|
self.update = to_streamed_response_wrapper(
|
|
918
550
|
spans.update,
|
|
919
551
|
)
|
|
920
|
-
self.list = to_streamed_response_wrapper(
|
|
921
|
-
spans.list,
|
|
922
|
-
)
|
|
923
552
|
self.batch = to_streamed_response_wrapper(
|
|
924
553
|
spans.batch,
|
|
925
554
|
)
|
|
@@ -938,9 +567,6 @@ class AsyncSpansResourceWithStreamingResponse:
|
|
|
938
567
|
self.update = async_to_streamed_response_wrapper(
|
|
939
568
|
spans.update,
|
|
940
569
|
)
|
|
941
|
-
self.list = async_to_streamed_response_wrapper(
|
|
942
|
-
spans.list,
|
|
943
|
-
)
|
|
944
570
|
self.batch = async_to_streamed_response_wrapper(
|
|
945
571
|
spans.batch,
|
|
946
572
|
)
|
scale_gp_beta/types/__init__.py
CHANGED
|
@@ -18,7 +18,6 @@ from .evaluation_item import EvaluationItem as EvaluationItem
|
|
|
18
18
|
from .evaluation_task import EvaluationTask as EvaluationTask
|
|
19
19
|
from .inference_model import InferenceModel as InferenceModel
|
|
20
20
|
from .file_list_params import FileListParams as FileListParams
|
|
21
|
-
from .span_list_params import SpanListParams as SpanListParams
|
|
22
21
|
from .model_list_params import ModelListParams as ModelListParams
|
|
23
22
|
from .span_batch_params import SpanBatchParams as SpanBatchParams
|
|
24
23
|
from .file_create_params import FileCreateParams as FileCreateParams
|
|
@@ -29,6 +28,7 @@ from .span_update_params import SpanUpdateParams as SpanUpdateParams
|
|
|
29
28
|
from .dataset_list_params import DatasetListParams as DatasetListParams
|
|
30
29
|
from .model_create_params import ModelCreateParams as ModelCreateParams
|
|
31
30
|
from .model_update_params import ModelUpdateParams as ModelUpdateParams
|
|
31
|
+
from .span_batch_response import SpanBatchResponse as SpanBatchResponse
|
|
32
32
|
from .file_delete_response import FileDeleteResponse as FileDeleteResponse
|
|
33
33
|
from .inference_model_list import InferenceModelList as InferenceModelList
|
|
34
34
|
from .dataset_create_params import DatasetCreateParams as DatasetCreateParams
|
|
@@ -54,3 +54,4 @@ from .dataset_item_delete_response import DatasetItemDeleteResponse as DatasetIt
|
|
|
54
54
|
from .dataset_item_retrieve_params import DatasetItemRetrieveParams as DatasetItemRetrieveParams
|
|
55
55
|
from .evaluation_item_retrieve_params import EvaluationItemRetrieveParams as EvaluationItemRetrieveParams
|
|
56
56
|
from .dataset_item_batch_create_params import DatasetItemBatchCreateParams as DatasetItemBatchCreateParams
|
|
57
|
+
from .dataset_item_batch_create_response import DatasetItemBatchCreateResponse as DatasetItemBatchCreateResponse
|
|
@@ -10,13 +10,13 @@ __all__ = ["ModelDefinition"]
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class ModelDefinition(BaseModel):
|
|
13
|
-
|
|
13
|
+
name: str = FieldInfo(alias="model_name")
|
|
14
14
|
"""model name, for example `gpt-4o`"""
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
type: Literal["generic", "completion", "chat_completion"] = FieldInfo(alias="model_type")
|
|
17
17
|
"""model type, for example `chat_completion`"""
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
vendor: Literal[
|
|
20
20
|
"openai",
|
|
21
21
|
"cohere",
|
|
22
22
|
"vertex_ai",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
from .dataset_item import DatasetItem
|
|
8
|
+
|
|
9
|
+
__all__ = ["DatasetItemBatchCreateResponse"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class DatasetItemBatchCreateResponse(BaseModel):
|
|
13
|
+
items: List[DatasetItem]
|
|
14
|
+
|
|
15
|
+
object: Optional[Literal["list"]] = None
|