Skip to content

Commit 7b9856c

Browse files
feat(api): introduced extractive QA
1 parent ef18419 commit 7b9856c

File tree

16 files changed

+734
-10
lines changed

16 files changed

+734
-10
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 2
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-f1ac3a46ba560544c348931204998163a9c5e35c40d6096f4b078e38c2714756.yml
3-
openapi_spec_hash: c9ba9f53c0dabdb703461d772020952f
4-
config_hash: 1d15d860383a3f6da1ac388297687cc9
1+
configured_endpoints: 3
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-bc0272bf0a53ec37ca25f4a8b76bca4b90cf33c5f41816edf460daa642a5a84a.yml
3+
openapi_spec_hash: 79f28fedf89e1b719f464c064847a630
4+
config_hash: bfe30148ec88e8bbbf4a348a9fdfc00a

api.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,17 @@ from isaacus.types import Reranking
2323
Methods:
2424

2525
- <code title="post /rerankings">client.rerankings.<a href="./src/isaacus/resources/rerankings.py">create</a>(\*\*<a href="src/isaacus/types/reranking_create_params.py">params</a>) -> <a href="./src/isaacus/types/reranking.py">Reranking</a></code>
26+
27+
# Extractions
28+
29+
## Qa
30+
31+
Types:
32+
33+
```python
34+
from isaacus.types.extractions import AnswerExtraction
35+
```
36+
37+
Methods:
38+
39+
- <code title="post /extractions/qa">client.extractions.qa.<a href="./src/isaacus/resources/extractions/qa.py">create</a>(\*\*<a href="src/isaacus/types/extractions/qa_create_params.py">params</a>) -> <a href="./src/isaacus/types/extractions/answer_extraction.py">AnswerExtraction</a></code>

src/isaacus/_client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
SyncAPIClient,
3030
AsyncAPIClient,
3131
)
32+
from .resources.extractions import extractions
3233
from .resources.classifications import classifications
3334

3435
__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Isaacus", "AsyncIsaacus", "Client", "AsyncClient"]
@@ -37,6 +38,7 @@
3738
class Isaacus(SyncAPIClient):
3839
classifications: classifications.ClassificationsResource
3940
rerankings: rerankings.RerankingsResource
41+
extractions: extractions.ExtractionsResource
4042
with_raw_response: IsaacusWithRawResponse
4143
with_streaming_response: IsaacusWithStreamedResponse
4244

@@ -96,6 +98,7 @@ def __init__(
9698

9799
self.classifications = classifications.ClassificationsResource(self)
98100
self.rerankings = rerankings.RerankingsResource(self)
101+
self.extractions = extractions.ExtractionsResource(self)
99102
self.with_raw_response = IsaacusWithRawResponse(self)
100103
self.with_streaming_response = IsaacusWithStreamedResponse(self)
101104

@@ -207,6 +210,7 @@ def _make_status_error(
207210
class AsyncIsaacus(AsyncAPIClient):
208211
classifications: classifications.AsyncClassificationsResource
209212
rerankings: rerankings.AsyncRerankingsResource
213+
extractions: extractions.AsyncExtractionsResource
210214
with_raw_response: AsyncIsaacusWithRawResponse
211215
with_streaming_response: AsyncIsaacusWithStreamedResponse
212216

@@ -266,6 +270,7 @@ def __init__(
266270

267271
self.classifications = classifications.AsyncClassificationsResource(self)
268272
self.rerankings = rerankings.AsyncRerankingsResource(self)
273+
self.extractions = extractions.AsyncExtractionsResource(self)
269274
self.with_raw_response = AsyncIsaacusWithRawResponse(self)
270275
self.with_streaming_response = AsyncIsaacusWithStreamedResponse(self)
271276

@@ -378,24 +383,28 @@ class IsaacusWithRawResponse:
378383
def __init__(self, client: Isaacus) -> None:
379384
self.classifications = classifications.ClassificationsResourceWithRawResponse(client.classifications)
380385
self.rerankings = rerankings.RerankingsResourceWithRawResponse(client.rerankings)
386+
self.extractions = extractions.ExtractionsResourceWithRawResponse(client.extractions)
381387

382388

383389
class AsyncIsaacusWithRawResponse:
384390
def __init__(self, client: AsyncIsaacus) -> None:
385391
self.classifications = classifications.AsyncClassificationsResourceWithRawResponse(client.classifications)
386392
self.rerankings = rerankings.AsyncRerankingsResourceWithRawResponse(client.rerankings)
393+
self.extractions = extractions.AsyncExtractionsResourceWithRawResponse(client.extractions)
387394

388395

389396
class IsaacusWithStreamedResponse:
390397
def __init__(self, client: Isaacus) -> None:
391398
self.classifications = classifications.ClassificationsResourceWithStreamingResponse(client.classifications)
392399
self.rerankings = rerankings.RerankingsResourceWithStreamingResponse(client.rerankings)
400+
self.extractions = extractions.ExtractionsResourceWithStreamingResponse(client.extractions)
393401

394402

395403
class AsyncIsaacusWithStreamedResponse:
396404
def __init__(self, client: AsyncIsaacus) -> None:
397405
self.classifications = classifications.AsyncClassificationsResourceWithStreamingResponse(client.classifications)
398406
self.rerankings = rerankings.AsyncRerankingsResourceWithStreamingResponse(client.rerankings)
407+
self.extractions = extractions.AsyncExtractionsResourceWithStreamingResponse(client.extractions)
399408

400409

401410
Client = Isaacus

src/isaacus/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
RerankingsResourceWithStreamingResponse,
99
AsyncRerankingsResourceWithStreamingResponse,
1010
)
11+
from .extractions import (
12+
ExtractionsResource,
13+
AsyncExtractionsResource,
14+
ExtractionsResourceWithRawResponse,
15+
AsyncExtractionsResourceWithRawResponse,
16+
ExtractionsResourceWithStreamingResponse,
17+
AsyncExtractionsResourceWithStreamingResponse,
18+
)
1119
from .classifications import (
1220
ClassificationsResource,
1321
AsyncClassificationsResource,
@@ -30,4 +38,10 @@
3038
"AsyncRerankingsResourceWithRawResponse",
3139
"RerankingsResourceWithStreamingResponse",
3240
"AsyncRerankingsResourceWithStreamingResponse",
41+
"ExtractionsResource",
42+
"AsyncExtractionsResource",
43+
"ExtractionsResourceWithRawResponse",
44+
"AsyncExtractionsResourceWithRawResponse",
45+
"ExtractionsResourceWithStreamingResponse",
46+
"AsyncExtractionsResourceWithStreamingResponse",
3347
]

src/isaacus/resources/classifications/universal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def create(
7878
7979
texts: The texts to classify.
8080
81-
The texts must contain at least one non-whitespace character.
81+
Each text must contain at least one non-whitespace character.
8282
8383
chunking_options: Options for how to split text into smaller chunks.
8484
@@ -179,7 +179,7 @@ async def create(
179179
180180
texts: The texts to classify.
181181
182-
The texts must contain at least one non-whitespace character.
182+
Each text must contain at least one non-whitespace character.
183183
184184
chunking_options: Options for how to split text into smaller chunks.
185185
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .qa import (
4+
QaResource,
5+
AsyncQaResource,
6+
QaResourceWithRawResponse,
7+
AsyncQaResourceWithRawResponse,
8+
QaResourceWithStreamingResponse,
9+
AsyncQaResourceWithStreamingResponse,
10+
)
11+
from .extractions import (
12+
ExtractionsResource,
13+
AsyncExtractionsResource,
14+
ExtractionsResourceWithRawResponse,
15+
AsyncExtractionsResourceWithRawResponse,
16+
ExtractionsResourceWithStreamingResponse,
17+
AsyncExtractionsResourceWithStreamingResponse,
18+
)
19+
20+
__all__ = [
21+
"QaResource",
22+
"AsyncQaResource",
23+
"QaResourceWithRawResponse",
24+
"AsyncQaResourceWithRawResponse",
25+
"QaResourceWithStreamingResponse",
26+
"AsyncQaResourceWithStreamingResponse",
27+
"ExtractionsResource",
28+
"AsyncExtractionsResource",
29+
"ExtractionsResourceWithRawResponse",
30+
"AsyncExtractionsResourceWithRawResponse",
31+
"ExtractionsResourceWithStreamingResponse",
32+
"AsyncExtractionsResourceWithStreamingResponse",
33+
]
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from .qa import (
6+
QaResource,
7+
AsyncQaResource,
8+
QaResourceWithRawResponse,
9+
AsyncQaResourceWithRawResponse,
10+
QaResourceWithStreamingResponse,
11+
AsyncQaResourceWithStreamingResponse,
12+
)
13+
from ..._compat import cached_property
14+
from ..._resource import SyncAPIResource, AsyncAPIResource
15+
16+
__all__ = ["ExtractionsResource", "AsyncExtractionsResource"]
17+
18+
19+
class ExtractionsResource(SyncAPIResource):
20+
@cached_property
21+
def qa(self) -> QaResource:
22+
return QaResource(self._client)
23+
24+
@cached_property
25+
def with_raw_response(self) -> ExtractionsResourceWithRawResponse:
26+
"""
27+
This property can be used as a prefix for any HTTP method call to return
28+
the raw response object instead of the parsed content.
29+
30+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#accessing-raw-response-data-eg-headers
31+
"""
32+
return ExtractionsResourceWithRawResponse(self)
33+
34+
@cached_property
35+
def with_streaming_response(self) -> ExtractionsResourceWithStreamingResponse:
36+
"""
37+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38+
39+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#with_streaming_response
40+
"""
41+
return ExtractionsResourceWithStreamingResponse(self)
42+
43+
44+
class AsyncExtractionsResource(AsyncAPIResource):
45+
@cached_property
46+
def qa(self) -> AsyncQaResource:
47+
return AsyncQaResource(self._client)
48+
49+
@cached_property
50+
def with_raw_response(self) -> AsyncExtractionsResourceWithRawResponse:
51+
"""
52+
This property can be used as a prefix for any HTTP method call to return
53+
the raw response object instead of the parsed content.
54+
55+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#accessing-raw-response-data-eg-headers
56+
"""
57+
return AsyncExtractionsResourceWithRawResponse(self)
58+
59+
@cached_property
60+
def with_streaming_response(self) -> AsyncExtractionsResourceWithStreamingResponse:
61+
"""
62+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63+
64+
For more information, see https://www.github.com/isaacus-dev/isaacus-python#with_streaming_response
65+
"""
66+
return AsyncExtractionsResourceWithStreamingResponse(self)
67+
68+
69+
class ExtractionsResourceWithRawResponse:
70+
def __init__(self, extractions: ExtractionsResource) -> None:
71+
self._extractions = extractions
72+
73+
@cached_property
74+
def qa(self) -> QaResourceWithRawResponse:
75+
return QaResourceWithRawResponse(self._extractions.qa)
76+
77+
78+
class AsyncExtractionsResourceWithRawResponse:
79+
def __init__(self, extractions: AsyncExtractionsResource) -> None:
80+
self._extractions = extractions
81+
82+
@cached_property
83+
def qa(self) -> AsyncQaResourceWithRawResponse:
84+
return AsyncQaResourceWithRawResponse(self._extractions.qa)
85+
86+
87+
class ExtractionsResourceWithStreamingResponse:
88+
def __init__(self, extractions: ExtractionsResource) -> None:
89+
self._extractions = extractions
90+
91+
@cached_property
92+
def qa(self) -> QaResourceWithStreamingResponse:
93+
return QaResourceWithStreamingResponse(self._extractions.qa)
94+
95+
96+
class AsyncExtractionsResourceWithStreamingResponse:
97+
def __init__(self, extractions: AsyncExtractionsResource) -> None:
98+
self._extractions = extractions
99+
100+
@cached_property
101+
def qa(self) -> AsyncQaResourceWithStreamingResponse:
102+
return AsyncQaResourceWithStreamingResponse(self._extractions.qa)

0 commit comments

Comments
 (0)