Skip to content

Commit b934279

Browse files
feat(api): revert embedding -> embeddings
1 parent 3074c3a commit b934279

File tree

7 files changed

+24
-35
lines changed

7 files changed

+24
-35
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 4
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-fcd541cb8fbd03d20e7f02e296ee5fe35e7e6535a6926bd46cd1c4e8423b91ff.yml
3-
openapi_spec_hash: 8c588c5cc113ffe42c5aa9ada04169ab
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-e92a3b3731be1b1223f26fce1a50165c75ea209097e89a530a6123a59c672898.yml
3+
openapi_spec_hash: ba79dfb28159963468d872e717579e94
44
config_hash: 886b5eef0dbd90b8e6686e987a07b816

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
Types:
44

55
```python
6-
from isaacus.types import EmbeddingCreateResponse
6+
from isaacus.types import Embedding
77
```
88

99
Methods:
1010

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_create_response.py">EmbeddingCreateResponse</a></code>
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>
1212

1313
# Classifications
1414

src/isaacus/resources/embeddings.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
async_to_streamed_response_wrapper,
2020
)
2121
from .._base_client import make_request_options
22-
from ..types.embedding_create_response import EmbeddingCreateResponse
22+
from ..types.embedding import Embedding
2323

2424
__all__ = ["EmbeddingsResource", "AsyncEmbeddingsResource"]
2525

@@ -58,12 +58,12 @@ def create(
5858
extra_query: Query | None = None,
5959
extra_body: Body | None = None,
6060
timeout: float | httpx.Timeout | None | NotGiven = not_given,
61-
) -> EmbeddingCreateResponse:
61+
) -> Embedding:
6262
"""
6363
Embed legal texts with an Isaacus legal AI embedder.
6464
6565
Args:
66-
model: The ID of the [model](https://docs.isaacus.com/models#embeddings) to use for
66+
model: The ID of the [model](https://docs.isaacus.com/models#embedding) to use for
6767
embedding.
6868
6969
texts: The text or array of texts to embed.
@@ -113,7 +113,7 @@ def create(
113113
options=make_request_options(
114114
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
115115
),
116-
cast_to=EmbeddingCreateResponse,
116+
cast_to=Embedding,
117117
)
118118

119119

@@ -151,12 +151,12 @@ async def create(
151151
extra_query: Query | None = None,
152152
extra_body: Body | None = None,
153153
timeout: float | httpx.Timeout | None | NotGiven = not_given,
154-
) -> EmbeddingCreateResponse:
154+
) -> Embedding:
155155
"""
156156
Embed legal texts with an Isaacus legal AI embedder.
157157
158158
Args:
159-
model: The ID of the [model](https://docs.isaacus.com/models#embeddings) to use for
159+
model: The ID of the [model](https://docs.isaacus.com/models#embedding) to use for
160160
embedding.
161161
162162
texts: The text or array of texts to embed.
@@ -206,7 +206,7 @@ async def create(
206206
options=make_request_options(
207207
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
208208
),
209-
cast_to=EmbeddingCreateResponse,
209+
cast_to=Embedding,
210210
)
211211

212212

src/isaacus/types/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5+
from .embedding import Embedding as Embedding
56
from .reranking import Reranking as Reranking
67
from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams
78
from .reranking_create_params import RerankingCreateParams as RerankingCreateParams
8-
from .embedding_create_response import EmbeddingCreateResponse as EmbeddingCreateResponse

src/isaacus/types/embedding_create_response.py renamed to src/isaacus/types/embedding.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,15 @@
44

55
from .._models import BaseModel
66

7-
__all__ = ["EmbeddingCreateResponse", "Embedding", "Usage"]
8-
9-
10-
class Embedding(BaseModel):
11-
embedding: List[float]
12-
"""The embedding of the content represented as an array of floating point numbers."""
13-
14-
index: int
15-
"""
16-
The position of the content in the input array of contents, starting from `0`
17-
(and, therefore, ending at the number of contents minus `1`).
18-
"""
7+
__all__ = ["Embedding", "Usage"]
198

209

2110
class Usage(BaseModel):
2211
input_tokens: int
2312
"""The number of tokens inputted to the model."""
2413

2514

26-
class EmbeddingCreateResponse(BaseModel):
15+
class Embedding(BaseModel):
2716
embeddings: List[Embedding]
2817
"""The embeddings of the inputs."""
2918

src/isaacus/types/embedding_create_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class EmbeddingCreateParams(TypedDict, total=False):
1414
model: Required[Literal["kanon-2-embedder"]]
1515
"""
16-
The ID of the [model](https://docs.isaacus.com/models#embeddings) to use for
16+
The ID of the [model](https://docs.isaacus.com/models#embedding) to use for
1717
embedding.
1818
"""
1919

tests/api_resources/test_embeddings.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from isaacus import Isaacus, AsyncIsaacus
1111
from tests.utils import assert_matches_type
12-
from isaacus.types import EmbeddingCreateResponse
12+
from isaacus.types import Embedding
1313

1414
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1515

@@ -24,7 +24,7 @@ def test_method_create(self, client: Isaacus) -> None:
2424
model="kanon-2-embedder",
2525
texts=["Are restraints of trade enforceable under English law?", "What is a non-compete clause?"],
2626
)
27-
assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"])
27+
assert_matches_type(Embedding, embedding, path=["response"])
2828

2929
@pytest.mark.skip(reason="Prism tests are disabled")
3030
@parametrize
@@ -36,7 +36,7 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None:
3636
overflow_strategy="drop_end",
3737
task="retrieval/query",
3838
)
39-
assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"])
39+
assert_matches_type(Embedding, embedding, path=["response"])
4040

4141
@pytest.mark.skip(reason="Prism tests are disabled")
4242
@parametrize
@@ -49,7 +49,7 @@ def test_raw_response_create(self, client: Isaacus) -> None:
4949
assert response.is_closed is True
5050
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
5151
embedding = response.parse()
52-
assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"])
52+
assert_matches_type(Embedding, embedding, path=["response"])
5353

5454
@pytest.mark.skip(reason="Prism tests are disabled")
5555
@parametrize
@@ -62,7 +62,7 @@ def test_streaming_response_create(self, client: Isaacus) -> None:
6262
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
6363

6464
embedding = response.parse()
65-
assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"])
65+
assert_matches_type(Embedding, embedding, path=["response"])
6666

6767
assert cast(Any, response.is_closed) is True
6868

@@ -79,7 +79,7 @@ async def test_method_create(self, async_client: AsyncIsaacus) -> None:
7979
model="kanon-2-embedder",
8080
texts=["Are restraints of trade enforceable under English law?", "What is a non-compete clause?"],
8181
)
82-
assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"])
82+
assert_matches_type(Embedding, embedding, path=["response"])
8383

8484
@pytest.mark.skip(reason="Prism tests are disabled")
8585
@parametrize
@@ -91,7 +91,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) -
9191
overflow_strategy="drop_end",
9292
task="retrieval/query",
9393
)
94-
assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"])
94+
assert_matches_type(Embedding, embedding, path=["response"])
9595

9696
@pytest.mark.skip(reason="Prism tests are disabled")
9797
@parametrize
@@ -104,7 +104,7 @@ async def test_raw_response_create(self, async_client: AsyncIsaacus) -> None:
104104
assert response.is_closed is True
105105
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
106106
embedding = await response.parse()
107-
assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"])
107+
assert_matches_type(Embedding, embedding, path=["response"])
108108

109109
@pytest.mark.skip(reason="Prism tests are disabled")
110110
@parametrize
@@ -117,6 +117,6 @@ async def test_streaming_response_create(self, async_client: AsyncIsaacus) -> No
117117
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
118118

119119
embedding = await response.parse()
120-
assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"])
120+
assert_matches_type(Embedding, embedding, path=["response"])
121121

122122
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)