scale-gp-beta 0.1.0a39__py3-none-any.whl → 0.1.0a41__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 (46) hide show
  1. scale_gp_beta/_base_client.py +140 -11
  2. scale_gp_beta/_client.py +602 -143
  3. scale_gp_beta/_models.py +16 -1
  4. scale_gp_beta/_streaming.py +12 -10
  5. scale_gp_beta/_types.py +12 -2
  6. scale_gp_beta/_version.py +1 -1
  7. scale_gp_beta/resources/__init__.py +14 -0
  8. scale_gp_beta/resources/build.py +582 -0
  9. scale_gp_beta/resources/chat/completions.py +4 -0
  10. scale_gp_beta/resources/credentials.py +4 -0
  11. scale_gp_beta/resources/dataset_items.py +4 -0
  12. scale_gp_beta/resources/datasets.py +4 -0
  13. scale_gp_beta/resources/evaluation_items.py +4 -0
  14. scale_gp_beta/resources/evaluations.py +4 -0
  15. scale_gp_beta/resources/files/files.py +4 -0
  16. scale_gp_beta/resources/models.py +4 -0
  17. scale_gp_beta/resources/questions.py +4 -0
  18. scale_gp_beta/resources/spans.py +28 -0
  19. scale_gp_beta/types/__init__.py +6 -0
  20. scale_gp_beta/types/build_cancel_response.py +38 -0
  21. scale_gp_beta/types/build_create_params.py +26 -0
  22. scale_gp_beta/types/build_create_response.py +38 -0
  23. scale_gp_beta/types/build_list_params.py +19 -0
  24. scale_gp_beta/types/build_list_response.py +38 -0
  25. scale_gp_beta/types/build_retrieve_response.py +38 -0
  26. scale_gp_beta/types/chat/completion_models_params.py +2 -0
  27. scale_gp_beta/types/credential_list_params.py +2 -0
  28. scale_gp_beta/types/dataset_item_list_params.py +2 -0
  29. scale_gp_beta/types/dataset_list_params.py +2 -0
  30. scale_gp_beta/types/evaluation.py +2 -0
  31. scale_gp_beta/types/evaluation_create_params.py +2 -0
  32. scale_gp_beta/types/evaluation_item_list_params.py +2 -0
  33. scale_gp_beta/types/evaluation_list_params.py +2 -0
  34. scale_gp_beta/types/evaluation_task.py +5 -1
  35. scale_gp_beta/types/evaluation_task_param.py +5 -1
  36. scale_gp_beta/types/file_import_from_cloud_response.py +4 -0
  37. scale_gp_beta/types/file_list_params.py +2 -0
  38. scale_gp_beta/types/inference_create_params.py +2 -0
  39. scale_gp_beta/types/model_list_params.py +2 -0
  40. scale_gp_beta/types/question_list_params.py +2 -0
  41. scale_gp_beta/types/span_assessment.py +2 -0
  42. scale_gp_beta/types/span_search_params.py +11 -0
  43. {scale_gp_beta-0.1.0a39.dist-info → scale_gp_beta-0.1.0a41.dist-info}/METADATA +14 -42
  44. {scale_gp_beta-0.1.0a39.dist-info → scale_gp_beta-0.1.0a41.dist-info}/RECORD +46 -39
  45. {scale_gp_beta-0.1.0a39.dist-info → scale_gp_beta-0.1.0a41.dist-info}/licenses/LICENSE +1 -1
  46. {scale_gp_beta-0.1.0a39.dist-info → scale_gp_beta-0.1.0a41.dist-info}/WHEEL +0 -0
scale_gp_beta/_models.py CHANGED
@@ -3,7 +3,20 @@ from __future__ import annotations
3
3
  import os
4
4
  import inspect
5
5
  import weakref
6
- from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
6
+ from typing import (
7
+ IO,
8
+ TYPE_CHECKING,
9
+ Any,
10
+ Type,
11
+ Union,
12
+ Generic,
13
+ TypeVar,
14
+ Callable,
15
+ Iterable,
16
+ Optional,
17
+ AsyncIterable,
18
+ cast,
19
+ )
7
20
  from datetime import date, datetime
8
21
  from typing_extensions import (
9
22
  List,
@@ -787,6 +800,7 @@ class FinalRequestOptionsInput(TypedDict, total=False):
787
800
  timeout: float | Timeout | None
788
801
  files: HttpxRequestFiles | None
789
802
  idempotency_key: str
803
+ content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None]
790
804
  json_data: Body
791
805
  extra_json: AnyMapping
792
806
  follow_redirects: bool
@@ -805,6 +819,7 @@ class FinalRequestOptions(pydantic.BaseModel):
805
819
  post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven()
806
820
  follow_redirects: Union[bool, None] = None
807
821
 
822
+ content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None
808
823
  # It should be noted that we cannot use `json` here as that would override
809
824
  # a BaseModel method in an incompatible fashion.
810
825
  json_data: Union[Body, None] = None
@@ -54,11 +54,12 @@ class Stream(Generic[_T]):
54
54
  process_data = self._client._process_response_data
55
55
  iterator = self._iter_events()
56
56
 
57
- for sse in iterator:
58
- yield process_data(data=sse.json(), cast_to=cast_to, response=response)
59
-
60
- # As we might not fully consume the response stream, we need to close it explicitly
61
- response.close()
57
+ try:
58
+ for sse in iterator:
59
+ yield process_data(data=sse.json(), cast_to=cast_to, response=response)
60
+ finally:
61
+ # Ensure the response is closed even if the consumer doesn't read all data
62
+ response.close()
62
63
 
63
64
  def __enter__(self) -> Self:
64
65
  return self
@@ -117,11 +118,12 @@ class AsyncStream(Generic[_T]):
117
118
  process_data = self._client._process_response_data
118
119
  iterator = self._iter_events()
119
120
 
120
- async for sse in iterator:
121
- yield process_data(data=sse.json(), cast_to=cast_to, response=response)
122
-
123
- # As we might not fully consume the response stream, we need to close it explicitly
124
- await response.aclose()
121
+ try:
122
+ async for sse in iterator:
123
+ yield process_data(data=sse.json(), cast_to=cast_to, response=response)
124
+ finally:
125
+ # Ensure the response is closed even if the consumer doesn't read all data
126
+ await response.aclose()
125
127
 
126
128
  async def __aenter__(self) -> Self:
127
129
  return self
scale_gp_beta/_types.py CHANGED
@@ -13,9 +13,11 @@ from typing import (
13
13
  Mapping,
14
14
  TypeVar,
15
15
  Callable,
16
+ Iterable,
16
17
  Iterator,
17
18
  Optional,
18
19
  Sequence,
20
+ AsyncIterable,
19
21
  )
20
22
  from typing_extensions import (
21
23
  Set,
@@ -56,6 +58,13 @@ if TYPE_CHECKING:
56
58
  else:
57
59
  Base64FileInput = Union[IO[bytes], PathLike]
58
60
  FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8.
61
+
62
+
63
+ # Used for sending raw binary data / streaming data in request bodies
64
+ # e.g. for file uploads without multipart encoding
65
+ BinaryTypes = Union[bytes, bytearray, IO[bytes], Iterable[bytes]]
66
+ AsyncBinaryTypes = Union[bytes, bytearray, IO[bytes], AsyncIterable[bytes]]
67
+
59
68
  FileTypes = Union[
60
69
  # file (or bytes)
61
70
  FileContent,
@@ -243,6 +252,9 @@ _T_co = TypeVar("_T_co", covariant=True)
243
252
  if TYPE_CHECKING:
244
253
  # This works because str.__contains__ does not accept object (either in typeshed or at runtime)
245
254
  # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
255
+ #
256
+ # Note: index() and count() methods are intentionally omitted to allow pyright to properly
257
+ # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr.
246
258
  class SequenceNotStr(Protocol[_T_co]):
247
259
  @overload
248
260
  def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
@@ -251,8 +263,6 @@ if TYPE_CHECKING:
251
263
  def __contains__(self, value: object, /) -> bool: ...
252
264
  def __len__(self) -> int: ...
253
265
  def __iter__(self) -> Iterator[_T_co]: ...
254
- def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
255
- def count(self, value: Any, /) -> int: ...
256
266
  def __reversed__(self) -> Iterator[_T_co]: ...
257
267
  else:
258
268
  # just point this to a normal `Sequence` at runtime to avoid having to special case
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.39" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.41" # x-release-please-version
@@ -8,6 +8,14 @@ from .chat import (
8
8
  ChatResourceWithStreamingResponse,
9
9
  AsyncChatResourceWithStreamingResponse,
10
10
  )
11
+ from .build import (
12
+ BuildResource,
13
+ AsyncBuildResource,
14
+ BuildResourceWithRawResponse,
15
+ AsyncBuildResourceWithRawResponse,
16
+ BuildResourceWithStreamingResponse,
17
+ AsyncBuildResourceWithStreamingResponse,
18
+ )
11
19
  from .files import (
12
20
  FilesResource,
13
21
  AsyncFilesResource,
@@ -198,4 +206,10 @@ __all__ = [
198
206
  "AsyncCredentialsResourceWithRawResponse",
199
207
  "CredentialsResourceWithStreamingResponse",
200
208
  "AsyncCredentialsResourceWithStreamingResponse",
209
+ "BuildResource",
210
+ "AsyncBuildResource",
211
+ "BuildResourceWithRawResponse",
212
+ "AsyncBuildResourceWithRawResponse",
213
+ "BuildResourceWithStreamingResponse",
214
+ "AsyncBuildResourceWithStreamingResponse",
201
215
  ]