scale-gp-beta 0.1.0a9__py3-none-any.whl → 0.1.0a11__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.
Files changed (33) hide show
  1. scale_gp_beta/_base_client.py +207 -233
  2. scale_gp_beta/_client.py +10 -5
  3. scale_gp_beta/_models.py +2 -3
  4. scale_gp_beta/_response.py +1 -1
  5. scale_gp_beta/_utils/_transform.py +46 -1
  6. scale_gp_beta/_utils/_typing.py +3 -1
  7. scale_gp_beta/_utils/_utils.py +9 -1
  8. scale_gp_beta/_version.py +1 -1
  9. scale_gp_beta/resources/__init__.py +14 -0
  10. scale_gp_beta/resources/chat/completions.py +7 -7
  11. scale_gp_beta/resources/completions.py +7 -7
  12. scale_gp_beta/resources/dataset_items.py +1 -4
  13. scale_gp_beta/resources/datasets.py +19 -11
  14. scale_gp_beta/resources/evaluation_items.py +1 -4
  15. scale_gp_beta/resources/evaluations.py +23 -5
  16. scale_gp_beta/resources/files/files.py +1 -6
  17. scale_gp_beta/resources/inference.py +1 -4
  18. scale_gp_beta/resources/models.py +1 -5
  19. scale_gp_beta/resources/spans.py +658 -0
  20. scale_gp_beta/types/__init__.py +4 -0
  21. scale_gp_beta/types/dataset.py +4 -1
  22. scale_gp_beta/types/dataset_create_params.py +4 -1
  23. scale_gp_beta/types/dataset_update_params.py +4 -0
  24. scale_gp_beta/types/evaluation.py +3 -0
  25. scale_gp_beta/types/evaluation_create_params.py +12 -0
  26. scale_gp_beta/types/span.py +38 -0
  27. scale_gp_beta/types/span_create_params.py +58 -0
  28. scale_gp_beta/types/span_list_params.py +26 -0
  29. scale_gp_beta/types/span_update_params.py +21 -0
  30. {scale_gp_beta-0.1.0a9.dist-info → scale_gp_beta-0.1.0a11.dist-info}/METADATA +8 -8
  31. {scale_gp_beta-0.1.0a9.dist-info → scale_gp_beta-0.1.0a11.dist-info}/RECORD +33 -28
  32. {scale_gp_beta-0.1.0a9.dist-info → scale_gp_beta-0.1.0a11.dist-info}/WHEEL +0 -0
  33. {scale_gp_beta-0.1.0a9.dist-info → scale_gp_beta-0.1.0a11.dist-info}/licenses/LICENSE +0 -0
@@ -9,11 +9,7 @@ import httpx
9
9
 
10
10
  from ..types import model_list_params, model_create_params, model_update_params
11
11
  from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12
- from .._utils import (
13
- required_args,
14
- maybe_transform,
15
- async_maybe_transform,
16
- )
12
+ from .._utils import required_args, maybe_transform, async_maybe_transform
17
13
  from .._compat import cached_property
18
14
  from .._resource import SyncAPIResource, AsyncAPIResource
19
15
  from .._response import (
@@ -0,0 +1,658 @@
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 required_args, maybe_transform, async_maybe_transform
14
+ from .._compat import cached_property
15
+ from .._resource import SyncAPIResource, AsyncAPIResource
16
+ from .._response import (
17
+ to_raw_response_wrapper,
18
+ to_streamed_response_wrapper,
19
+ async_to_raw_response_wrapper,
20
+ async_to_streamed_response_wrapper,
21
+ )
22
+ from ..pagination import SyncCursorPage, AsyncCursorPage
23
+ from ..types.span import Span
24
+ from .._base_client import AsyncPaginator, make_request_options
25
+
26
+ __all__ = ["SpansResource", "AsyncSpansResource"]
27
+
28
+
29
+ class SpansResource(SyncAPIResource):
30
+ @cached_property
31
+ def with_raw_response(self) -> SpansResourceWithRawResponse:
32
+ """
33
+ This property can be used as a prefix for any HTTP method call to return
34
+ the raw response object instead of the parsed content.
35
+
36
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
37
+ """
38
+ return SpansResourceWithRawResponse(self)
39
+
40
+ @cached_property
41
+ def with_streaming_response(self) -> SpansResourceWithStreamingResponse:
42
+ """
43
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44
+
45
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
46
+ """
47
+ return SpansResourceWithStreamingResponse(self)
48
+
49
+ @overload
50
+ def create(
51
+ self,
52
+ *,
53
+ name: str,
54
+ start_timestamp: Union[str, datetime],
55
+ trace_id: str,
56
+ data: Dict[str, object] | NotGiven = NOT_GIVEN,
57
+ end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
58
+ input: Dict[str, object] | NotGiven = NOT_GIVEN,
59
+ output: Dict[str, object] | NotGiven = NOT_GIVEN,
60
+ parent_id: str | NotGiven = NOT_GIVEN,
61
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
62
+ # The extra values given here take precedence over values defined on the client or passed to this method.
63
+ extra_headers: Headers | None = None,
64
+ extra_query: Query | None = None,
65
+ extra_body: Body | None = None,
66
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
67
+ ) -> Span:
68
+ """
69
+ Create Span
70
+
71
+ Args:
72
+ trace_id: id for grouping traces together, uuid is recommended
73
+
74
+ parent_id: Reference to a parent span_id
75
+
76
+ extra_headers: Send extra headers
77
+
78
+ extra_query: Add additional query parameters to the request
79
+
80
+ extra_body: Add additional JSON properties to the request
81
+
82
+ timeout: Override the client-level default timeout for this request, in seconds
83
+ """
84
+ ...
85
+
86
+ @overload
87
+ def create(
88
+ self,
89
+ *,
90
+ application_interaction_id: str,
91
+ application_variant_id: str,
92
+ name: str,
93
+ start_timestamp: Union[str, datetime],
94
+ trace_id: str,
95
+ data: Dict[str, object] | NotGiven = NOT_GIVEN,
96
+ end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
97
+ input: Dict[str, object] | NotGiven = NOT_GIVEN,
98
+ output: Dict[str, object] | NotGiven = NOT_GIVEN,
99
+ parent_id: str | NotGiven = NOT_GIVEN,
100
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
101
+ # The extra values given here take precedence over values defined on the client or passed to this method.
102
+ extra_headers: Headers | None = None,
103
+ extra_query: Query | None = None,
104
+ extra_body: Body | None = None,
105
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
106
+ ) -> Span:
107
+ """
108
+ Create Span
109
+
110
+ Args:
111
+ trace_id: id for grouping traces together, uuid is recommended
112
+
113
+ parent_id: Reference to a parent span_id
114
+
115
+ extra_headers: Send extra headers
116
+
117
+ extra_query: Add additional query parameters to the request
118
+
119
+ extra_body: Add additional JSON properties to the request
120
+
121
+ timeout: Override the client-level default timeout for this request, in seconds
122
+ """
123
+ ...
124
+
125
+ @required_args(
126
+ ["name", "start_timestamp", "trace_id"],
127
+ ["application_interaction_id", "application_variant_id", "name", "start_timestamp", "trace_id"],
128
+ )
129
+ def create(
130
+ self,
131
+ *,
132
+ name: str,
133
+ start_timestamp: Union[str, datetime],
134
+ trace_id: str,
135
+ data: Dict[str, object] | NotGiven = NOT_GIVEN,
136
+ end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
137
+ input: Dict[str, object] | NotGiven = NOT_GIVEN,
138
+ output: Dict[str, object] | NotGiven = NOT_GIVEN,
139
+ parent_id: str | NotGiven = NOT_GIVEN,
140
+ application_interaction_id: str | NotGiven = NOT_GIVEN,
141
+ application_variant_id: str | NotGiven = NOT_GIVEN,
142
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
143
+ # The extra values given here take precedence over values defined on the client or passed to this method.
144
+ extra_headers: Headers | None = None,
145
+ extra_query: Query | None = None,
146
+ extra_body: Body | None = None,
147
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
148
+ ) -> Span:
149
+ return self._post(
150
+ "/v5/spans",
151
+ body=maybe_transform(
152
+ {
153
+ "name": name,
154
+ "start_timestamp": start_timestamp,
155
+ "trace_id": trace_id,
156
+ "data": data,
157
+ "end_timestamp": end_timestamp,
158
+ "input": input,
159
+ "output": output,
160
+ "parent_id": parent_id,
161
+ "application_interaction_id": application_interaction_id,
162
+ "application_variant_id": application_variant_id,
163
+ },
164
+ span_create_params.SpanCreateParams,
165
+ ),
166
+ options=make_request_options(
167
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
168
+ ),
169
+ cast_to=Span,
170
+ )
171
+
172
+ def retrieve(
173
+ self,
174
+ span_id: str,
175
+ *,
176
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
177
+ # The extra values given here take precedence over values defined on the client or passed to this method.
178
+ extra_headers: Headers | None = None,
179
+ extra_query: Query | None = None,
180
+ extra_body: Body | None = None,
181
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
182
+ ) -> Span:
183
+ """
184
+ Get Span
185
+
186
+ Args:
187
+ extra_headers: Send extra headers
188
+
189
+ extra_query: Add additional query parameters to the request
190
+
191
+ extra_body: Add additional JSON properties to the request
192
+
193
+ timeout: Override the client-level default timeout for this request, in seconds
194
+ """
195
+ if not span_id:
196
+ raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
197
+ return self._get(
198
+ f"/v5/spans/{span_id}",
199
+ options=make_request_options(
200
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
201
+ ),
202
+ cast_to=Span,
203
+ )
204
+
205
+ def update(
206
+ self,
207
+ span_id: str,
208
+ *,
209
+ data: Dict[str, object] | NotGiven = NOT_GIVEN,
210
+ end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
211
+ name: str | NotGiven = NOT_GIVEN,
212
+ output: Dict[str, object] | NotGiven = NOT_GIVEN,
213
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
214
+ # The extra values given here take precedence over values defined on the client or passed to this method.
215
+ extra_headers: Headers | None = None,
216
+ extra_query: Query | None = None,
217
+ extra_body: Body | None = None,
218
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
219
+ ) -> Span:
220
+ """
221
+ Update Span
222
+
223
+ Args:
224
+ extra_headers: Send extra headers
225
+
226
+ extra_query: Add additional query parameters to the request
227
+
228
+ extra_body: Add additional JSON properties to the request
229
+
230
+ timeout: Override the client-level default timeout for this request, in seconds
231
+ """
232
+ if not span_id:
233
+ raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}")
234
+ return self._patch(
235
+ f"/v5/spans/{span_id}",
236
+ body=maybe_transform(
237
+ {
238
+ "data": data,
239
+ "end_timestamp": end_timestamp,
240
+ "name": name,
241
+ "output": output,
242
+ },
243
+ span_update_params.SpanUpdateParams,
244
+ ),
245
+ options=make_request_options(
246
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
247
+ ),
248
+ cast_to=Span,
249
+ )
250
+
251
+ def list(
252
+ self,
253
+ *,
254
+ ending_before: Optional[str] | NotGiven = NOT_GIVEN,
255
+ from_ts: int | NotGiven = NOT_GIVEN,
256
+ limit: int | NotGiven = NOT_GIVEN,
257
+ parents_only: Optional[bool] | NotGiven = NOT_GIVEN,
258
+ starting_after: Optional[str] | NotGiven = NOT_GIVEN,
259
+ to_ts: int | NotGiven = NOT_GIVEN,
260
+ trace_id: Optional[str] | NotGiven = NOT_GIVEN,
261
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
262
+ # The extra values given here take precedence over values defined on the client or passed to this method.
263
+ extra_headers: Headers | None = None,
264
+ extra_query: Query | None = None,
265
+ extra_body: Body | None = None,
266
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
267
+ ) -> SyncCursorPage[Span]:
268
+ """
269
+ List Spans
270
+
271
+ Args:
272
+ from_ts: The starting (oldest) timestamp window in seconds.
273
+
274
+ to_ts: The ending (most recent) timestamp in seconds.
275
+
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: int | 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: int | 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
+ from_ts: The starting (oldest) timestamp window in seconds.
553
+
554
+ to_ts: The ending (most recent) timestamp in seconds.
555
+
556
+ extra_headers: Send extra headers
557
+
558
+ extra_query: Add additional query parameters to the request
559
+
560
+ extra_body: Add additional JSON properties to the request
561
+
562
+ timeout: Override the client-level default timeout for this request, in seconds
563
+ """
564
+ return self._get_api_list(
565
+ "/v5/spans",
566
+ page=AsyncCursorPage[Span],
567
+ options=make_request_options(
568
+ extra_headers=extra_headers,
569
+ extra_query=extra_query,
570
+ extra_body=extra_body,
571
+ timeout=timeout,
572
+ query=maybe_transform(
573
+ {
574
+ "ending_before": ending_before,
575
+ "from_ts": from_ts,
576
+ "limit": limit,
577
+ "parents_only": parents_only,
578
+ "starting_after": starting_after,
579
+ "to_ts": to_ts,
580
+ "trace_id": trace_id,
581
+ },
582
+ span_list_params.SpanListParams,
583
+ ),
584
+ ),
585
+ model=Span,
586
+ )
587
+
588
+
589
+ class SpansResourceWithRawResponse:
590
+ def __init__(self, spans: SpansResource) -> None:
591
+ self._spans = spans
592
+
593
+ self.create = to_raw_response_wrapper(
594
+ spans.create,
595
+ )
596
+ self.retrieve = to_raw_response_wrapper(
597
+ spans.retrieve,
598
+ )
599
+ self.update = to_raw_response_wrapper(
600
+ spans.update,
601
+ )
602
+ self.list = to_raw_response_wrapper(
603
+ spans.list,
604
+ )
605
+
606
+
607
+ class AsyncSpansResourceWithRawResponse:
608
+ def __init__(self, spans: AsyncSpansResource) -> None:
609
+ self._spans = spans
610
+
611
+ self.create = async_to_raw_response_wrapper(
612
+ spans.create,
613
+ )
614
+ self.retrieve = async_to_raw_response_wrapper(
615
+ spans.retrieve,
616
+ )
617
+ self.update = async_to_raw_response_wrapper(
618
+ spans.update,
619
+ )
620
+ self.list = async_to_raw_response_wrapper(
621
+ spans.list,
622
+ )
623
+
624
+
625
+ class SpansResourceWithStreamingResponse:
626
+ def __init__(self, spans: SpansResource) -> None:
627
+ self._spans = spans
628
+
629
+ self.create = to_streamed_response_wrapper(
630
+ spans.create,
631
+ )
632
+ self.retrieve = to_streamed_response_wrapper(
633
+ spans.retrieve,
634
+ )
635
+ self.update = to_streamed_response_wrapper(
636
+ spans.update,
637
+ )
638
+ self.list = to_streamed_response_wrapper(
639
+ spans.list,
640
+ )
641
+
642
+
643
+ class AsyncSpansResourceWithStreamingResponse:
644
+ def __init__(self, spans: AsyncSpansResource) -> None:
645
+ self._spans = spans
646
+
647
+ self.create = async_to_streamed_response_wrapper(
648
+ spans.create,
649
+ )
650
+ self.retrieve = async_to_streamed_response_wrapper(
651
+ spans.retrieve,
652
+ )
653
+ self.update = async_to_streamed_response_wrapper(
654
+ spans.update,
655
+ )
656
+ self.list = async_to_streamed_response_wrapper(
657
+ spans.list,
658
+ )
@@ -3,6 +3,7 @@
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
@@ -12,10 +13,13 @@ from .evaluation_item import EvaluationItem as EvaluationItem
12
13
  from .evaluation_task import EvaluationTask as EvaluationTask
13
14
  from .inference_model import InferenceModel as InferenceModel
14
15
  from .file_list_params import FileListParams as FileListParams
16
+ from .span_list_params import SpanListParams as SpanListParams
15
17
  from .model_list_params import ModelListParams as ModelListParams
16
18
  from .file_create_params import FileCreateParams as FileCreateParams
17
19
  from .file_update_params import FileUpdateParams as FileUpdateParams
18
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
19
23
  from .dataset_list_params import DatasetListParams as DatasetListParams
20
24
  from .model_create_params import ModelCreateParams as ModelCreateParams
21
25
  from .model_update_params import ModelUpdateParams as ModelUpdateParams