Skip to content

Commit e3f7e03

Browse files
feat(api): add kanon-2-reranker
1 parent 54b727d commit e3f7e03

File tree

5 files changed

+34
-24
lines changed

5 files changed

+34
-24
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: 5
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-baf5ebdd05d1b5192759a356c2701131c47cfb5b7239a49fcb94e68d4210648c.yml
3-
openapi_spec_hash: 6ea786d56726e18156adf57915fcbe5f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-cc6e47db2f93647cdafaa2098b9dbe0fc58291998c8a86e2a2e2adc4184da071.yml
3+
openapi_spec_hash: 8062d4e1530c9017628f3860742c0639
44
config_hash: 9040e7359f066240ad536041fb2c5185

src/isaacus/resources/rerankings.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def with_streaming_response(self) -> RerankingsResourceWithStreamingResponse:
5151
def create(
5252
self,
5353
*,
54-
model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"],
54+
model: Literal["kanon-2-reranker", "kanon-universal-classifier", "kanon-universal-classifier-mini"],
5555
query: str,
5656
texts: SequenceNotStr[str],
5757
top_n: Optional[int] | Omit = omit,
@@ -70,8 +70,9 @@ def create(
7070
reranker.
7171
7272
Args:
73-
model: The ID of the [model](https://docs.isaacus.com/models#reranking) to use for
74-
reranking.
73+
model: The ID of the model to use for reranking, being either a
74+
[reranking model](https://docs.isaacus.com/models/introduction#reranking) or
75+
[universal classification model](https://docs.isaacus.com/models/introduction#universal-classification).
7576
7677
query: The query to evaluate the relevance of the texts to.
7778
@@ -96,7 +97,9 @@ def create(
9697
before enabling IQL since queries can be crafted to consume an excessively large
9798
amount of tokens.
9899
99-
scoring_method: The method to use for producing an overall relevance score for a text.
100+
scoring_method: The method to use for producing an overall relevance score for a text that
101+
exceeds the model's local context window and has, therefore, been split into
102+
multiple chunks.
100103
101104
`auto` is the default scoring method and is recommended for most use cases.
102105
Currently, it is equivalent to `chunk_max`. In the future, it will automatically
@@ -166,7 +169,7 @@ def with_streaming_response(self) -> AsyncRerankingsResourceWithStreamingRespons
166169
async def create(
167170
self,
168171
*,
169-
model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"],
172+
model: Literal["kanon-2-reranker", "kanon-universal-classifier", "kanon-universal-classifier-mini"],
170173
query: str,
171174
texts: SequenceNotStr[str],
172175
top_n: Optional[int] | Omit = omit,
@@ -185,8 +188,9 @@ async def create(
185188
reranker.
186189
187190
Args:
188-
model: The ID of the [model](https://docs.isaacus.com/models#reranking) to use for
189-
reranking.
191+
model: The ID of the model to use for reranking, being either a
192+
[reranking model](https://docs.isaacus.com/models/introduction#reranking) or
193+
[universal classification model](https://docs.isaacus.com/models/introduction#universal-classification).
190194
191195
query: The query to evaluate the relevance of the texts to.
192196
@@ -211,7 +215,9 @@ async def create(
211215
before enabling IQL since queries can be crafted to consume an excessively large
212216
amount of tokens.
213217
214-
scoring_method: The method to use for producing an overall relevance score for a text.
218+
scoring_method: The method to use for producing an overall relevance score for a text that
219+
exceeds the model's local context window and has, therefore, been split into
220+
multiple chunks.
215221
216222
`auto` is the default scoring method and is recommended for most use cases.
217223
Currently, it is equivalent to `chunk_max`. In the future, it will automatically

src/isaacus/types/reranking_create_params.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111

1212

1313
class RerankingCreateParams(TypedDict, total=False):
14-
model: Required[Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"]]
14+
model: Required[Literal["kanon-2-reranker", "kanon-universal-classifier", "kanon-universal-classifier-mini"]]
1515
"""
16-
The ID of the [model](https://docs.isaacus.com/models#reranking) to use for
17-
reranking.
16+
The ID of the model to use for reranking, being either a
17+
[reranking model](https://docs.isaacus.com/models/introduction#reranking) or
18+
[universal classification model](https://docs.isaacus.com/models/introduction#universal-classification).
1819
"""
1920

2021
query: Required[str]
@@ -49,7 +50,10 @@ class RerankingCreateParams(TypedDict, total=False):
4950
"""
5051

5152
scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"]
52-
"""The method to use for producing an overall relevance score for a text.
53+
"""
54+
The method to use for producing an overall relevance score for a text that
55+
exceeds the model's local context window and has, therefore, been split into
56+
multiple chunks.
5357
5458
`auto` is the default scoring method and is recommended for most use cases.
5559
Currently, it is equivalent to `chunk_max`. In the future, it will automatically

src/isaacus/types/reranking_response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class Usage(BaseModel):
3131
class RerankingResponse(BaseModel):
3232
results: List[Result]
3333
"""
34-
The rerankings of the texts, by relevance to the query, in order from highest to
35-
lowest relevance score.
34+
The texts reranked by relevance to the query, in order from highest to lowest
35+
relevance score.
3636
"""
3737

3838
usage: Usage

tests/api_resources/test_rerankings.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TestRerankings:
2121
@parametrize
2222
def test_method_create(self, client: Isaacus) -> None:
2323
reranking = client.rerankings.create(
24-
model="kanon-universal-classifier",
24+
model="kanon-2-reranker",
2525
query="What are the essential elements required to establish a negligence claim?",
2626
texts=[
2727
"To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",
@@ -37,7 +37,7 @@ def test_method_create(self, client: Isaacus) -> None:
3737
@parametrize
3838
def test_method_create_with_all_params(self, client: Isaacus) -> None:
3939
reranking = client.rerankings.create(
40-
model="kanon-universal-classifier",
40+
model="kanon-2-reranker",
4141
query="What are the essential elements required to establish a negligence claim?",
4242
texts=[
4343
"To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",
@@ -61,7 +61,7 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None:
6161
@parametrize
6262
def test_raw_response_create(self, client: Isaacus) -> None:
6363
response = client.rerankings.with_raw_response.create(
64-
model="kanon-universal-classifier",
64+
model="kanon-2-reranker",
6565
query="What are the essential elements required to establish a negligence claim?",
6666
texts=[
6767
"To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",
@@ -81,7 +81,7 @@ def test_raw_response_create(self, client: Isaacus) -> None:
8181
@parametrize
8282
def test_streaming_response_create(self, client: Isaacus) -> None:
8383
with client.rerankings.with_streaming_response.create(
84-
model="kanon-universal-classifier",
84+
model="kanon-2-reranker",
8585
query="What are the essential elements required to establish a negligence claim?",
8686
texts=[
8787
"To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",
@@ -109,7 +109,7 @@ class TestAsyncRerankings:
109109
@parametrize
110110
async def test_method_create(self, async_client: AsyncIsaacus) -> None:
111111
reranking = await async_client.rerankings.create(
112-
model="kanon-universal-classifier",
112+
model="kanon-2-reranker",
113113
query="What are the essential elements required to establish a negligence claim?",
114114
texts=[
115115
"To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",
@@ -125,7 +125,7 @@ async def test_method_create(self, async_client: AsyncIsaacus) -> None:
125125
@parametrize
126126
async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) -> None:
127127
reranking = await async_client.rerankings.create(
128-
model="kanon-universal-classifier",
128+
model="kanon-2-reranker",
129129
query="What are the essential elements required to establish a negligence claim?",
130130
texts=[
131131
"To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",
@@ -149,7 +149,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) -
149149
@parametrize
150150
async def test_raw_response_create(self, async_client: AsyncIsaacus) -> None:
151151
response = await async_client.rerankings.with_raw_response.create(
152-
model="kanon-universal-classifier",
152+
model="kanon-2-reranker",
153153
query="What are the essential elements required to establish a negligence claim?",
154154
texts=[
155155
"To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",
@@ -169,7 +169,7 @@ async def test_raw_response_create(self, async_client: AsyncIsaacus) -> None:
169169
@parametrize
170170
async def test_streaming_response_create(self, async_client: AsyncIsaacus) -> None:
171171
async with async_client.rerankings.with_streaming_response.create(
172-
model="kanon-universal-classifier",
172+
model="kanon-2-reranker",
173173
query="What are the essential elements required to establish a negligence claim?",
174174
texts=[
175175
"To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",

0 commit comments

Comments
 (0)