scale-gp-beta 0.1.0a24__py3-none-any.whl → 0.1.0a26__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 (32) hide show
  1. scale_gp_beta/__init__.py +2 -1
  2. scale_gp_beta/_base_client.py +22 -0
  3. scale_gp_beta/_client.py +19 -1
  4. scale_gp_beta/_models.py +8 -5
  5. scale_gp_beta/_version.py +1 -1
  6. scale_gp_beta/lib/tracing/types.py +1 -3
  7. scale_gp_beta/resources/__init__.py +14 -0
  8. scale_gp_beta/resources/chat/completions.py +4 -2
  9. scale_gp_beta/resources/models.py +2 -0
  10. scale_gp_beta/resources/questions.py +693 -0
  11. scale_gp_beta/resources/spans.py +124 -92
  12. scale_gp_beta/types/__init__.py +4 -1
  13. scale_gp_beta/types/chat/chat_completion.py +1 -1
  14. scale_gp_beta/types/chat/chat_completion_chunk.py +1 -1
  15. scale_gp_beta/types/chat/completion_models_params.py +1 -0
  16. scale_gp_beta/types/chat/model_definition.py +1 -0
  17. scale_gp_beta/types/inference_model.py +1 -0
  18. scale_gp_beta/types/model_list_params.py +1 -0
  19. scale_gp_beta/types/question.py +175 -0
  20. scale_gp_beta/types/question_create_params.py +121 -0
  21. scale_gp_beta/types/{span_search_response.py → question_list.py} +4 -4
  22. scale_gp_beta/types/question_list_params.py +17 -0
  23. scale_gp_beta/types/span.py +1 -3
  24. scale_gp_beta/types/span_batch_params.py +1 -3
  25. scale_gp_beta/types/span_create_params.py +1 -3
  26. scale_gp_beta/types/span_search_params.py +45 -33
  27. scale_gp_beta/types/span_update_params.py +1 -1
  28. scale_gp_beta/types/span_upsert_batch_params.py +1 -3
  29. {scale_gp_beta-0.1.0a24.dist-info → scale_gp_beta-0.1.0a26.dist-info}/METADATA +41 -1
  30. {scale_gp_beta-0.1.0a24.dist-info → scale_gp_beta-0.1.0a26.dist-info}/RECORD +32 -28
  31. {scale_gp_beta-0.1.0a24.dist-info → scale_gp_beta-0.1.0a26.dist-info}/WHEEL +0 -0
  32. {scale_gp_beta-0.1.0a24.dist-info → scale_gp_beta-0.1.0a26.dist-info}/licenses/LICENSE +0 -0
scale_gp_beta/__init__.py CHANGED
@@ -37,7 +37,7 @@ from ._exceptions import (
37
37
  UnprocessableEntityError,
38
38
  APIResponseValidationError,
39
39
  )
40
- from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
40
+ from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
41
41
  from ._utils._logs import setup_logging as _setup_logging
42
42
 
43
43
  __all__ = [
@@ -80,6 +80,7 @@ __all__ = [
80
80
  "DEFAULT_CONNECTION_LIMITS",
81
81
  "DefaultHttpxClient",
82
82
  "DefaultAsyncHttpxClient",
83
+ "DefaultAioHttpClient",
83
84
  ]
84
85
 
85
86
  if not _t.TYPE_CHECKING:
@@ -1289,6 +1289,24 @@ class _DefaultAsyncHttpxClient(httpx.AsyncClient):
1289
1289
  super().__init__(**kwargs)
1290
1290
 
1291
1291
 
1292
+ try:
1293
+ import httpx_aiohttp
1294
+ except ImportError:
1295
+
1296
+ class _DefaultAioHttpClient(httpx.AsyncClient):
1297
+ def __init__(self, **_kwargs: Any) -> None:
1298
+ raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
1299
+ else:
1300
+
1301
+ class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
1302
+ def __init__(self, **kwargs: Any) -> None:
1303
+ kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
1304
+ kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
1305
+ kwargs.setdefault("follow_redirects", True)
1306
+
1307
+ super().__init__(**kwargs)
1308
+
1309
+
1292
1310
  if TYPE_CHECKING:
1293
1311
  DefaultAsyncHttpxClient = httpx.AsyncClient
1294
1312
  """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
@@ -1297,8 +1315,12 @@ if TYPE_CHECKING:
1297
1315
  This is useful because overriding the `http_client` with your own instance of
1298
1316
  `httpx.AsyncClient` will result in httpx's defaults being used, not ours.
1299
1317
  """
1318
+
1319
+ DefaultAioHttpClient = httpx.AsyncClient
1320
+ """An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
1300
1321
  else:
1301
1322
  DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
1323
+ DefaultAioHttpClient = _DefaultAioHttpClient
1302
1324
 
1303
1325
 
1304
1326
  class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
scale_gp_beta/_client.py CHANGED
@@ -21,7 +21,17 @@ from ._types import (
21
21
  )
22
22
  from ._utils import is_given, get_async_library
23
23
  from ._version import __version__
24
- from .resources import spans, models, datasets, inference, completions, evaluations, dataset_items, evaluation_items
24
+ from .resources import (
25
+ spans,
26
+ models,
27
+ datasets,
28
+ inference,
29
+ questions,
30
+ completions,
31
+ evaluations,
32
+ dataset_items,
33
+ evaluation_items,
34
+ )
25
35
  from ._streaming import Stream as Stream, AsyncStream as AsyncStream
26
36
  from ._exceptions import APIStatusError, SGPClientError
27
37
  from ._base_client import (
@@ -54,6 +64,7 @@ class SGPClient(SyncAPIClient):
54
64
  completions: completions.CompletionsResource
55
65
  chat: chat.ChatResource
56
66
  inference: inference.InferenceResource
67
+ questions: questions.QuestionsResource
57
68
  files: files.FilesResource
58
69
  models: models.ModelsResource
59
70
  datasets: datasets.DatasetsResource
@@ -157,6 +168,7 @@ class SGPClient(SyncAPIClient):
157
168
  self.completions = completions.CompletionsResource(self)
158
169
  self.chat = chat.ChatResource(self)
159
170
  self.inference = inference.InferenceResource(self)
171
+ self.questions = questions.QuestionsResource(self)
160
172
  self.files = files.FilesResource(self)
161
173
  self.models = models.ModelsResource(self)
162
174
  self.datasets = datasets.DatasetsResource(self)
@@ -281,6 +293,7 @@ class AsyncSGPClient(AsyncAPIClient):
281
293
  completions: completions.AsyncCompletionsResource
282
294
  chat: chat.AsyncChatResource
283
295
  inference: inference.AsyncInferenceResource
296
+ questions: questions.AsyncQuestionsResource
284
297
  files: files.AsyncFilesResource
285
298
  models: models.AsyncModelsResource
286
299
  datasets: datasets.AsyncDatasetsResource
@@ -384,6 +397,7 @@ class AsyncSGPClient(AsyncAPIClient):
384
397
  self.completions = completions.AsyncCompletionsResource(self)
385
398
  self.chat = chat.AsyncChatResource(self)
386
399
  self.inference = inference.AsyncInferenceResource(self)
400
+ self.questions = questions.AsyncQuestionsResource(self)
387
401
  self.files = files.AsyncFilesResource(self)
388
402
  self.models = models.AsyncModelsResource(self)
389
403
  self.datasets = datasets.AsyncDatasetsResource(self)
@@ -509,6 +523,7 @@ class SGPClientWithRawResponse:
509
523
  self.completions = completions.CompletionsResourceWithRawResponse(client.completions)
510
524
  self.chat = chat.ChatResourceWithRawResponse(client.chat)
511
525
  self.inference = inference.InferenceResourceWithRawResponse(client.inference)
526
+ self.questions = questions.QuestionsResourceWithRawResponse(client.questions)
512
527
  self.files = files.FilesResourceWithRawResponse(client.files)
513
528
  self.models = models.ModelsResourceWithRawResponse(client.models)
514
529
  self.datasets = datasets.DatasetsResourceWithRawResponse(client.datasets)
@@ -523,6 +538,7 @@ class AsyncSGPClientWithRawResponse:
523
538
  self.completions = completions.AsyncCompletionsResourceWithRawResponse(client.completions)
524
539
  self.chat = chat.AsyncChatResourceWithRawResponse(client.chat)
525
540
  self.inference = inference.AsyncInferenceResourceWithRawResponse(client.inference)
541
+ self.questions = questions.AsyncQuestionsResourceWithRawResponse(client.questions)
526
542
  self.files = files.AsyncFilesResourceWithRawResponse(client.files)
527
543
  self.models = models.AsyncModelsResourceWithRawResponse(client.models)
528
544
  self.datasets = datasets.AsyncDatasetsResourceWithRawResponse(client.datasets)
@@ -537,6 +553,7 @@ class SGPClientWithStreamedResponse:
537
553
  self.completions = completions.CompletionsResourceWithStreamingResponse(client.completions)
538
554
  self.chat = chat.ChatResourceWithStreamingResponse(client.chat)
539
555
  self.inference = inference.InferenceResourceWithStreamingResponse(client.inference)
556
+ self.questions = questions.QuestionsResourceWithStreamingResponse(client.questions)
540
557
  self.files = files.FilesResourceWithStreamingResponse(client.files)
541
558
  self.models = models.ModelsResourceWithStreamingResponse(client.models)
542
559
  self.datasets = datasets.DatasetsResourceWithStreamingResponse(client.datasets)
@@ -551,6 +568,7 @@ class AsyncSGPClientWithStreamedResponse:
551
568
  self.completions = completions.AsyncCompletionsResourceWithStreamingResponse(client.completions)
552
569
  self.chat = chat.AsyncChatResourceWithStreamingResponse(client.chat)
553
570
  self.inference = inference.AsyncInferenceResourceWithStreamingResponse(client.inference)
571
+ self.questions = questions.AsyncQuestionsResourceWithStreamingResponse(client.questions)
554
572
  self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
555
573
  self.models = models.AsyncModelsResourceWithStreamingResponse(client.models)
556
574
  self.datasets = datasets.AsyncDatasetsResourceWithStreamingResponse(client.datasets)
scale_gp_beta/_models.py CHANGED
@@ -2,9 +2,10 @@ from __future__ import annotations
2
2
 
3
3
  import os
4
4
  import inspect
5
- from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
5
+ from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
6
6
  from datetime import date, datetime
7
7
  from typing_extensions import (
8
+ List,
8
9
  Unpack,
9
10
  Literal,
10
11
  ClassVar,
@@ -366,7 +367,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
366
367
  if type_ is None:
367
368
  raise RuntimeError(f"Unexpected field type is None for {key}")
368
369
 
369
- return construct_type(value=value, type_=type_)
370
+ return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
370
371
 
371
372
 
372
373
  def is_basemodel(type_: type) -> bool:
@@ -420,7 +421,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
420
421
  return cast(_T, construct_type(value=value, type_=type_))
421
422
 
422
423
 
423
- def construct_type(*, value: object, type_: object) -> object:
424
+ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
424
425
  """Loose coercion to the expected type with construction of nested values.
425
426
 
426
427
  If the given value does not match the expected type then it is returned as-is.
@@ -438,8 +439,10 @@ def construct_type(*, value: object, type_: object) -> object:
438
439
  type_ = type_.__value__ # type: ignore[unreachable]
439
440
 
440
441
  # unwrap `Annotated[T, ...]` -> `T`
441
- if is_annotated_type(type_):
442
- meta: tuple[Any, ...] = get_args(type_)[1:]
442
+ if metadata is not None:
443
+ meta: tuple[Any, ...] = tuple(metadata)
444
+ elif is_annotated_type(type_):
445
+ meta = get_args(type_)[1:]
443
446
  type_ = extract_type_arg(type_, 0)
444
447
  else:
445
448
  meta = tuple()
scale_gp_beta/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "scale_gp_beta"
4
- __version__ = "0.1.0-alpha.24" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.26" # x-release-please-version
@@ -13,7 +13,7 @@ SpanInputParam = Dict[str, Any]
13
13
  SpanOutputParam = Dict[str, Any]
14
14
  SpanMetadataParam = Dict[str, Any]
15
15
 
16
- SpanStatusLiterals = Literal["SUCCESS", "ERROR"]
16
+ SpanStatusLiterals = Literal["SUCCESS", "ERROR", "CANCELED"]
17
17
 
18
18
  SpanTypeLiterals = Literal[
19
19
  "TEXT_INPUT",
@@ -30,8 +30,6 @@ SpanTypeLiterals = Literal[
30
30
  "DOCUMENT_SEARCH",
31
31
  "DOCUMENT_PROMPT",
32
32
  "CUSTOM",
33
- "INPUT_GUARDRAIL",
34
- "OUTPUT_GUARDRAIL",
35
33
  "CODE_EXECUTION",
36
34
  "DATA_MANIPULATION",
37
35
  "EVALUATION",
@@ -48,6 +48,14 @@ from .inference import (
48
48
  InferenceResourceWithStreamingResponse,
49
49
  AsyncInferenceResourceWithStreamingResponse,
50
50
  )
51
+ from .questions import (
52
+ QuestionsResource,
53
+ AsyncQuestionsResource,
54
+ QuestionsResourceWithRawResponse,
55
+ AsyncQuestionsResourceWithRawResponse,
56
+ QuestionsResourceWithStreamingResponse,
57
+ AsyncQuestionsResourceWithStreamingResponse,
58
+ )
51
59
  from .completions import (
52
60
  CompletionsResource,
53
61
  AsyncCompletionsResource,
@@ -100,6 +108,12 @@ __all__ = [
100
108
  "AsyncInferenceResourceWithRawResponse",
101
109
  "InferenceResourceWithStreamingResponse",
102
110
  "AsyncInferenceResourceWithStreamingResponse",
111
+ "QuestionsResource",
112
+ "AsyncQuestionsResource",
113
+ "QuestionsResourceWithRawResponse",
114
+ "AsyncQuestionsResourceWithRawResponse",
115
+ "QuestionsResourceWithStreamingResponse",
116
+ "AsyncQuestionsResourceWithStreamingResponse",
103
117
  "FilesResource",
104
118
  "AsyncFilesResource",
105
119
  "FilesResourceWithRawResponse",
@@ -536,6 +536,7 @@ class CompletionsResource(SyncAPIResource):
536
536
  "model_zoo",
537
537
  "bedrock",
538
538
  "xai",
539
+ "fireworks_ai",
539
540
  ]
540
541
  | NotGiven = NOT_GIVEN,
541
542
  sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
@@ -548,7 +549,7 @@ class CompletionsResource(SyncAPIResource):
548
549
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
549
550
  ) -> CompletionModelsResponse:
550
551
  """
551
- Chat Completions
552
+ List Chat Completion Models
552
553
 
553
554
  Args:
554
555
  extra_headers: Send extra headers
@@ -1090,6 +1091,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
1090
1091
  "model_zoo",
1091
1092
  "bedrock",
1092
1093
  "xai",
1094
+ "fireworks_ai",
1093
1095
  ]
1094
1096
  | NotGiven = NOT_GIVEN,
1095
1097
  sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
@@ -1102,7 +1104,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
1102
1104
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1103
1105
  ) -> CompletionModelsResponse:
1104
1106
  """
1105
- Chat Completions
1107
+ List Chat Completion Models
1106
1108
 
1107
1109
  Args:
1108
1110
  extra_headers: Send extra headers
@@ -317,6 +317,7 @@ class ModelsResource(SyncAPIResource):
317
317
  "model_zoo",
318
318
  "bedrock",
319
319
  "xai",
320
+ "fireworks_ai",
320
321
  ]
321
322
  | NotGiven = NOT_GIVEN,
322
323
  name: str | NotGiven = NOT_GIVEN,
@@ -689,6 +690,7 @@ class AsyncModelsResource(AsyncAPIResource):
689
690
  "model_zoo",
690
691
  "bedrock",
691
692
  "xai",
693
+ "fireworks_ai",
692
694
  ]
693
695
  | NotGiven = NOT_GIVEN,
694
696
  name: str | NotGiven = NOT_GIVEN,