scale-gp-beta 0.1.0a42__py3-none-any.whl → 0.1.0a43__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/_base_client.py +5 -2
- scale_gp_beta/_client.py +38 -0
- scale_gp_beta/_compat.py +3 -3
- scale_gp_beta/_utils/_json.py +35 -0
- scale_gp_beta/_version.py +1 -1
- scale_gp_beta/resources/__init__.py +14 -0
- scale_gp_beta/resources/vector_stores.py +1314 -0
- scale_gp_beta/types/__init__.py +15 -0
- scale_gp_beta/types/vector_store.py +42 -0
- scale_gp_beta/types/vector_store_configure_params.py +16 -0
- scale_gp_beta/types/vector_store_count_params.py +13 -0
- scale_gp_beta/types/vector_store_count_response.py +12 -0
- scale_gp_beta/types/vector_store_create_params.py +35 -0
- scale_gp_beta/types/vector_store_delete_params.py +18 -0
- scale_gp_beta/types/vector_store_delete_response.py +12 -0
- scale_gp_beta/types/vector_store_drop_response.py +12 -0
- scale_gp_beta/types/vector_store_list_params.py +19 -0
- scale_gp_beta/types/vector_store_query_params.py +34 -0
- scale_gp_beta/types/vector_store_query_response.py +61 -0
- scale_gp_beta/types/vector_store_upsert_params.py +29 -0
- scale_gp_beta/types/vector_store_upsert_response.py +23 -0
- scale_gp_beta/types/vector_store_vectors_params.py +21 -0
- scale_gp_beta/types/vector_store_vectors_response.py +36 -0
- {scale_gp_beta-0.1.0a42.dist-info → scale_gp_beta-0.1.0a43.dist-info}/METADATA +3 -3
- {scale_gp_beta-0.1.0a42.dist-info → scale_gp_beta-0.1.0a43.dist-info}/RECORD +27 -10
- {scale_gp_beta-0.1.0a42.dist-info → scale_gp_beta-0.1.0a43.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a42.dist-info → scale_gp_beta-0.1.0a43.dist-info}/licenses/LICENSE +0 -0
scale_gp_beta/_base_client.py
CHANGED
|
@@ -86,6 +86,7 @@ from ._exceptions import (
|
|
|
86
86
|
APIConnectionError,
|
|
87
87
|
APIResponseValidationError,
|
|
88
88
|
)
|
|
89
|
+
from ._utils._json import openapi_dumps
|
|
89
90
|
|
|
90
91
|
log: logging.Logger = logging.getLogger(__name__)
|
|
91
92
|
|
|
@@ -554,8 +555,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
554
555
|
kwargs["content"] = options.content
|
|
555
556
|
elif isinstance(json_data, bytes):
|
|
556
557
|
kwargs["content"] = json_data
|
|
557
|
-
|
|
558
|
-
|
|
558
|
+
elif not files:
|
|
559
|
+
# Don't set content when JSON is sent as multipart/form-data,
|
|
560
|
+
# since httpx's content param overrides other body arguments
|
|
561
|
+
kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None
|
|
559
562
|
kwargs["files"] = files
|
|
560
563
|
else:
|
|
561
564
|
headers.pop("Content-Type", None)
|
scale_gp_beta/_client.py
CHANGED
|
@@ -45,6 +45,7 @@ if TYPE_CHECKING:
|
|
|
45
45
|
credentials,
|
|
46
46
|
evaluations,
|
|
47
47
|
dataset_items,
|
|
48
|
+
vector_stores,
|
|
48
49
|
evaluation_items,
|
|
49
50
|
span_assessments,
|
|
50
51
|
)
|
|
@@ -61,6 +62,7 @@ if TYPE_CHECKING:
|
|
|
61
62
|
from .resources.evaluations import EvaluationsResource, AsyncEvaluationsResource
|
|
62
63
|
from .resources.files.files import FilesResource, AsyncFilesResource
|
|
63
64
|
from .resources.dataset_items import DatasetItemsResource, AsyncDatasetItemsResource
|
|
65
|
+
from .resources.vector_stores import VectorStoresResource, AsyncVectorStoresResource
|
|
64
66
|
from .resources.evaluation_items import EvaluationItemsResource, AsyncEvaluationItemsResource
|
|
65
67
|
from .resources.span_assessments import SpanAssessmentsResource, AsyncSpanAssessmentsResource
|
|
66
68
|
|
|
@@ -265,6 +267,12 @@ class SGPClient(SyncAPIClient):
|
|
|
265
267
|
|
|
266
268
|
return BuildResource(self)
|
|
267
269
|
|
|
270
|
+
@cached_property
|
|
271
|
+
def vector_stores(self) -> VectorStoresResource:
|
|
272
|
+
from .resources.vector_stores import VectorStoresResource
|
|
273
|
+
|
|
274
|
+
return VectorStoresResource(self)
|
|
275
|
+
|
|
268
276
|
@cached_property
|
|
269
277
|
def with_raw_response(self) -> SGPClientWithRawResponse:
|
|
270
278
|
return SGPClientWithRawResponse(self)
|
|
@@ -566,6 +574,12 @@ class AsyncSGPClient(AsyncAPIClient):
|
|
|
566
574
|
|
|
567
575
|
return AsyncBuildResource(self)
|
|
568
576
|
|
|
577
|
+
@cached_property
|
|
578
|
+
def vector_stores(self) -> AsyncVectorStoresResource:
|
|
579
|
+
from .resources.vector_stores import AsyncVectorStoresResource
|
|
580
|
+
|
|
581
|
+
return AsyncVectorStoresResource(self)
|
|
582
|
+
|
|
569
583
|
@cached_property
|
|
570
584
|
def with_raw_response(self) -> AsyncSGPClientWithRawResponse:
|
|
571
585
|
return AsyncSGPClientWithRawResponse(self)
|
|
@@ -780,6 +794,12 @@ class SGPClientWithRawResponse:
|
|
|
780
794
|
|
|
781
795
|
return BuildResourceWithRawResponse(self._client.build)
|
|
782
796
|
|
|
797
|
+
@cached_property
|
|
798
|
+
def vector_stores(self) -> vector_stores.VectorStoresResourceWithRawResponse:
|
|
799
|
+
from .resources.vector_stores import VectorStoresResourceWithRawResponse
|
|
800
|
+
|
|
801
|
+
return VectorStoresResourceWithRawResponse(self._client.vector_stores)
|
|
802
|
+
|
|
783
803
|
|
|
784
804
|
class AsyncSGPClientWithRawResponse:
|
|
785
805
|
_client: AsyncSGPClient
|
|
@@ -877,6 +897,12 @@ class AsyncSGPClientWithRawResponse:
|
|
|
877
897
|
|
|
878
898
|
return AsyncBuildResourceWithRawResponse(self._client.build)
|
|
879
899
|
|
|
900
|
+
@cached_property
|
|
901
|
+
def vector_stores(self) -> vector_stores.AsyncVectorStoresResourceWithRawResponse:
|
|
902
|
+
from .resources.vector_stores import AsyncVectorStoresResourceWithRawResponse
|
|
903
|
+
|
|
904
|
+
return AsyncVectorStoresResourceWithRawResponse(self._client.vector_stores)
|
|
905
|
+
|
|
880
906
|
|
|
881
907
|
class SGPClientWithStreamedResponse:
|
|
882
908
|
_client: SGPClient
|
|
@@ -974,6 +1000,12 @@ class SGPClientWithStreamedResponse:
|
|
|
974
1000
|
|
|
975
1001
|
return BuildResourceWithStreamingResponse(self._client.build)
|
|
976
1002
|
|
|
1003
|
+
@cached_property
|
|
1004
|
+
def vector_stores(self) -> vector_stores.VectorStoresResourceWithStreamingResponse:
|
|
1005
|
+
from .resources.vector_stores import VectorStoresResourceWithStreamingResponse
|
|
1006
|
+
|
|
1007
|
+
return VectorStoresResourceWithStreamingResponse(self._client.vector_stores)
|
|
1008
|
+
|
|
977
1009
|
|
|
978
1010
|
class AsyncSGPClientWithStreamedResponse:
|
|
979
1011
|
_client: AsyncSGPClient
|
|
@@ -1071,6 +1103,12 @@ class AsyncSGPClientWithStreamedResponse:
|
|
|
1071
1103
|
|
|
1072
1104
|
return AsyncBuildResourceWithStreamingResponse(self._client.build)
|
|
1073
1105
|
|
|
1106
|
+
@cached_property
|
|
1107
|
+
def vector_stores(self) -> vector_stores.AsyncVectorStoresResourceWithStreamingResponse:
|
|
1108
|
+
from .resources.vector_stores import AsyncVectorStoresResourceWithStreamingResponse
|
|
1109
|
+
|
|
1110
|
+
return AsyncVectorStoresResourceWithStreamingResponse(self._client.vector_stores)
|
|
1111
|
+
|
|
1074
1112
|
|
|
1075
1113
|
Client = SGPClient
|
|
1076
1114
|
|
scale_gp_beta/_compat.py
CHANGED
|
@@ -139,6 +139,7 @@ def model_dump(
|
|
|
139
139
|
exclude_defaults: bool = False,
|
|
140
140
|
warnings: bool = True,
|
|
141
141
|
mode: Literal["json", "python"] = "python",
|
|
142
|
+
by_alias: bool | None = None,
|
|
142
143
|
) -> dict[str, Any]:
|
|
143
144
|
if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
|
|
144
145
|
return model.model_dump(
|
|
@@ -148,13 +149,12 @@ def model_dump(
|
|
|
148
149
|
exclude_defaults=exclude_defaults,
|
|
149
150
|
# warnings are not supported in Pydantic v1
|
|
150
151
|
warnings=True if PYDANTIC_V1 else warnings,
|
|
152
|
+
by_alias=by_alias,
|
|
151
153
|
)
|
|
152
154
|
return cast(
|
|
153
155
|
"dict[str, Any]",
|
|
154
156
|
model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
|
|
155
|
-
exclude=exclude,
|
|
156
|
-
exclude_unset=exclude_unset,
|
|
157
|
-
exclude_defaults=exclude_defaults,
|
|
157
|
+
exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias)
|
|
158
158
|
),
|
|
159
159
|
)
|
|
160
160
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import Any
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing_extensions import override
|
|
5
|
+
|
|
6
|
+
import pydantic
|
|
7
|
+
|
|
8
|
+
from .._compat import model_dump
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def openapi_dumps(obj: Any) -> bytes:
|
|
12
|
+
"""
|
|
13
|
+
Serialize an object to UTF-8 encoded JSON bytes.
|
|
14
|
+
|
|
15
|
+
Extends the standard json.dumps with support for additional types
|
|
16
|
+
commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc.
|
|
17
|
+
"""
|
|
18
|
+
return json.dumps(
|
|
19
|
+
obj,
|
|
20
|
+
cls=_CustomEncoder,
|
|
21
|
+
# Uses the same defaults as httpx's JSON serialization
|
|
22
|
+
ensure_ascii=False,
|
|
23
|
+
separators=(",", ":"),
|
|
24
|
+
allow_nan=False,
|
|
25
|
+
).encode()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class _CustomEncoder(json.JSONEncoder):
|
|
29
|
+
@override
|
|
30
|
+
def default(self, o: Any) -> Any:
|
|
31
|
+
if isinstance(o, datetime):
|
|
32
|
+
return o.isoformat()
|
|
33
|
+
if isinstance(o, pydantic.BaseModel):
|
|
34
|
+
return model_dump(o, exclude_unset=True, mode="json", by_alias=True)
|
|
35
|
+
return super().default(o)
|
scale_gp_beta/_version.py
CHANGED
|
@@ -104,6 +104,14 @@ from .dataset_items import (
|
|
|
104
104
|
DatasetItemsResourceWithStreamingResponse,
|
|
105
105
|
AsyncDatasetItemsResourceWithStreamingResponse,
|
|
106
106
|
)
|
|
107
|
+
from .vector_stores import (
|
|
108
|
+
VectorStoresResource,
|
|
109
|
+
AsyncVectorStoresResource,
|
|
110
|
+
VectorStoresResourceWithRawResponse,
|
|
111
|
+
AsyncVectorStoresResourceWithRawResponse,
|
|
112
|
+
VectorStoresResourceWithStreamingResponse,
|
|
113
|
+
AsyncVectorStoresResourceWithStreamingResponse,
|
|
114
|
+
)
|
|
107
115
|
from .evaluation_items import (
|
|
108
116
|
EvaluationItemsResource,
|
|
109
117
|
AsyncEvaluationItemsResource,
|
|
@@ -212,4 +220,10 @@ __all__ = [
|
|
|
212
220
|
"AsyncBuildResourceWithRawResponse",
|
|
213
221
|
"BuildResourceWithStreamingResponse",
|
|
214
222
|
"AsyncBuildResourceWithStreamingResponse",
|
|
223
|
+
"VectorStoresResource",
|
|
224
|
+
"AsyncVectorStoresResource",
|
|
225
|
+
"VectorStoresResourceWithRawResponse",
|
|
226
|
+
"AsyncVectorStoresResourceWithRawResponse",
|
|
227
|
+
"VectorStoresResourceWithStreamingResponse",
|
|
228
|
+
"AsyncVectorStoresResourceWithStreamingResponse",
|
|
215
229
|
]
|