scale-gp-beta 0.1.0a13__py3-none-any.whl → 0.1.0a15__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/_version.py +1 -1
- scale_gp_beta/pagination.py +57 -1
- scale_gp_beta/resources/chat/completions.py +14 -13
- scale_gp_beta/resources/dataset_items.py +18 -10
- scale_gp_beta/resources/datasets.py +5 -0
- scale_gp_beta/resources/evaluation_items.py +6 -0
- scale_gp_beta/resources/evaluations.py +4 -0
- scale_gp_beta/resources/files/files.py +5 -0
- scale_gp_beta/resources/models.py +4 -0
- scale_gp_beta/resources/spans.py +277 -9
- scale_gp_beta/types/__init__.py +1 -1
- scale_gp_beta/types/chat/__init__.py +1 -0
- scale_gp_beta/types/chat/completion_models_params.py +2 -0
- scale_gp_beta/types/{dataset_item_batch_create_response.py → chat/completion_models_response.py} +5 -5
- scale_gp_beta/types/chat/model_definition.py +3 -3
- scale_gp_beta/types/dataset_item.py +2 -0
- scale_gp_beta/types/dataset_item_list_params.py +3 -1
- scale_gp_beta/types/dataset_list_params.py +3 -1
- scale_gp_beta/types/evaluation_item_list_params.py +3 -1
- scale_gp_beta/types/evaluation_list_params.py +2 -0
- scale_gp_beta/types/evaluation_task.py +9 -5
- scale_gp_beta/types/evaluation_task_param.py +5 -3
- scale_gp_beta/types/file_list_params.py +3 -1
- scale_gp_beta/types/inference_model.py +5 -5
- scale_gp_beta/types/model_list_params.py +2 -0
- scale_gp_beta/types/span_batch_params.py +130 -0
- scale_gp_beta/types/span_create_params.py +62 -2
- scale_gp_beta/types/span_list_params.py +3 -1
- {scale_gp_beta-0.1.0a13.dist-info → scale_gp_beta-0.1.0a15.dist-info}/METADATA +1 -1
- {scale_gp_beta-0.1.0a13.dist-info → scale_gp_beta-0.1.0a15.dist-info}/RECORD +32 -31
- {scale_gp_beta-0.1.0a13.dist-info → scale_gp_beta-0.1.0a15.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a13.dist-info → scale_gp_beta-0.1.0a15.dist-info}/licenses/LICENSE +0 -0
scale_gp_beta/resources/spans.py
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict, Union
|
|
5
|
+
from typing import Dict, Union, Iterable
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
from typing_extensions import Literal, overload
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
|
|
11
|
-
from ..types import span_list_params, span_create_params, span_update_params
|
|
11
|
+
from ..types import span_list_params, span_batch_params, span_create_params, span_update_params
|
|
12
12
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
13
13
|
from .._utils import required_args, maybe_transform, async_maybe_transform
|
|
14
14
|
from .._compat import cached_property
|
|
@@ -19,7 +19,7 @@ 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
|
|
22
|
+
from ..pagination import SyncCursorPage, AsyncCursorPage, SyncAPIListPage, AsyncAPIListPage
|
|
23
23
|
from ..types.span import Span
|
|
24
24
|
from .._base_client import AsyncPaginator, make_request_options
|
|
25
25
|
|
|
@@ -53,13 +53,42 @@ class SpansResource(SyncAPIResource):
|
|
|
53
53
|
name: str,
|
|
54
54
|
start_timestamp: Union[str, datetime],
|
|
55
55
|
trace_id: str,
|
|
56
|
+
id: str | NotGiven = NOT_GIVEN,
|
|
56
57
|
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
57
58
|
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
58
59
|
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
59
60
|
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
60
61
|
parent_id: str | NotGiven = NOT_GIVEN,
|
|
61
62
|
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
62
|
-
type:
|
|
63
|
+
type: Literal[
|
|
64
|
+
"TEXT_INPUT",
|
|
65
|
+
"TEXT_OUTPUT",
|
|
66
|
+
"COMPLETION_INPUT",
|
|
67
|
+
"COMPLETION",
|
|
68
|
+
"KB_RETRIEVAL",
|
|
69
|
+
"KB_INPUT",
|
|
70
|
+
"RERANKING",
|
|
71
|
+
"EXTERNAL_ENDPOINT",
|
|
72
|
+
"PROMPT_ENGINEERING",
|
|
73
|
+
"DOCUMENT_INPUT",
|
|
74
|
+
"MAP_REDUCE",
|
|
75
|
+
"DOCUMENT_SEARCH",
|
|
76
|
+
"DOCUMENT_PROMPT",
|
|
77
|
+
"CUSTOM",
|
|
78
|
+
"INPUT_GUARDRAIL",
|
|
79
|
+
"OUTPUT_GUARDRAIL",
|
|
80
|
+
"CODE_EXECUTION",
|
|
81
|
+
"DATA_MANIPULATION",
|
|
82
|
+
"EVALUATION",
|
|
83
|
+
"FILE_RETRIEVAL",
|
|
84
|
+
"KB_ADD_CHUNK",
|
|
85
|
+
"KB_MANAGEMENT",
|
|
86
|
+
"TRACER",
|
|
87
|
+
"AGENT_TRACER",
|
|
88
|
+
"AGENT_WORKFLOW",
|
|
89
|
+
"STANDALONE",
|
|
90
|
+
]
|
|
91
|
+
| NotGiven = NOT_GIVEN,
|
|
63
92
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
64
93
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
65
94
|
extra_headers: Headers | None = None,
|
|
@@ -73,6 +102,8 @@ class SpansResource(SyncAPIResource):
|
|
|
73
102
|
Args:
|
|
74
103
|
trace_id: id for grouping traces together, uuid is recommended
|
|
75
104
|
|
|
105
|
+
id: The id of the span
|
|
106
|
+
|
|
76
107
|
parent_id: Reference to a parent span_id
|
|
77
108
|
|
|
78
109
|
extra_headers: Send extra headers
|
|
@@ -94,13 +125,42 @@ class SpansResource(SyncAPIResource):
|
|
|
94
125
|
name: str,
|
|
95
126
|
start_timestamp: Union[str, datetime],
|
|
96
127
|
trace_id: str,
|
|
128
|
+
id: str | NotGiven = NOT_GIVEN,
|
|
97
129
|
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
98
130
|
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
99
131
|
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
100
132
|
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
101
133
|
parent_id: str | NotGiven = NOT_GIVEN,
|
|
102
134
|
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
103
|
-
type:
|
|
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,
|
|
104
164
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
105
165
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
106
166
|
extra_headers: Headers | None = None,
|
|
@@ -114,6 +174,8 @@ class SpansResource(SyncAPIResource):
|
|
|
114
174
|
Args:
|
|
115
175
|
trace_id: id for grouping traces together, uuid is recommended
|
|
116
176
|
|
|
177
|
+
id: The id of the span
|
|
178
|
+
|
|
117
179
|
parent_id: Reference to a parent span_id
|
|
118
180
|
|
|
119
181
|
extra_headers: Send extra headers
|
|
@@ -136,13 +198,42 @@ class SpansResource(SyncAPIResource):
|
|
|
136
198
|
name: str,
|
|
137
199
|
start_timestamp: Union[str, datetime],
|
|
138
200
|
trace_id: str,
|
|
201
|
+
id: str | NotGiven = NOT_GIVEN,
|
|
139
202
|
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
140
203
|
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
141
204
|
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
142
205
|
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
143
206
|
parent_id: str | NotGiven = NOT_GIVEN,
|
|
144
207
|
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
145
|
-
type:
|
|
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,
|
|
146
237
|
application_interaction_id: str | NotGiven = NOT_GIVEN,
|
|
147
238
|
application_variant_id: str | NotGiven = NOT_GIVEN,
|
|
148
239
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -159,6 +250,7 @@ class SpansResource(SyncAPIResource):
|
|
|
159
250
|
"name": name,
|
|
160
251
|
"start_timestamp": start_timestamp,
|
|
161
252
|
"trace_id": trace_id,
|
|
253
|
+
"id": id,
|
|
162
254
|
"end_timestamp": end_timestamp,
|
|
163
255
|
"input": input,
|
|
164
256
|
"metadata": metadata,
|
|
@@ -265,6 +357,7 @@ class SpansResource(SyncAPIResource):
|
|
|
265
357
|
from_ts: int | NotGiven = NOT_GIVEN,
|
|
266
358
|
limit: int | NotGiven = NOT_GIVEN,
|
|
267
359
|
parents_only: bool | NotGiven = NOT_GIVEN,
|
|
360
|
+
sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
268
361
|
starting_after: str | NotGiven = NOT_GIVEN,
|
|
269
362
|
to_ts: int | NotGiven = NOT_GIVEN,
|
|
270
363
|
trace_id: str | NotGiven = NOT_GIVEN,
|
|
@@ -305,6 +398,7 @@ class SpansResource(SyncAPIResource):
|
|
|
305
398
|
"from_ts": from_ts,
|
|
306
399
|
"limit": limit,
|
|
307
400
|
"parents_only": parents_only,
|
|
401
|
+
"sort_order": sort_order,
|
|
308
402
|
"starting_after": starting_after,
|
|
309
403
|
"to_ts": to_ts,
|
|
310
404
|
"trace_id": trace_id,
|
|
@@ -315,6 +409,40 @@ class SpansResource(SyncAPIResource):
|
|
|
315
409
|
model=Span,
|
|
316
410
|
)
|
|
317
411
|
|
|
412
|
+
def batch(
|
|
413
|
+
self,
|
|
414
|
+
*,
|
|
415
|
+
items: Iterable[span_batch_params.Item],
|
|
416
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
417
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
418
|
+
extra_headers: Headers | None = None,
|
|
419
|
+
extra_query: Query | None = None,
|
|
420
|
+
extra_body: Body | None = None,
|
|
421
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
422
|
+
) -> SyncAPIListPage[Span]:
|
|
423
|
+
"""
|
|
424
|
+
Create Spans in Batch
|
|
425
|
+
|
|
426
|
+
Args:
|
|
427
|
+
extra_headers: Send extra headers
|
|
428
|
+
|
|
429
|
+
extra_query: Add additional query parameters to the request
|
|
430
|
+
|
|
431
|
+
extra_body: Add additional JSON properties to the request
|
|
432
|
+
|
|
433
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
434
|
+
"""
|
|
435
|
+
return self._get_api_list(
|
|
436
|
+
"/v5/spans/batch",
|
|
437
|
+
page=SyncAPIListPage[Span],
|
|
438
|
+
body=maybe_transform({"items": items}, span_batch_params.SpanBatchParams),
|
|
439
|
+
options=make_request_options(
|
|
440
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
441
|
+
),
|
|
442
|
+
model=Span,
|
|
443
|
+
method="post",
|
|
444
|
+
)
|
|
445
|
+
|
|
318
446
|
|
|
319
447
|
class AsyncSpansResource(AsyncAPIResource):
|
|
320
448
|
@cached_property
|
|
@@ -343,13 +471,42 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
343
471
|
name: str,
|
|
344
472
|
start_timestamp: Union[str, datetime],
|
|
345
473
|
trace_id: str,
|
|
474
|
+
id: str | NotGiven = NOT_GIVEN,
|
|
346
475
|
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
347
476
|
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
348
477
|
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
349
478
|
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
350
479
|
parent_id: str | NotGiven = NOT_GIVEN,
|
|
351
480
|
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
352
|
-
type:
|
|
481
|
+
type: Literal[
|
|
482
|
+
"TEXT_INPUT",
|
|
483
|
+
"TEXT_OUTPUT",
|
|
484
|
+
"COMPLETION_INPUT",
|
|
485
|
+
"COMPLETION",
|
|
486
|
+
"KB_RETRIEVAL",
|
|
487
|
+
"KB_INPUT",
|
|
488
|
+
"RERANKING",
|
|
489
|
+
"EXTERNAL_ENDPOINT",
|
|
490
|
+
"PROMPT_ENGINEERING",
|
|
491
|
+
"DOCUMENT_INPUT",
|
|
492
|
+
"MAP_REDUCE",
|
|
493
|
+
"DOCUMENT_SEARCH",
|
|
494
|
+
"DOCUMENT_PROMPT",
|
|
495
|
+
"CUSTOM",
|
|
496
|
+
"INPUT_GUARDRAIL",
|
|
497
|
+
"OUTPUT_GUARDRAIL",
|
|
498
|
+
"CODE_EXECUTION",
|
|
499
|
+
"DATA_MANIPULATION",
|
|
500
|
+
"EVALUATION",
|
|
501
|
+
"FILE_RETRIEVAL",
|
|
502
|
+
"KB_ADD_CHUNK",
|
|
503
|
+
"KB_MANAGEMENT",
|
|
504
|
+
"TRACER",
|
|
505
|
+
"AGENT_TRACER",
|
|
506
|
+
"AGENT_WORKFLOW",
|
|
507
|
+
"STANDALONE",
|
|
508
|
+
]
|
|
509
|
+
| NotGiven = NOT_GIVEN,
|
|
353
510
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
354
511
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
355
512
|
extra_headers: Headers | None = None,
|
|
@@ -363,6 +520,8 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
363
520
|
Args:
|
|
364
521
|
trace_id: id for grouping traces together, uuid is recommended
|
|
365
522
|
|
|
523
|
+
id: The id of the span
|
|
524
|
+
|
|
366
525
|
parent_id: Reference to a parent span_id
|
|
367
526
|
|
|
368
527
|
extra_headers: Send extra headers
|
|
@@ -384,13 +543,42 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
384
543
|
name: str,
|
|
385
544
|
start_timestamp: Union[str, datetime],
|
|
386
545
|
trace_id: str,
|
|
546
|
+
id: str | NotGiven = NOT_GIVEN,
|
|
387
547
|
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
388
548
|
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
389
549
|
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
390
550
|
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
391
551
|
parent_id: str | NotGiven = NOT_GIVEN,
|
|
392
552
|
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
393
|
-
type:
|
|
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,
|
|
394
582
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
395
583
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
396
584
|
extra_headers: Headers | None = None,
|
|
@@ -404,6 +592,8 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
404
592
|
Args:
|
|
405
593
|
trace_id: id for grouping traces together, uuid is recommended
|
|
406
594
|
|
|
595
|
+
id: The id of the span
|
|
596
|
+
|
|
407
597
|
parent_id: Reference to a parent span_id
|
|
408
598
|
|
|
409
599
|
extra_headers: Send extra headers
|
|
@@ -426,13 +616,42 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
426
616
|
name: str,
|
|
427
617
|
start_timestamp: Union[str, datetime],
|
|
428
618
|
trace_id: str,
|
|
619
|
+
id: str | NotGiven = NOT_GIVEN,
|
|
429
620
|
end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
|
430
621
|
input: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
431
622
|
metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
432
623
|
output: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
433
624
|
parent_id: str | NotGiven = NOT_GIVEN,
|
|
434
625
|
status: Literal["SUCCESS", "ERROR"] | NotGiven = NOT_GIVEN,
|
|
435
|
-
type:
|
|
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,
|
|
436
655
|
application_interaction_id: str | NotGiven = NOT_GIVEN,
|
|
437
656
|
application_variant_id: str | NotGiven = NOT_GIVEN,
|
|
438
657
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -449,6 +668,7 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
449
668
|
"name": name,
|
|
450
669
|
"start_timestamp": start_timestamp,
|
|
451
670
|
"trace_id": trace_id,
|
|
671
|
+
"id": id,
|
|
452
672
|
"end_timestamp": end_timestamp,
|
|
453
673
|
"input": input,
|
|
454
674
|
"metadata": metadata,
|
|
@@ -555,6 +775,7 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
555
775
|
from_ts: int | NotGiven = NOT_GIVEN,
|
|
556
776
|
limit: int | NotGiven = NOT_GIVEN,
|
|
557
777
|
parents_only: bool | NotGiven = NOT_GIVEN,
|
|
778
|
+
sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
558
779
|
starting_after: str | NotGiven = NOT_GIVEN,
|
|
559
780
|
to_ts: int | NotGiven = NOT_GIVEN,
|
|
560
781
|
trace_id: str | NotGiven = NOT_GIVEN,
|
|
@@ -595,6 +816,7 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
595
816
|
"from_ts": from_ts,
|
|
596
817
|
"limit": limit,
|
|
597
818
|
"parents_only": parents_only,
|
|
819
|
+
"sort_order": sort_order,
|
|
598
820
|
"starting_after": starting_after,
|
|
599
821
|
"to_ts": to_ts,
|
|
600
822
|
"trace_id": trace_id,
|
|
@@ -605,6 +827,40 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
605
827
|
model=Span,
|
|
606
828
|
)
|
|
607
829
|
|
|
830
|
+
def batch(
|
|
831
|
+
self,
|
|
832
|
+
*,
|
|
833
|
+
items: Iterable[span_batch_params.Item],
|
|
834
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
835
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
836
|
+
extra_headers: Headers | None = None,
|
|
837
|
+
extra_query: Query | None = None,
|
|
838
|
+
extra_body: Body | None = None,
|
|
839
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
840
|
+
) -> AsyncPaginator[Span, AsyncAPIListPage[Span]]:
|
|
841
|
+
"""
|
|
842
|
+
Create Spans in Batch
|
|
843
|
+
|
|
844
|
+
Args:
|
|
845
|
+
extra_headers: Send extra headers
|
|
846
|
+
|
|
847
|
+
extra_query: Add additional query parameters to the request
|
|
848
|
+
|
|
849
|
+
extra_body: Add additional JSON properties to the request
|
|
850
|
+
|
|
851
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
852
|
+
"""
|
|
853
|
+
return self._get_api_list(
|
|
854
|
+
"/v5/spans/batch",
|
|
855
|
+
page=AsyncAPIListPage[Span],
|
|
856
|
+
body=maybe_transform({"items": items}, span_batch_params.SpanBatchParams),
|
|
857
|
+
options=make_request_options(
|
|
858
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
859
|
+
),
|
|
860
|
+
model=Span,
|
|
861
|
+
method="post",
|
|
862
|
+
)
|
|
863
|
+
|
|
608
864
|
|
|
609
865
|
class SpansResourceWithRawResponse:
|
|
610
866
|
def __init__(self, spans: SpansResource) -> None:
|
|
@@ -622,6 +878,9 @@ class SpansResourceWithRawResponse:
|
|
|
622
878
|
self.list = to_raw_response_wrapper(
|
|
623
879
|
spans.list,
|
|
624
880
|
)
|
|
881
|
+
self.batch = to_raw_response_wrapper(
|
|
882
|
+
spans.batch,
|
|
883
|
+
)
|
|
625
884
|
|
|
626
885
|
|
|
627
886
|
class AsyncSpansResourceWithRawResponse:
|
|
@@ -640,6 +899,9 @@ class AsyncSpansResourceWithRawResponse:
|
|
|
640
899
|
self.list = async_to_raw_response_wrapper(
|
|
641
900
|
spans.list,
|
|
642
901
|
)
|
|
902
|
+
self.batch = async_to_raw_response_wrapper(
|
|
903
|
+
spans.batch,
|
|
904
|
+
)
|
|
643
905
|
|
|
644
906
|
|
|
645
907
|
class SpansResourceWithStreamingResponse:
|
|
@@ -658,6 +920,9 @@ class SpansResourceWithStreamingResponse:
|
|
|
658
920
|
self.list = to_streamed_response_wrapper(
|
|
659
921
|
spans.list,
|
|
660
922
|
)
|
|
923
|
+
self.batch = to_streamed_response_wrapper(
|
|
924
|
+
spans.batch,
|
|
925
|
+
)
|
|
661
926
|
|
|
662
927
|
|
|
663
928
|
class AsyncSpansResourceWithStreamingResponse:
|
|
@@ -676,3 +941,6 @@ class AsyncSpansResourceWithStreamingResponse:
|
|
|
676
941
|
self.list = async_to_streamed_response_wrapper(
|
|
677
942
|
spans.list,
|
|
678
943
|
)
|
|
944
|
+
self.batch = async_to_streamed_response_wrapper(
|
|
945
|
+
spans.batch,
|
|
946
|
+
)
|
scale_gp_beta/types/__init__.py
CHANGED
|
@@ -20,6 +20,7 @@ from .inference_model import InferenceModel as InferenceModel
|
|
|
20
20
|
from .file_list_params import FileListParams as FileListParams
|
|
21
21
|
from .span_list_params import SpanListParams as SpanListParams
|
|
22
22
|
from .model_list_params import ModelListParams as ModelListParams
|
|
23
|
+
from .span_batch_params import SpanBatchParams as SpanBatchParams
|
|
23
24
|
from .file_create_params import FileCreateParams as FileCreateParams
|
|
24
25
|
from .file_update_params import FileUpdateParams as FileUpdateParams
|
|
25
26
|
from .inference_response import InferenceResponse as InferenceResponse
|
|
@@ -53,4 +54,3 @@ from .dataset_item_delete_response import DatasetItemDeleteResponse as DatasetIt
|
|
|
53
54
|
from .dataset_item_retrieve_params import DatasetItemRetrieveParams as DatasetItemRetrieveParams
|
|
54
55
|
from .evaluation_item_retrieve_params import EvaluationItemRetrieveParams as EvaluationItemRetrieveParams
|
|
55
56
|
from .dataset_item_batch_create_params import DatasetItemBatchCreateParams as DatasetItemBatchCreateParams
|
|
56
|
-
from .dataset_item_batch_create_response import DatasetItemBatchCreateResponse as DatasetItemBatchCreateResponse
|
|
@@ -8,3 +8,4 @@ from .chat_completion_chunk import ChatCompletionChunk as ChatCompletionChunk
|
|
|
8
8
|
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
|
|
9
9
|
from .completion_models_params import CompletionModelsParams as CompletionModelsParams
|
|
10
10
|
from .completion_create_response import CompletionCreateResponse as CompletionCreateResponse
|
|
11
|
+
from .completion_models_response import CompletionModelsResponse as CompletionModelsResponse
|
scale_gp_beta/types/{dataset_item_batch_create_response.py → chat/completion_models_response.py}
RENAMED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
from typing import List, Optional
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from .
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
from .model_definition import ModelDefinition
|
|
8
8
|
|
|
9
|
-
__all__ = ["
|
|
9
|
+
__all__ = ["CompletionModelsResponse"]
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class
|
|
13
|
-
items: List[
|
|
12
|
+
class CompletionModelsResponse(BaseModel):
|
|
13
|
+
items: List[ModelDefinition]
|
|
14
14
|
|
|
15
15
|
object: Optional[Literal["list"]] = None
|
|
@@ -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",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing_extensions import TypedDict
|
|
5
|
+
from typing_extensions import Literal, TypedDict
|
|
6
6
|
|
|
7
7
|
__all__ = ["DatasetItemListParams"]
|
|
8
8
|
|
|
@@ -20,6 +20,8 @@ class DatasetItemListParams(TypedDict, total=False):
|
|
|
20
20
|
|
|
21
21
|
limit: int
|
|
22
22
|
|
|
23
|
+
sort_order: Literal["asc", "desc"]
|
|
24
|
+
|
|
23
25
|
starting_after: str
|
|
24
26
|
|
|
25
27
|
version: int
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from typing import List
|
|
6
|
-
from typing_extensions import TypedDict
|
|
6
|
+
from typing_extensions import Literal, TypedDict
|
|
7
7
|
|
|
8
8
|
__all__ = ["DatasetListParams"]
|
|
9
9
|
|
|
@@ -17,6 +17,8 @@ class DatasetListParams(TypedDict, total=False):
|
|
|
17
17
|
|
|
18
18
|
name: str
|
|
19
19
|
|
|
20
|
+
sort_order: Literal["asc", "desc"]
|
|
21
|
+
|
|
20
22
|
starting_after: str
|
|
21
23
|
|
|
22
24
|
tags: List[str]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing_extensions import TypedDict
|
|
5
|
+
from typing_extensions import Literal, TypedDict
|
|
6
6
|
|
|
7
7
|
__all__ = ["EvaluationItemListParams"]
|
|
8
8
|
|
|
@@ -16,4 +16,6 @@ class EvaluationItemListParams(TypedDict, total=False):
|
|
|
16
16
|
|
|
17
17
|
limit: int
|
|
18
18
|
|
|
19
|
+
sort_order: Literal["asc", "desc"]
|
|
20
|
+
|
|
19
21
|
starting_after: str
|
|
@@ -20,7 +20,7 @@ __all__ = [
|
|
|
20
20
|
"GenericInferenceEvaluationTaskConfigurationInferenceConfigurationLaunchInferenceConfiguration",
|
|
21
21
|
"ApplicationVariantV1EvaluationTask",
|
|
22
22
|
"ApplicationVariantV1EvaluationTaskConfiguration",
|
|
23
|
-
"
|
|
23
|
+
"ApplicationVariantV1EvaluationTaskConfigurationHistoryApplicationRequestResponsePairArray",
|
|
24
24
|
"ApplicationVariantV1EvaluationTaskConfigurationOverrides",
|
|
25
25
|
"ApplicationVariantV1EvaluationTaskConfigurationOverridesAgenticApplicationOverrides",
|
|
26
26
|
"ApplicationVariantV1EvaluationTaskConfigurationOverridesAgenticApplicationOverridesInitialState",
|
|
@@ -140,7 +140,7 @@ class GenericInferenceEvaluationTask(BaseModel):
|
|
|
140
140
|
task_type: Optional[Literal["inference"]] = None
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
class
|
|
143
|
+
class ApplicationVariantV1EvaluationTaskConfigurationHistoryApplicationRequestResponsePairArray(BaseModel):
|
|
144
144
|
request: str
|
|
145
145
|
"""Request inputs"""
|
|
146
146
|
|
|
@@ -201,7 +201,11 @@ class ApplicationVariantV1EvaluationTaskConfiguration(BaseModel):
|
|
|
201
201
|
|
|
202
202
|
inputs: Union[Dict[str, object], ItemLocator]
|
|
203
203
|
|
|
204
|
-
history: Union[
|
|
204
|
+
history: Union[
|
|
205
|
+
List[ApplicationVariantV1EvaluationTaskConfigurationHistoryApplicationRequestResponsePairArray],
|
|
206
|
+
ItemLocator,
|
|
207
|
+
None,
|
|
208
|
+
] = None
|
|
205
209
|
|
|
206
210
|
operation_metadata: Union[Dict[str, object], ItemLocator, None] = None
|
|
207
211
|
|
|
@@ -362,7 +366,7 @@ if PYDANTIC_V2:
|
|
|
362
366
|
GenericInferenceEvaluationTaskConfigurationInferenceConfigurationLaunchInferenceConfiguration.model_rebuild()
|
|
363
367
|
ApplicationVariantV1EvaluationTask.model_rebuild()
|
|
364
368
|
ApplicationVariantV1EvaluationTaskConfiguration.model_rebuild()
|
|
365
|
-
|
|
369
|
+
ApplicationVariantV1EvaluationTaskConfigurationHistoryApplicationRequestResponsePairArray.model_rebuild()
|
|
366
370
|
ApplicationVariantV1EvaluationTaskConfigurationOverridesAgenticApplicationOverrides.model_rebuild()
|
|
367
371
|
ApplicationVariantV1EvaluationTaskConfigurationOverridesAgenticApplicationOverridesInitialState.model_rebuild()
|
|
368
372
|
ApplicationVariantV1EvaluationTaskConfigurationOverridesAgenticApplicationOverridesPartialTrace.model_rebuild()
|
|
@@ -386,7 +390,7 @@ else:
|
|
|
386
390
|
GenericInferenceEvaluationTaskConfigurationInferenceConfigurationLaunchInferenceConfiguration.update_forward_refs() # type: ignore
|
|
387
391
|
ApplicationVariantV1EvaluationTask.update_forward_refs() # type: ignore
|
|
388
392
|
ApplicationVariantV1EvaluationTaskConfiguration.update_forward_refs() # type: ignore
|
|
389
|
-
|
|
393
|
+
ApplicationVariantV1EvaluationTaskConfigurationHistoryApplicationRequestResponsePairArray.update_forward_refs() # type: ignore
|
|
390
394
|
ApplicationVariantV1EvaluationTaskConfigurationOverridesAgenticApplicationOverrides.update_forward_refs() # type: ignore
|
|
391
395
|
ApplicationVariantV1EvaluationTaskConfigurationOverridesAgenticApplicationOverridesInitialState.update_forward_refs() # type: ignore
|
|
392
396
|
ApplicationVariantV1EvaluationTaskConfigurationOverridesAgenticApplicationOverridesPartialTrace.update_forward_refs() # type: ignore
|