scale-gp-beta 0.1.0a28__py3-none-any.whl → 0.1.0a30__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 (49) hide show
  1. scale_gp_beta/_base_client.py +4 -1
  2. scale_gp_beta/_client.py +9 -0
  3. scale_gp_beta/_files.py +4 -4
  4. scale_gp_beta/_models.py +24 -3
  5. scale_gp_beta/_version.py +1 -1
  6. scale_gp_beta/lib/CONTRIBUTING.MD +53 -0
  7. scale_gp_beta/lib/tracing/integrations/openai/openai_span_type_map.py +3 -3
  8. scale_gp_beta/lib/tracing/span.py +8 -7
  9. scale_gp_beta/lib/tracing/trace.py +7 -5
  10. scale_gp_beta/lib/tracing/trace_queue_manager.py +14 -0
  11. scale_gp_beta/lib/tracing/tracing.py +7 -5
  12. scale_gp_beta/lib/tracing/types.py +1 -39
  13. scale_gp_beta/resources/__init__.py +14 -0
  14. scale_gp_beta/resources/chat/completions.py +4 -0
  15. scale_gp_beta/resources/responses.py +314 -0
  16. scale_gp_beta/resources/spans.py +28 -144
  17. scale_gp_beta/types/__init__.py +19 -0
  18. scale_gp_beta/types/chat/chat_completion.py +61 -6
  19. scale_gp_beta/types/chat/chat_completion_chunk.py +17 -1
  20. scale_gp_beta/types/chat/completion_models_params.py +2 -0
  21. scale_gp_beta/types/chat/model_definition.py +6 -0
  22. scale_gp_beta/types/completion.py +8 -0
  23. scale_gp_beta/types/container.py +0 -6
  24. scale_gp_beta/types/dataset.py +3 -1
  25. scale_gp_beta/types/dataset_item.py +3 -1
  26. scale_gp_beta/types/evaluation.py +3 -7
  27. scale_gp_beta/types/evaluation_item.py +3 -1
  28. scale_gp_beta/types/evaluation_task.py +31 -55
  29. scale_gp_beta/types/evaluation_task_param.py +28 -1
  30. scale_gp_beta/types/file.py +3 -1
  31. scale_gp_beta/types/inference_model.py +3 -0
  32. scale_gp_beta/types/question.py +11 -10
  33. scale_gp_beta/types/response.py +2852 -0
  34. scale_gp_beta/types/response_create_params.py +817 -0
  35. scale_gp_beta/types/response_create_response.py +20891 -0
  36. scale_gp_beta/types/shared/__init__.py +3 -0
  37. scale_gp_beta/types/shared/identity.py +16 -0
  38. scale_gp_beta/types/span.py +9 -33
  39. scale_gp_beta/types/span_batch_params.py +6 -30
  40. scale_gp_beta/types/span_create_params.py +6 -30
  41. scale_gp_beta/types/span_search_params.py +8 -37
  42. scale_gp_beta/types/span_status.py +7 -0
  43. scale_gp_beta/types/span_type.py +33 -0
  44. scale_gp_beta/types/span_update_params.py +3 -2
  45. scale_gp_beta/types/span_upsert_batch_params.py +6 -30
  46. {scale_gp_beta-0.1.0a28.dist-info → scale_gp_beta-0.1.0a30.dist-info}/METADATA +2 -3
  47. {scale_gp_beta-0.1.0a28.dist-info → scale_gp_beta-0.1.0a30.dist-info}/RECORD +49 -40
  48. {scale_gp_beta-0.1.0a28.dist-info → scale_gp_beta-0.1.0a30.dist-info}/WHEEL +0 -0
  49. {scale_gp_beta-0.1.0a28.dist-info → scale_gp_beta-0.1.0a30.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,314 @@
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 Any, Dict, List, Union, Iterable, cast
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ..types import response_create_params
11
+ from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12
+ from .._utils import maybe_transform, async_maybe_transform
13
+ from .._compat import cached_property
14
+ from .._resource import SyncAPIResource, AsyncAPIResource
15
+ from .._response import (
16
+ to_raw_response_wrapper,
17
+ to_streamed_response_wrapper,
18
+ async_to_raw_response_wrapper,
19
+ async_to_streamed_response_wrapper,
20
+ )
21
+ from .._base_client import make_request_options
22
+ from ..types.response_create_response import ResponseCreateResponse
23
+
24
+ __all__ = ["ResponsesResource", "AsyncResponsesResource"]
25
+
26
+
27
+ class ResponsesResource(SyncAPIResource):
28
+ @cached_property
29
+ def with_raw_response(self) -> ResponsesResourceWithRawResponse:
30
+ """
31
+ This property can be used as a prefix for any HTTP method call to return
32
+ the raw response object instead of the parsed content.
33
+
34
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
35
+ """
36
+ return ResponsesResourceWithRawResponse(self)
37
+
38
+ @cached_property
39
+ def with_streaming_response(self) -> ResponsesResourceWithStreamingResponse:
40
+ """
41
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
42
+
43
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
44
+ """
45
+ return ResponsesResourceWithStreamingResponse(self)
46
+
47
+ def create(
48
+ self,
49
+ *,
50
+ input: Union[str, Iterable[response_create_params.InputUnionMember1]],
51
+ model: str,
52
+ include: List[str] | NotGiven = NOT_GIVEN,
53
+ instructions: str | NotGiven = NOT_GIVEN,
54
+ max_output_tokens: int | NotGiven = NOT_GIVEN,
55
+ metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
56
+ parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
57
+ previous_response_id: str | NotGiven = NOT_GIVEN,
58
+ reasoning: Dict[str, object] | NotGiven = NOT_GIVEN,
59
+ store: bool | NotGiven = NOT_GIVEN,
60
+ stream: bool | NotGiven = NOT_GIVEN,
61
+ temperature: float | NotGiven = NOT_GIVEN,
62
+ text: Dict[str, object] | NotGiven = NOT_GIVEN,
63
+ tool_choice: Union[str, Dict[str, object]] | NotGiven = NOT_GIVEN,
64
+ tools: Iterable[Dict[str, object]] | NotGiven = NOT_GIVEN,
65
+ top_p: float | NotGiven = NOT_GIVEN,
66
+ truncation: Literal["auto", "disabled"] | NotGiven = NOT_GIVEN,
67
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
68
+ # The extra values given here take precedence over values defined on the client or passed to this method.
69
+ extra_headers: Headers | None = None,
70
+ extra_query: Query | None = None,
71
+ extra_body: Body | None = None,
72
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
73
+ ) -> ResponseCreateResponse:
74
+ """
75
+ Responses
76
+
77
+ Args:
78
+ model: model specified as `model_vendor/model`, for example `openai/gpt-4o`
79
+
80
+ include: Which fields to include in the response
81
+
82
+ instructions: Instructions for the response generation
83
+
84
+ max_output_tokens: Maximum number of output tokens
85
+
86
+ metadata: Metadata for the response
87
+
88
+ parallel_tool_calls: Whether to enable parallel tool calls
89
+
90
+ previous_response_id: ID of the previous response for chaining
91
+
92
+ reasoning: Reasoning configuration for the response
93
+
94
+ store: Whether to store the response
95
+
96
+ stream: Whether to stream the response
97
+
98
+ temperature: Sampling temperature for randomness control
99
+
100
+ text: Text configuration parameters
101
+
102
+ tool_choice: Tool choice configuration
103
+
104
+ tools: Tools available for the response
105
+
106
+ top_p: Top-p sampling parameter
107
+
108
+ truncation: Truncation configuration
109
+
110
+ extra_headers: Send extra headers
111
+
112
+ extra_query: Add additional query parameters to the request
113
+
114
+ extra_body: Add additional JSON properties to the request
115
+
116
+ timeout: Override the client-level default timeout for this request, in seconds
117
+ """
118
+ return cast(
119
+ ResponseCreateResponse,
120
+ self._post(
121
+ "/v5/responses",
122
+ body=maybe_transform(
123
+ {
124
+ "input": input,
125
+ "model": model,
126
+ "include": include,
127
+ "instructions": instructions,
128
+ "max_output_tokens": max_output_tokens,
129
+ "metadata": metadata,
130
+ "parallel_tool_calls": parallel_tool_calls,
131
+ "previous_response_id": previous_response_id,
132
+ "reasoning": reasoning,
133
+ "store": store,
134
+ "stream": stream,
135
+ "temperature": temperature,
136
+ "text": text,
137
+ "tool_choice": tool_choice,
138
+ "tools": tools,
139
+ "top_p": top_p,
140
+ "truncation": truncation,
141
+ },
142
+ response_create_params.ResponseCreateParams,
143
+ ),
144
+ options=make_request_options(
145
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
146
+ ),
147
+ cast_to=cast(
148
+ Any, ResponseCreateResponse
149
+ ), # Union types cannot be passed in as arguments in the type system
150
+ ),
151
+ )
152
+
153
+
154
+ class AsyncResponsesResource(AsyncAPIResource):
155
+ @cached_property
156
+ def with_raw_response(self) -> AsyncResponsesResourceWithRawResponse:
157
+ """
158
+ This property can be used as a prefix for any HTTP method call to return
159
+ the raw response object instead of the parsed content.
160
+
161
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
162
+ """
163
+ return AsyncResponsesResourceWithRawResponse(self)
164
+
165
+ @cached_property
166
+ def with_streaming_response(self) -> AsyncResponsesResourceWithStreamingResponse:
167
+ """
168
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
169
+
170
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
171
+ """
172
+ return AsyncResponsesResourceWithStreamingResponse(self)
173
+
174
+ async def create(
175
+ self,
176
+ *,
177
+ input: Union[str, Iterable[response_create_params.InputUnionMember1]],
178
+ model: str,
179
+ include: List[str] | NotGiven = NOT_GIVEN,
180
+ instructions: str | NotGiven = NOT_GIVEN,
181
+ max_output_tokens: int | NotGiven = NOT_GIVEN,
182
+ metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
183
+ parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
184
+ previous_response_id: str | NotGiven = NOT_GIVEN,
185
+ reasoning: Dict[str, object] | NotGiven = NOT_GIVEN,
186
+ store: bool | NotGiven = NOT_GIVEN,
187
+ stream: bool | NotGiven = NOT_GIVEN,
188
+ temperature: float | NotGiven = NOT_GIVEN,
189
+ text: Dict[str, object] | NotGiven = NOT_GIVEN,
190
+ tool_choice: Union[str, Dict[str, object]] | NotGiven = NOT_GIVEN,
191
+ tools: Iterable[Dict[str, object]] | NotGiven = NOT_GIVEN,
192
+ top_p: float | NotGiven = NOT_GIVEN,
193
+ truncation: Literal["auto", "disabled"] | NotGiven = NOT_GIVEN,
194
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195
+ # The extra values given here take precedence over values defined on the client or passed to this method.
196
+ extra_headers: Headers | None = None,
197
+ extra_query: Query | None = None,
198
+ extra_body: Body | None = None,
199
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
200
+ ) -> ResponseCreateResponse:
201
+ """
202
+ Responses
203
+
204
+ Args:
205
+ model: model specified as `model_vendor/model`, for example `openai/gpt-4o`
206
+
207
+ include: Which fields to include in the response
208
+
209
+ instructions: Instructions for the response generation
210
+
211
+ max_output_tokens: Maximum number of output tokens
212
+
213
+ metadata: Metadata for the response
214
+
215
+ parallel_tool_calls: Whether to enable parallel tool calls
216
+
217
+ previous_response_id: ID of the previous response for chaining
218
+
219
+ reasoning: Reasoning configuration for the response
220
+
221
+ store: Whether to store the response
222
+
223
+ stream: Whether to stream the response
224
+
225
+ temperature: Sampling temperature for randomness control
226
+
227
+ text: Text configuration parameters
228
+
229
+ tool_choice: Tool choice configuration
230
+
231
+ tools: Tools available for the response
232
+
233
+ top_p: Top-p sampling parameter
234
+
235
+ truncation: Truncation configuration
236
+
237
+ extra_headers: Send extra headers
238
+
239
+ extra_query: Add additional query parameters to the request
240
+
241
+ extra_body: Add additional JSON properties to the request
242
+
243
+ timeout: Override the client-level default timeout for this request, in seconds
244
+ """
245
+ return cast(
246
+ ResponseCreateResponse,
247
+ await self._post(
248
+ "/v5/responses",
249
+ body=await async_maybe_transform(
250
+ {
251
+ "input": input,
252
+ "model": model,
253
+ "include": include,
254
+ "instructions": instructions,
255
+ "max_output_tokens": max_output_tokens,
256
+ "metadata": metadata,
257
+ "parallel_tool_calls": parallel_tool_calls,
258
+ "previous_response_id": previous_response_id,
259
+ "reasoning": reasoning,
260
+ "store": store,
261
+ "stream": stream,
262
+ "temperature": temperature,
263
+ "text": text,
264
+ "tool_choice": tool_choice,
265
+ "tools": tools,
266
+ "top_p": top_p,
267
+ "truncation": truncation,
268
+ },
269
+ response_create_params.ResponseCreateParams,
270
+ ),
271
+ options=make_request_options(
272
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
273
+ ),
274
+ cast_to=cast(
275
+ Any, ResponseCreateResponse
276
+ ), # Union types cannot be passed in as arguments in the type system
277
+ ),
278
+ )
279
+
280
+
281
+ class ResponsesResourceWithRawResponse:
282
+ def __init__(self, responses: ResponsesResource) -> None:
283
+ self._responses = responses
284
+
285
+ self.create = to_raw_response_wrapper(
286
+ responses.create,
287
+ )
288
+
289
+
290
+ class AsyncResponsesResourceWithRawResponse:
291
+ def __init__(self, responses: AsyncResponsesResource) -> None:
292
+ self._responses = responses
293
+
294
+ self.create = async_to_raw_response_wrapper(
295
+ responses.create,
296
+ )
297
+
298
+
299
+ class ResponsesResourceWithStreamingResponse:
300
+ def __init__(self, responses: ResponsesResource) -> None:
301
+ self._responses = responses
302
+
303
+ self.create = to_streamed_response_wrapper(
304
+ responses.create,
305
+ )
306
+
307
+
308
+ class AsyncResponsesResourceWithStreamingResponse:
309
+ def __init__(self, responses: AsyncResponsesResource) -> None:
310
+ self._responses = responses
311
+
312
+ self.create = async_to_streamed_response_wrapper(
313
+ responses.create,
314
+ )
@@ -9,6 +9,8 @@ from typing_extensions import Literal
9
9
  import httpx
10
10
 
11
11
  from ..types import (
12
+ SpanType,
13
+ SpanStatus,
12
14
  span_batch_params,
13
15
  span_create_params,
14
16
  span_search_params,
@@ -28,6 +30,8 @@ from .._response import (
28
30
  from ..pagination import SyncCursorPage, AsyncCursorPage
29
31
  from ..types.span import Span
30
32
  from .._base_client import AsyncPaginator, make_request_options
33
+ from ..types.span_type import SpanType
34
+ from ..types.span_status import SpanStatus
31
35
  from ..types.span_batch_response import SpanBatchResponse
32
36
  from ..types.span_upsert_batch_response import SpanUpsertBatchResponse
33
37
 
@@ -69,35 +73,8 @@ class SpansResource(SyncAPIResource):
69
73
  metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
70
74
  output: Dict[str, object] | NotGiven = NOT_GIVEN,
71
75
  parent_id: str | NotGiven = NOT_GIVEN,
72
- status: Literal["SUCCESS", "ERROR", "CANCELED"] | NotGiven = NOT_GIVEN,
73
- type: Literal[
74
- "TEXT_INPUT",
75
- "TEXT_OUTPUT",
76
- "COMPLETION_INPUT",
77
- "COMPLETION",
78
- "KB_RETRIEVAL",
79
- "KB_INPUT",
80
- "RERANKING",
81
- "EXTERNAL_ENDPOINT",
82
- "PROMPT_ENGINEERING",
83
- "DOCUMENT_INPUT",
84
- "MAP_REDUCE",
85
- "DOCUMENT_SEARCH",
86
- "DOCUMENT_PROMPT",
87
- "CUSTOM",
88
- "CODE_EXECUTION",
89
- "DATA_MANIPULATION",
90
- "EVALUATION",
91
- "FILE_RETRIEVAL",
92
- "KB_ADD_CHUNK",
93
- "KB_MANAGEMENT",
94
- "GUARDRAIL",
95
- "TRACER",
96
- "AGENT_TRACER",
97
- "AGENT_WORKFLOW",
98
- "STANDALONE",
99
- ]
100
- | NotGiven = NOT_GIVEN,
76
+ status: SpanStatus | NotGiven = NOT_GIVEN,
77
+ type: SpanType | NotGiven = NOT_GIVEN,
101
78
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
102
79
  # The extra values given here take precedence over values defined on the client or passed to this method.
103
80
  extra_headers: Headers | None = None,
@@ -197,7 +174,7 @@ class SpansResource(SyncAPIResource):
197
174
  metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
198
175
  name: str | NotGiven = NOT_GIVEN,
199
176
  output: Dict[str, object] | NotGiven = NOT_GIVEN,
200
- status: Literal["SUCCESS", "ERROR", "CANCELED"] | NotGiven = NOT_GIVEN,
177
+ status: SpanStatus | NotGiven = NOT_GIVEN,
201
178
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
202
179
  # The extra values given here take precedence over values defined on the client or passed to this method.
203
180
  extra_headers: Headers | None = None,
@@ -278,48 +255,18 @@ class SpansResource(SyncAPIResource):
278
255
  sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
279
256
  starting_after: str | NotGiven = NOT_GIVEN,
280
257
  to_ts: Union[str, datetime] | NotGiven = NOT_GIVEN,
258
+ application_variant_ids: List[str] | NotGiven = NOT_GIVEN,
281
259
  excluded_span_ids: List[str] | NotGiven = NOT_GIVEN,
282
260
  excluded_trace_ids: List[str] | NotGiven = NOT_GIVEN,
283
261
  extra_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
284
262
  group_id: str | NotGiven = NOT_GIVEN,
285
263
  names: List[str] | NotGiven = NOT_GIVEN,
286
264
  parents_only: bool | NotGiven = NOT_GIVEN,
287
- search_text: str | NotGiven = NOT_GIVEN,
288
- span_id: str | NotGiven = NOT_GIVEN,
265
+ search_texts: List[str] | NotGiven = NOT_GIVEN,
289
266
  span_ids: List[str] | NotGiven = NOT_GIVEN,
290
- statuses: List[Literal["SUCCESS", "ERROR", "CANCELED"]] | NotGiven = NOT_GIVEN,
291
- trace_id: str | NotGiven = NOT_GIVEN,
267
+ statuses: List[SpanStatus] | NotGiven = NOT_GIVEN,
292
268
  trace_ids: List[str] | NotGiven = NOT_GIVEN,
293
- types: List[
294
- Literal[
295
- "TEXT_INPUT",
296
- "TEXT_OUTPUT",
297
- "COMPLETION_INPUT",
298
- "COMPLETION",
299
- "KB_RETRIEVAL",
300
- "KB_INPUT",
301
- "RERANKING",
302
- "EXTERNAL_ENDPOINT",
303
- "PROMPT_ENGINEERING",
304
- "DOCUMENT_INPUT",
305
- "MAP_REDUCE",
306
- "DOCUMENT_SEARCH",
307
- "DOCUMENT_PROMPT",
308
- "CUSTOM",
309
- "CODE_EXECUTION",
310
- "DATA_MANIPULATION",
311
- "EVALUATION",
312
- "FILE_RETRIEVAL",
313
- "KB_ADD_CHUNK",
314
- "KB_MANAGEMENT",
315
- "GUARDRAIL",
316
- "TRACER",
317
- "AGENT_TRACER",
318
- "AGENT_WORKFLOW",
319
- "STANDALONE",
320
- ]
321
- ]
322
- | NotGiven = NOT_GIVEN,
269
+ types: List[SpanType] | NotGiven = NOT_GIVEN,
323
270
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
324
271
  # The extra values given here take precedence over values defined on the client or passed to this method.
325
272
  extra_headers: Headers | None = None,
@@ -335,6 +282,8 @@ class SpansResource(SyncAPIResource):
335
282
 
336
283
  to_ts: The ending (most recent) timestamp in ISO format.
337
284
 
285
+ application_variant_ids: Filter by application variant IDs
286
+
338
287
  excluded_span_ids: List of span IDs to exclude from results
339
288
 
340
289
  excluded_trace_ids: List of trace IDs to exclude from results
@@ -347,16 +296,12 @@ class SpansResource(SyncAPIResource):
347
296
 
348
297
  parents_only: Only fetch spans that are the top-level (ie. have no parent_id)
349
298
 
350
- search_text: Free text search across span input and output fields
351
-
352
- span_id: Filter by span ID (deprecated: use span_ids instead)
299
+ search_texts: Free text search across span input and output fields
353
300
 
354
301
  span_ids: Filter by span IDs
355
302
 
356
303
  statuses: Filter on span status
357
304
 
358
- trace_id: Filter by trace ID (deprecated: use trace_ids instead)
359
-
360
305
  trace_ids: Filter by trace IDs
361
306
 
362
307
  extra_headers: Send extra headers
@@ -372,17 +317,16 @@ class SpansResource(SyncAPIResource):
372
317
  page=SyncCursorPage[Span],
373
318
  body=maybe_transform(
374
319
  {
320
+ "application_variant_ids": application_variant_ids,
375
321
  "excluded_span_ids": excluded_span_ids,
376
322
  "excluded_trace_ids": excluded_trace_ids,
377
323
  "extra_metadata": extra_metadata,
378
324
  "group_id": group_id,
379
325
  "names": names,
380
326
  "parents_only": parents_only,
381
- "search_text": search_text,
382
- "span_id": span_id,
327
+ "search_texts": search_texts,
383
328
  "span_ids": span_ids,
384
329
  "statuses": statuses,
385
- "trace_id": trace_id,
386
330
  "trace_ids": trace_ids,
387
331
  "types": types,
388
332
  },
@@ -477,35 +421,8 @@ class AsyncSpansResource(AsyncAPIResource):
477
421
  metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
478
422
  output: Dict[str, object] | NotGiven = NOT_GIVEN,
479
423
  parent_id: str | NotGiven = NOT_GIVEN,
480
- status: Literal["SUCCESS", "ERROR", "CANCELED"] | NotGiven = NOT_GIVEN,
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
- "CODE_EXECUTION",
497
- "DATA_MANIPULATION",
498
- "EVALUATION",
499
- "FILE_RETRIEVAL",
500
- "KB_ADD_CHUNK",
501
- "KB_MANAGEMENT",
502
- "GUARDRAIL",
503
- "TRACER",
504
- "AGENT_TRACER",
505
- "AGENT_WORKFLOW",
506
- "STANDALONE",
507
- ]
508
- | NotGiven = NOT_GIVEN,
424
+ status: SpanStatus | NotGiven = NOT_GIVEN,
425
+ type: SpanType | NotGiven = NOT_GIVEN,
509
426
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
510
427
  # The extra values given here take precedence over values defined on the client or passed to this method.
511
428
  extra_headers: Headers | None = None,
@@ -605,7 +522,7 @@ class AsyncSpansResource(AsyncAPIResource):
605
522
  metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
606
523
  name: str | NotGiven = NOT_GIVEN,
607
524
  output: Dict[str, object] | NotGiven = NOT_GIVEN,
608
- status: Literal["SUCCESS", "ERROR", "CANCELED"] | NotGiven = NOT_GIVEN,
525
+ status: SpanStatus | NotGiven = NOT_GIVEN,
609
526
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
610
527
  # The extra values given here take precedence over values defined on the client or passed to this method.
611
528
  extra_headers: Headers | None = None,
@@ -686,48 +603,18 @@ class AsyncSpansResource(AsyncAPIResource):
686
603
  sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
687
604
  starting_after: str | NotGiven = NOT_GIVEN,
688
605
  to_ts: Union[str, datetime] | NotGiven = NOT_GIVEN,
606
+ application_variant_ids: List[str] | NotGiven = NOT_GIVEN,
689
607
  excluded_span_ids: List[str] | NotGiven = NOT_GIVEN,
690
608
  excluded_trace_ids: List[str] | NotGiven = NOT_GIVEN,
691
609
  extra_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
692
610
  group_id: str | NotGiven = NOT_GIVEN,
693
611
  names: List[str] | NotGiven = NOT_GIVEN,
694
612
  parents_only: bool | NotGiven = NOT_GIVEN,
695
- search_text: str | NotGiven = NOT_GIVEN,
696
- span_id: str | NotGiven = NOT_GIVEN,
613
+ search_texts: List[str] | NotGiven = NOT_GIVEN,
697
614
  span_ids: List[str] | NotGiven = NOT_GIVEN,
698
- statuses: List[Literal["SUCCESS", "ERROR", "CANCELED"]] | NotGiven = NOT_GIVEN,
699
- trace_id: str | NotGiven = NOT_GIVEN,
615
+ statuses: List[SpanStatus] | NotGiven = NOT_GIVEN,
700
616
  trace_ids: List[str] | NotGiven = NOT_GIVEN,
701
- types: List[
702
- Literal[
703
- "TEXT_INPUT",
704
- "TEXT_OUTPUT",
705
- "COMPLETION_INPUT",
706
- "COMPLETION",
707
- "KB_RETRIEVAL",
708
- "KB_INPUT",
709
- "RERANKING",
710
- "EXTERNAL_ENDPOINT",
711
- "PROMPT_ENGINEERING",
712
- "DOCUMENT_INPUT",
713
- "MAP_REDUCE",
714
- "DOCUMENT_SEARCH",
715
- "DOCUMENT_PROMPT",
716
- "CUSTOM",
717
- "CODE_EXECUTION",
718
- "DATA_MANIPULATION",
719
- "EVALUATION",
720
- "FILE_RETRIEVAL",
721
- "KB_ADD_CHUNK",
722
- "KB_MANAGEMENT",
723
- "GUARDRAIL",
724
- "TRACER",
725
- "AGENT_TRACER",
726
- "AGENT_WORKFLOW",
727
- "STANDALONE",
728
- ]
729
- ]
730
- | NotGiven = NOT_GIVEN,
617
+ types: List[SpanType] | NotGiven = NOT_GIVEN,
731
618
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
732
619
  # The extra values given here take precedence over values defined on the client or passed to this method.
733
620
  extra_headers: Headers | None = None,
@@ -743,6 +630,8 @@ class AsyncSpansResource(AsyncAPIResource):
743
630
 
744
631
  to_ts: The ending (most recent) timestamp in ISO format.
745
632
 
633
+ application_variant_ids: Filter by application variant IDs
634
+
746
635
  excluded_span_ids: List of span IDs to exclude from results
747
636
 
748
637
  excluded_trace_ids: List of trace IDs to exclude from results
@@ -755,16 +644,12 @@ class AsyncSpansResource(AsyncAPIResource):
755
644
 
756
645
  parents_only: Only fetch spans that are the top-level (ie. have no parent_id)
757
646
 
758
- search_text: Free text search across span input and output fields
759
-
760
- span_id: Filter by span ID (deprecated: use span_ids instead)
647
+ search_texts: Free text search across span input and output fields
761
648
 
762
649
  span_ids: Filter by span IDs
763
650
 
764
651
  statuses: Filter on span status
765
652
 
766
- trace_id: Filter by trace ID (deprecated: use trace_ids instead)
767
-
768
653
  trace_ids: Filter by trace IDs
769
654
 
770
655
  extra_headers: Send extra headers
@@ -780,17 +665,16 @@ class AsyncSpansResource(AsyncAPIResource):
780
665
  page=AsyncCursorPage[Span],
781
666
  body=maybe_transform(
782
667
  {
668
+ "application_variant_ids": application_variant_ids,
783
669
  "excluded_span_ids": excluded_span_ids,
784
670
  "excluded_trace_ids": excluded_trace_ids,
785
671
  "extra_metadata": extra_metadata,
786
672
  "group_id": group_id,
787
673
  "names": names,
788
674
  "parents_only": parents_only,
789
- "search_text": search_text,
790
- "span_id": span_id,
675
+ "search_texts": search_texts,
791
676
  "span_ids": span_ids,
792
677
  "statuses": statuses,
793
- "trace_id": trace_id,
794
678
  "trace_ids": trace_ids,
795
679
  "types": types,
796
680
  },
@@ -2,15 +2,21 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from . import container, evaluation
6
+ from .. import _compat
5
7
  from .file import File as File
6
8
  from .span import Span as Span
9
+ from .shared import Identity as Identity
7
10
  from .dataset import Dataset as Dataset
8
11
  from .question import Question as Question
12
+ from .response import Response as Response
9
13
  from .component import Component as Component
10
14
  from .container import Container as Container
11
15
  from .file_list import FileList as FileList
16
+ from .span_type import SpanType as SpanType
12
17
  from .completion import Completion as Completion
13
18
  from .evaluation import Evaluation as Evaluation
19
+ from .span_status import SpanStatus as SpanStatus
14
20
  from .dataset_item import DatasetItem as DatasetItem
15
21
  from .item_locator import ItemLocator as ItemLocator
16
22
  from .question_list import QuestionList as QuestionList
@@ -42,6 +48,7 @@ from .item_locator_template import ItemLocatorTemplate as ItemLocatorTemplate
42
48
  from .model_delete_response import ModelDeleteResponse as ModelDeleteResponse
43
49
  from .evaluation_list_params import EvaluationListParams as EvaluationListParams
44
50
  from .question_create_params import QuestionCreateParams as QuestionCreateParams
51
+ from .response_create_params import ResponseCreateParams as ResponseCreateParams
45
52
  from .dataset_delete_response import DatasetDeleteResponse as DatasetDeleteResponse
46
53
  from .dataset_retrieve_params import DatasetRetrieveParams as DatasetRetrieveParams
47
54
  from .inference_create_params import InferenceCreateParams as InferenceCreateParams
@@ -50,6 +57,7 @@ from .dataset_item_list_params import DatasetItemListParams as DatasetItemListPa
50
57
  from .evaluation_create_params import EvaluationCreateParams as EvaluationCreateParams
51
58
  from .evaluation_update_params import EvaluationUpdateParams as EvaluationUpdateParams
52
59
  from .inference_response_chunk import InferenceResponseChunk as InferenceResponseChunk
60
+ from .response_create_response import ResponseCreateResponse as ResponseCreateResponse
53
61
  from .span_upsert_batch_params import SpanUpsertBatchParams as SpanUpsertBatchParams
54
62
  from .inference_create_response import InferenceCreateResponse as InferenceCreateResponse
55
63
  from .dataset_item_update_params import DatasetItemUpdateParams as DatasetItemUpdateParams
@@ -62,3 +70,14 @@ from .dataset_item_retrieve_params import DatasetItemRetrieveParams as DatasetIt
62
70
  from .evaluation_item_retrieve_params import EvaluationItemRetrieveParams as EvaluationItemRetrieveParams
63
71
  from .dataset_item_batch_create_params import DatasetItemBatchCreateParams as DatasetItemBatchCreateParams
64
72
  from .dataset_item_batch_create_response import DatasetItemBatchCreateResponse as DatasetItemBatchCreateResponse
73
+
74
+ # Rebuild cyclical models only after all modules are imported.
75
+ # This ensures that, when building the deferred (due to cyclical references) model schema,
76
+ # Pydantic can resolve the necessary references.
77
+ # See: https://github.com/pydantic/pydantic/issues/11250 for more context.
78
+ if _compat.PYDANTIC_V2:
79
+ evaluation.Evaluation.model_rebuild(_parent_namespace_depth=0)
80
+ container.Container.model_rebuild(_parent_namespace_depth=0)
81
+ else:
82
+ evaluation.Evaluation.update_forward_refs() # type: ignore
83
+ container.Container.update_forward_refs() # type: ignore