Skip to content

Commit 25d2067

Browse files
feat(sdk): untoggle to force regen
1 parent cf60482 commit 25d2067

File tree

9 files changed

+476
-3
lines changed

9 files changed

+476
-3
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 3
1+
configured_endpoints: 4
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-30c23c1facb9383eb94d78d16d6a45b7e6afd943caf94cddeb75fd86357294f7.yml
33
openapi_spec_hash: 48a6b3192add4f538615ac6f190123c5
4-
config_hash: 83740a990f84ee8d189fc4071a009a83
4+
config_hash: 886b5eef0dbd90b8e6686e987a07b816

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# Embeddings
2+
3+
Types:
4+
5+
```python
6+
from isaacus.types import Embedding
7+
```
8+
9+
Methods:
10+
11+
- <code title="post /embeddings">client.embeddings.<a href="./src/isaacus/resources/embeddings.py">create</a>(\*\*<a href="src/isaacus/types/embedding_create_params.py">params</a>) -> <a href="./src/isaacus/types/embedding.py">Embedding</a></code>
12+
113
# Classifications
214

315
## Universal

src/isaacus/_client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
)
2222
from ._utils import is_given, get_async_library
2323
from ._version import __version__
24-
from .resources import rerankings
24+
from .resources import embeddings, rerankings
2525
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2626
from ._exceptions import IsaacusError, APIStatusError
2727
from ._base_client import (
@@ -36,6 +36,7 @@
3636

3737

3838
class Isaacus(SyncAPIClient):
39+
embeddings: embeddings.EmbeddingsResource
3940
classifications: classifications.ClassificationsResource
4041
rerankings: rerankings.RerankingsResource
4142
extractions: extractions.ExtractionsResource
@@ -96,6 +97,7 @@ def __init__(
9697
_strict_response_validation=_strict_response_validation,
9798
)
9899

100+
self.embeddings = embeddings.EmbeddingsResource(self)
99101
self.classifications = classifications.ClassificationsResource(self)
100102
self.rerankings = rerankings.RerankingsResource(self)
101103
self.extractions = extractions.ExtractionsResource(self)
@@ -208,6 +210,7 @@ def _make_status_error(
208210

209211

210212
class AsyncIsaacus(AsyncAPIClient):
213+
embeddings: embeddings.AsyncEmbeddingsResource
211214
classifications: classifications.AsyncClassificationsResource
212215
rerankings: rerankings.AsyncRerankingsResource
213216
extractions: extractions.AsyncExtractionsResource
@@ -268,6 +271,7 @@ def __init__(
268271
_strict_response_validation=_strict_response_validation,
269272
)
270273

274+
self.embeddings = embeddings.AsyncEmbeddingsResource(self)
271275
self.classifications = classifications.AsyncClassificationsResource(self)
272276
self.rerankings = rerankings.AsyncRerankingsResource(self)
273277
self.extractions = extractions.AsyncExtractionsResource(self)
@@ -381,27 +385,31 @@ def _make_status_error(
381385

382386
class IsaacusWithRawResponse:
383387
def __init__(self, client: Isaacus) -> None:
388+
self.embeddings = embeddings.EmbeddingsResourceWithRawResponse(client.embeddings)
384389
self.classifications = classifications.ClassificationsResourceWithRawResponse(client.classifications)
385390
self.rerankings = rerankings.RerankingsResourceWithRawResponse(client.rerankings)
386391
self.extractions = extractions.ExtractionsResourceWithRawResponse(client.extractions)
387392

388393

389394
class AsyncIsaacusWithRawResponse:
390395
def __init__(self, client: AsyncIsaacus) -> None:
396+
self.embeddings = embeddings.AsyncEmbeddingsResourceWithRawResponse(client.embeddings)
391397
self.classifications = classifications.AsyncClassificationsResourceWithRawResponse(client.classifications)
392398
self.rerankings = rerankings.AsyncRerankingsResourceWithRawResponse(client.rerankings)
393399
self.extractions = extractions.AsyncExtractionsResourceWithRawResponse(client.extractions)
394400

395401

396402
class IsaacusWithStreamedResponse:
397403
def __init__(self, client: Isaacus) -> None:
404+
self.embeddings = embeddings.EmbeddingsResourceWithStreamingResponse(client.embeddings)
398405
self.classifications = classifications.ClassificationsResourceWithStreamingResponse(client.classifications)
399406
self.rerankings = rerankings.RerankingsResourceWithStreamingResponse(client.rerankings)
400407
self.extractions = extractions.ExtractionsResourceWithStreamingResponse(client.extractions)
401408

402409

403410
class AsyncIsaacusWithStreamedResponse:
404411
def __init__(self, client: AsyncIsaacus) -> None:
412+
self.embeddings = embeddings.AsyncEmbeddingsResourceWithStreamingResponse(client.embeddings)
405413
self.classifications = classifications.AsyncClassificationsResourceWithStreamingResponse(client.classifications)
406414
self.rerankings = rerankings.AsyncRerankingsResourceWithStreamingResponse(client.rerankings)
407415
self.extractions = extractions.AsyncExtractionsResourceWithStreamingResponse(client.extractions)

src/isaacus/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from .embeddings import (
4+
EmbeddingsResource,
5+
AsyncEmbeddingsResource,
6+
EmbeddingsResourceWithRawResponse,
7+
AsyncEmbeddingsResourceWithRawResponse,
8+
EmbeddingsResourceWithStreamingResponse,
9+
AsyncEmbeddingsResourceWithStreamingResponse,
10+
)
311
from .rerankings import (
412
RerankingsResource,
513
AsyncRerankingsResource,
@@ -26,6 +34,12 @@
2634
)
2735

2836
__all__ = [
37+
"EmbeddingsResource",
38+
"AsyncEmbeddingsResource",
39+
"EmbeddingsResourceWithRawResponse",
40+
"AsyncEmbeddingsResourceWithRawResponse",
41+
"EmbeddingsResourceWithStreamingResponse",
42+
"AsyncEmbeddingsResourceWithStreamingResponse",
2943
"ClassificationsResource",
3044
"AsyncClassificationsResource",
3145
"ClassificationsResourceWithRawResponse",
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
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 Union, Optional
6+
from typing_extensions import Literal
7+
8+
import httpx
9+
10+
from ..types import embedding_create_params
11+
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
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.embedding import Embedding
23+
24+
__all__ = ["EmbeddingsResource", "AsyncEmbeddingsResource"]
25+
26+
27+
class EmbeddingsResource(SyncAPIResource):
28+
@cached_property
29+
def with_raw_response(self) -> EmbeddingsResourceWithRawResponse:
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/isaacus-dev/isaacus-python#accessing-raw-response-data-eg-headers
35+
"""
36+
return EmbeddingsResourceWithRawResponse(self)
37+
38+
@cached_property
39+
def with_streaming_response(self) -> EmbeddingsResourceWithStreamingResponse:
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/isaacus-dev/isaacus-python#with_streaming_response
44+
"""
45+
return EmbeddingsResourceWithStreamingResponse(self)
46+
47+
def create(
48+
self,
49+
*,
50+
model: Literal["kanon-2-embedder"],
51+
texts: Union[SequenceNotStr[str], str],
52+
dimensions: Optional[int] | Omit = omit,
53+
overflow_strategy: Optional[Literal["drop_end"]] | Omit = omit,
54+
task: Optional[Literal["retrieval/query", "retrieval/document"]] | Omit = omit,
55+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
56+
# The extra values given here take precedence over values defined on the client or passed to this method.
57+
extra_headers: Headers | None = None,
58+
extra_query: Query | None = None,
59+
extra_body: Body | None = None,
60+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
61+
) -> Embedding:
62+
"""
63+
Embed legal texts with an Isaacus legal AI embedder.
64+
65+
Args:
66+
model: The ID of the [model](https://docs.isaacus.com/models#embedding) to use for
67+
embedding.
68+
69+
texts: The text or array of texts to embed.
70+
71+
Each text must contain at least one non-whitespace character.
72+
73+
No more than 1,000 texts can be embedded in a single request.
74+
75+
dimensions: A whole number greater than or equal to 1.
76+
77+
overflow_strategy: The strategy to employ when content exceeds the model's maximum input length.
78+
79+
`drop_end`, which is the default setting, drops tokens from the end of the
80+
content exceeding the limit.
81+
82+
If `null`, an error will be raised if any content exceeds the model's maximum
83+
input length.
84+
85+
task: The task the embeddings will be used for.
86+
87+
`retrieval/query` is meant for queries and statements, and `retrieval/document`
88+
is meant for anything to be retrieved using query embeddings.
89+
90+
If `null`, which is the default setting, embeddings will not be optimized for
91+
any particular task.
92+
93+
extra_headers: Send extra headers
94+
95+
extra_query: Add additional query parameters to the request
96+
97+
extra_body: Add additional JSON properties to the request
98+
99+
timeout: Override the client-level default timeout for this request, in seconds
100+
"""
101+
return self._post(
102+
"/embeddings",
103+
body=maybe_transform(
104+
{
105+
"model": model,
106+
"texts": texts,
107+
"dimensions": dimensions,
108+
"overflow_strategy": overflow_strategy,
109+
"task": task,
110+
},
111+
embedding_create_params.EmbeddingCreateParams,
112+
),
113+
options=make_request_options(
114+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
115+
),
116+
cast_to=Embedding,
117+
)
118+
119+
120+
class AsyncEmbeddingsResource(AsyncAPIResource):
121+
@cached_property
122+
def with_raw_response(self) -> AsyncEmbeddingsResourceWithRawResponse:
123+
"""
124+
This property can be used as a prefix for any HTTP method call to return
125+
the raw response object instead of the parsed content.
126+
127+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#accessing-raw-response-data-eg-headers
128+
"""
129+
return AsyncEmbeddingsResourceWithRawResponse(self)
130+
131+
@cached_property
132+
def with_streaming_response(self) -> AsyncEmbeddingsResourceWithStreamingResponse:
133+
"""
134+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
135+
136+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#with_streaming_response
137+
"""
138+
return AsyncEmbeddingsResourceWithStreamingResponse(self)
139+
140+
async def create(
141+
self,
142+
*,
143+
model: Literal["kanon-2-embedder"],
144+
texts: Union[SequenceNotStr[str], str],
145+
dimensions: Optional[int] | Omit = omit,
146+
overflow_strategy: Optional[Literal["drop_end"]] | Omit = omit,
147+
task: Optional[Literal["retrieval/query", "retrieval/document"]] | Omit = omit,
148+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
149+
# The extra values given here take precedence over values defined on the client or passed to this method.
150+
extra_headers: Headers | None = None,
151+
extra_query: Query | None = None,
152+
extra_body: Body | None = None,
153+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
154+
) -> Embedding:
155+
"""
156+
Embed legal texts with an Isaacus legal AI embedder.
157+
158+
Args:
159+
model: The ID of the [model](https://docs.isaacus.com/models#embedding) to use for
160+
embedding.
161+
162+
texts: The text or array of texts to embed.
163+
164+
Each text must contain at least one non-whitespace character.
165+
166+
No more than 1,000 texts can be embedded in a single request.
167+
168+
dimensions: A whole number greater than or equal to 1.
169+
170+
overflow_strategy: The strategy to employ when content exceeds the model's maximum input length.
171+
172+
`drop_end`, which is the default setting, drops tokens from the end of the
173+
content exceeding the limit.
174+
175+
If `null`, an error will be raised if any content exceeds the model's maximum
176+
input length.
177+
178+
task: The task the embeddings will be used for.
179+
180+
`retrieval/query` is meant for queries and statements, and `retrieval/document`
181+
is meant for anything to be retrieved using query embeddings.
182+
183+
If `null`, which is the default setting, embeddings will not be optimized for
184+
any particular task.
185+
186+
extra_headers: Send extra headers
187+
188+
extra_query: Add additional query parameters to the request
189+
190+
extra_body: Add additional JSON properties to the request
191+
192+
timeout: Override the client-level default timeout for this request, in seconds
193+
"""
194+
return await self._post(
195+
"/embeddings",
196+
body=await async_maybe_transform(
197+
{
198+
"model": model,
199+
"texts": texts,
200+
"dimensions": dimensions,
201+
"overflow_strategy": overflow_strategy,
202+
"task": task,
203+
},
204+
embedding_create_params.EmbeddingCreateParams,
205+
),
206+
options=make_request_options(
207+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
208+
),
209+
cast_to=Embedding,
210+
)
211+
212+
213+
class EmbeddingsResourceWithRawResponse:
214+
def __init__(self, embeddings: EmbeddingsResource) -> None:
215+
self._embeddings = embeddings
216+
217+
self.create = to_raw_response_wrapper(
218+
embeddings.create,
219+
)
220+
221+
222+
class AsyncEmbeddingsResourceWithRawResponse:
223+
def __init__(self, embeddings: AsyncEmbeddingsResource) -> None:
224+
self._embeddings = embeddings
225+
226+
self.create = async_to_raw_response_wrapper(
227+
embeddings.create,
228+
)
229+
230+
231+
class EmbeddingsResourceWithStreamingResponse:
232+
def __init__(self, embeddings: EmbeddingsResource) -> None:
233+
self._embeddings = embeddings
234+
235+
self.create = to_streamed_response_wrapper(
236+
embeddings.create,
237+
)
238+
239+
240+
class AsyncEmbeddingsResourceWithStreamingResponse:
241+
def __init__(self, embeddings: AsyncEmbeddingsResource) -> None:
242+
self._embeddings = embeddings
243+
244+
self.create = async_to_streamed_response_wrapper(
245+
embeddings.create,
246+
)

src/isaacus/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22

33
from __future__ import annotations
44

5+
from .embedding import Embedding as Embedding
56
from .reranking import Reranking as Reranking
7+
from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams
68
from .reranking_create_params import RerankingCreateParams as RerankingCreateParams

src/isaacus/types/embedding.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List
4+
5+
from .._models import BaseModel
6+
7+
__all__ = ["Embedding", "Usage"]
8+
9+
10+
class Usage(BaseModel):
11+
input_tokens: int
12+
"""The number of tokens inputted to the model."""
13+
14+
15+
class Embedding(BaseModel):
16+
embeddings: List[Embedding]
17+
"""The embeddings of the inputs."""
18+
19+
usage: Usage
20+
"""Statistics about the usage of resources in the process of embedding the inputs."""

0 commit comments

Comments
 (0)