isaacus 0.8.0__py3-none-any.whl → 0.9.1__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.
Files changed (36) hide show
  1. isaacus/__init__.py +3 -1
  2. isaacus/_base_client.py +40 -12
  3. isaacus/_client.py +17 -9
  4. isaacus/_compat.py +48 -48
  5. isaacus/_files.py +4 -4
  6. isaacus/_models.py +51 -45
  7. isaacus/_qs.py +7 -7
  8. isaacus/_types.py +53 -12
  9. isaacus/_utils/__init__.py +9 -2
  10. isaacus/_utils/_compat.py +45 -0
  11. isaacus/_utils/_datetime_parse.py +136 -0
  12. isaacus/_utils/_transform.py +13 -3
  13. isaacus/_utils/_typing.py +6 -1
  14. isaacus/_utils/_utils.py +4 -5
  15. isaacus/_version.py +1 -1
  16. isaacus/resources/__init__.py +14 -0
  17. isaacus/resources/classifications/universal.py +17 -17
  18. isaacus/resources/embeddings.py +246 -0
  19. isaacus/resources/extractions/qa.py +23 -21
  20. isaacus/resources/rerankings.py +19 -19
  21. isaacus/types/__init__.py +3 -1
  22. isaacus/types/classifications/__init__.py +1 -1
  23. isaacus/types/classifications/{universal_classification.py → universal_classification_response.py} +2 -2
  24. isaacus/types/classifications/universal_create_params.py +4 -2
  25. isaacus/types/embedding_create_params.py +49 -0
  26. isaacus/types/embedding_response.py +31 -0
  27. isaacus/types/extractions/__init__.py +1 -1
  28. isaacus/types/extractions/{answer_extraction.py → answer_extraction_response.py} +2 -2
  29. isaacus/types/extractions/qa_create_params.py +7 -4
  30. isaacus/types/reranking_create_params.py +4 -2
  31. isaacus/types/{reranking.py → reranking_response.py} +2 -2
  32. {isaacus-0.8.0.dist-info → isaacus-0.9.1.dist-info}/METADATA +54 -41
  33. isaacus-0.9.1.dist-info/RECORD +52 -0
  34. isaacus-0.8.0.dist-info/RECORD +0 -47
  35. {isaacus-0.8.0.dist-info → isaacus-0.9.1.dist-info}/WHEEL +0 -0
  36. {isaacus-0.8.0.dist-info → isaacus-0.9.1.dist-info}/licenses/LICENSE +0 -0
@@ -16,18 +16,20 @@ from ._utils import (
16
16
  lru_cache,
17
17
  is_mapping,
18
18
  is_iterable,
19
+ is_sequence,
19
20
  )
20
21
  from .._files import is_base64_file_input
22
+ from ._compat import get_origin, is_typeddict
21
23
  from ._typing import (
22
24
  is_list_type,
23
25
  is_union_type,
24
26
  extract_type_arg,
25
27
  is_iterable_type,
26
28
  is_required_type,
29
+ is_sequence_type,
27
30
  is_annotated_type,
28
31
  strip_annotated_type,
29
32
  )
30
- from .._compat import get_origin, model_dump, is_typeddict
31
33
 
32
34
  _T = TypeVar("_T")
33
35
 
@@ -167,6 +169,8 @@ def _transform_recursive(
167
169
 
168
170
  Defaults to the same value as the `annotation` argument.
169
171
  """
172
+ from .._compat import model_dump
173
+
170
174
  if inner_type is None:
171
175
  inner_type = annotation
172
176
 
@@ -184,6 +188,8 @@ def _transform_recursive(
184
188
  (is_list_type(stripped_type) and is_list(data))
185
189
  # Iterable[T]
186
190
  or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
191
+ # Sequence[T]
192
+ or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
187
193
  ):
188
194
  # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
189
195
  # intended as an iterable, so we don't transform it.
@@ -262,7 +268,7 @@ def _transform_typeddict(
262
268
  annotations = get_type_hints(expected_type, include_extras=True)
263
269
  for key, value in data.items():
264
270
  if not is_given(value):
265
- # we don't need to include `NotGiven` values here as they'll
271
+ # we don't need to include omitted values here as they'll
266
272
  # be stripped out before the request is sent anyway
267
273
  continue
268
274
 
@@ -329,6 +335,8 @@ async def _async_transform_recursive(
329
335
 
330
336
  Defaults to the same value as the `annotation` argument.
331
337
  """
338
+ from .._compat import model_dump
339
+
332
340
  if inner_type is None:
333
341
  inner_type = annotation
334
342
 
@@ -346,6 +354,8 @@ async def _async_transform_recursive(
346
354
  (is_list_type(stripped_type) and is_list(data))
347
355
  # Iterable[T]
348
356
  or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
357
+ # Sequence[T]
358
+ or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
349
359
  ):
350
360
  # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
351
361
  # intended as an iterable, so we don't transform it.
@@ -424,7 +434,7 @@ async def _async_transform_typeddict(
424
434
  annotations = get_type_hints(expected_type, include_extras=True)
425
435
  for key, value in data.items():
426
436
  if not is_given(value):
427
- # we don't need to include `NotGiven` values here as they'll
437
+ # we don't need to include omitted values here as they'll
428
438
  # be stripped out before the request is sent anyway
429
439
  continue
430
440
 
isaacus/_utils/_typing.py CHANGED
@@ -15,7 +15,7 @@ from typing_extensions import (
15
15
 
16
16
  from ._utils import lru_cache
17
17
  from .._types import InheritsGeneric
18
- from .._compat import is_union as _is_union
18
+ from ._compat import is_union as _is_union
19
19
 
20
20
 
21
21
  def is_annotated_type(typ: type) -> bool:
@@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
26
26
  return (get_origin(typ) or typ) == list
27
27
 
28
28
 
29
+ def is_sequence_type(typ: type) -> bool:
30
+ origin = get_origin(typ) or typ
31
+ return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence
32
+
33
+
29
34
  def is_iterable_type(typ: type) -> bool:
30
35
  """If the given type is `typing.Iterable[T]`"""
31
36
  origin = get_origin(typ) or typ
isaacus/_utils/_utils.py CHANGED
@@ -21,8 +21,7 @@ from typing_extensions import TypeGuard
21
21
 
22
22
  import sniffio
23
23
 
24
- from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike
25
- from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
24
+ from .._types import Omit, NotGiven, FileTypes, HeadersLike
26
25
 
27
26
  _T = TypeVar("_T")
28
27
  _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
@@ -64,7 +63,7 @@ def _extract_items(
64
63
  try:
65
64
  key = path[index]
66
65
  except IndexError:
67
- if isinstance(obj, NotGiven):
66
+ if not is_given(obj):
68
67
  # no value was provided - we can safely ignore
69
68
  return []
70
69
 
@@ -127,8 +126,8 @@ def _extract_items(
127
126
  return []
128
127
 
129
128
 
130
- def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]:
131
- return not isinstance(obj, NotGiven)
129
+ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
130
+ return not isinstance(obj, NotGiven) and not isinstance(obj, Omit)
132
131
 
133
132
 
134
133
  # Type safe methods for narrowing types with TypeVars.
isaacus/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "isaacus"
4
- __version__ = "0.8.0" # x-release-please-version
4
+ __version__ = "0.9.1" # x-release-please-version
@@ -1,5 +1,13 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from .embeddings import (
4
+ EmbeddingsResource,
5
+ AsyncEmbeddingsResource,
6
+ EmbeddingsResourceWithRawResponse,
7
+ AsyncEmbeddingsResourceWithRawResponse,
8
+ EmbeddingsResourceWithStreamingResponse,
9
+ AsyncEmbeddingsResourceWithStreamingResponse,
10
+ )
3
11
  from .rerankings import (
4
12
  RerankingsResource,
5
13
  AsyncRerankingsResource,
@@ -26,6 +34,12 @@ from .classifications import (
26
34
  )
27
35
 
28
36
  __all__ = [
37
+ "EmbeddingsResource",
38
+ "AsyncEmbeddingsResource",
39
+ "EmbeddingsResourceWithRawResponse",
40
+ "AsyncEmbeddingsResourceWithRawResponse",
41
+ "EmbeddingsResourceWithStreamingResponse",
42
+ "AsyncEmbeddingsResourceWithStreamingResponse",
29
43
  "ClassificationsResource",
30
44
  "AsyncClassificationsResource",
31
45
  "ClassificationsResourceWithRawResponse",
@@ -2,12 +2,12 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import List, Optional
5
+ from typing import Optional
6
6
  from typing_extensions import Literal
7
7
 
8
8
  import httpx
9
9
 
10
- from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
+ from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
11
11
  from ..._utils import maybe_transform, async_maybe_transform
12
12
  from ..._compat import cached_property
13
13
  from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -19,7 +19,7 @@ from ..._response import (
19
19
  )
20
20
  from ..._base_client import make_request_options
21
21
  from ...types.classifications import universal_create_params
22
- from ...types.classifications.universal_classification import UniversalClassification
22
+ from ...types.classifications.universal_classification_response import UniversalClassificationResponse
23
23
 
24
24
  __all__ = ["UniversalResource", "AsyncUniversalResource"]
25
25
 
@@ -49,17 +49,17 @@ class UniversalResource(SyncAPIResource):
49
49
  *,
50
50
  model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"],
51
51
  query: str,
52
- texts: List[str],
53
- chunking_options: Optional[universal_create_params.ChunkingOptions] | NotGiven = NOT_GIVEN,
54
- is_iql: bool | NotGiven = NOT_GIVEN,
55
- scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | NotGiven = NOT_GIVEN,
52
+ texts: SequenceNotStr[str],
53
+ chunking_options: Optional[universal_create_params.ChunkingOptions] | Omit = omit,
54
+ is_iql: bool | Omit = omit,
55
+ scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | Omit = omit,
56
56
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
57
57
  # The extra values given here take precedence over values defined on the client or passed to this method.
58
58
  extra_headers: Headers | None = None,
59
59
  extra_query: Query | None = None,
60
60
  extra_body: Body | None = None,
61
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
62
- ) -> UniversalClassification:
61
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
62
+ ) -> UniversalClassificationResponse:
63
63
  """
64
64
  Classify the relevance of legal documents to a query with an Isaacus universal
65
65
  legal AI classifier.
@@ -121,7 +121,7 @@ class UniversalResource(SyncAPIResource):
121
121
  options=make_request_options(
122
122
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
123
123
  ),
124
- cast_to=UniversalClassification,
124
+ cast_to=UniversalClassificationResponse,
125
125
  )
126
126
 
127
127
 
@@ -150,17 +150,17 @@ class AsyncUniversalResource(AsyncAPIResource):
150
150
  *,
151
151
  model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"],
152
152
  query: str,
153
- texts: List[str],
154
- chunking_options: Optional[universal_create_params.ChunkingOptions] | NotGiven = NOT_GIVEN,
155
- is_iql: bool | NotGiven = NOT_GIVEN,
156
- scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | NotGiven = NOT_GIVEN,
153
+ texts: SequenceNotStr[str],
154
+ chunking_options: Optional[universal_create_params.ChunkingOptions] | Omit = omit,
155
+ is_iql: bool | Omit = omit,
156
+ scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | Omit = omit,
157
157
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
158
158
  # The extra values given here take precedence over values defined on the client or passed to this method.
159
159
  extra_headers: Headers | None = None,
160
160
  extra_query: Query | None = None,
161
161
  extra_body: Body | None = None,
162
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
163
- ) -> UniversalClassification:
162
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
163
+ ) -> UniversalClassificationResponse:
164
164
  """
165
165
  Classify the relevance of legal documents to a query with an Isaacus universal
166
166
  legal AI classifier.
@@ -222,7 +222,7 @@ class AsyncUniversalResource(AsyncAPIResource):
222
222
  options=make_request_options(
223
223
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
224
224
  ),
225
- cast_to=UniversalClassification,
225
+ cast_to=UniversalClassificationResponse,
226
226
  )
227
227
 
228
228
 
@@ -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_response import EmbeddingResponse
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
+ ) -> EmbeddingResponse:
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 128 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=EmbeddingResponse,
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
+ ) -> EmbeddingResponse:
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 128 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=EmbeddingResponse,
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
+ )
@@ -2,12 +2,12 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import List, Optional
5
+ from typing import Optional
6
6
  from typing_extensions import Literal
7
7
 
8
8
  import httpx
9
9
 
10
- from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
+ from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
11
11
  from ..._utils import maybe_transform, async_maybe_transform
12
12
  from ..._compat import cached_property
13
13
  from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -19,7 +19,7 @@ from ..._response import (
19
19
  )
20
20
  from ..._base_client import make_request_options
21
21
  from ...types.extractions import qa_create_params
22
- from ...types.extractions.answer_extraction import AnswerExtraction
22
+ from ...types.extractions.answer_extraction_response import AnswerExtractionResponse
23
23
 
24
24
  __all__ = ["QaResource", "AsyncQaResource"]
25
25
 
@@ -49,24 +49,25 @@ class QaResource(SyncAPIResource):
49
49
  *,
50
50
  model: Literal["kanon-answer-extractor", "kanon-answer-extractor-mini"],
51
51
  query: str,
52
- texts: List[str],
53
- chunking_options: Optional[qa_create_params.ChunkingOptions] | NotGiven = NOT_GIVEN,
54
- ignore_inextractability: bool | NotGiven = NOT_GIVEN,
55
- top_k: int | NotGiven = NOT_GIVEN,
52
+ texts: SequenceNotStr[str],
53
+ chunking_options: Optional[qa_create_params.ChunkingOptions] | Omit = omit,
54
+ ignore_inextractability: bool | Omit = omit,
55
+ top_k: int | Omit = omit,
56
56
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
57
57
  # The extra values given here take precedence over values defined on the client or passed to this method.
58
58
  extra_headers: Headers | None = None,
59
59
  extra_query: Query | None = None,
60
60
  extra_body: Body | None = None,
61
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
62
- ) -> AnswerExtraction:
61
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
62
+ ) -> AnswerExtractionResponse:
63
63
  """
64
64
  Extract answers to questions from legal documents with an Isaacus legal AI
65
65
  answer extractor.
66
66
 
67
67
  Args:
68
- model: The ID of the [model](https://docs.isaacus.com/models#extractive-qa) to use for
69
- extractive question answering.
68
+ model: The ID of the
69
+ [model](https://docs.isaacus.com/models#extractive-question-answering) to use
70
+ for extractive question answering.
70
71
 
71
72
  query: The query to extract the answer to.
72
73
 
@@ -119,7 +120,7 @@ class QaResource(SyncAPIResource):
119
120
  options=make_request_options(
120
121
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
121
122
  ),
122
- cast_to=AnswerExtraction,
123
+ cast_to=AnswerExtractionResponse,
123
124
  )
124
125
 
125
126
 
@@ -148,24 +149,25 @@ class AsyncQaResource(AsyncAPIResource):
148
149
  *,
149
150
  model: Literal["kanon-answer-extractor", "kanon-answer-extractor-mini"],
150
151
  query: str,
151
- texts: List[str],
152
- chunking_options: Optional[qa_create_params.ChunkingOptions] | NotGiven = NOT_GIVEN,
153
- ignore_inextractability: bool | NotGiven = NOT_GIVEN,
154
- top_k: int | NotGiven = NOT_GIVEN,
152
+ texts: SequenceNotStr[str],
153
+ chunking_options: Optional[qa_create_params.ChunkingOptions] | Omit = omit,
154
+ ignore_inextractability: bool | Omit = omit,
155
+ top_k: int | Omit = omit,
155
156
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
156
157
  # The extra values given here take precedence over values defined on the client or passed to this method.
157
158
  extra_headers: Headers | None = None,
158
159
  extra_query: Query | None = None,
159
160
  extra_body: Body | None = None,
160
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
161
- ) -> AnswerExtraction:
161
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
162
+ ) -> AnswerExtractionResponse:
162
163
  """
163
164
  Extract answers to questions from legal documents with an Isaacus legal AI
164
165
  answer extractor.
165
166
 
166
167
  Args:
167
- model: The ID of the [model](https://docs.isaacus.com/models#extractive-qa) to use for
168
- extractive question answering.
168
+ model: The ID of the
169
+ [model](https://docs.isaacus.com/models#extractive-question-answering) to use
170
+ for extractive question answering.
169
171
 
170
172
  query: The query to extract the answer to.
171
173
 
@@ -218,7 +220,7 @@ class AsyncQaResource(AsyncAPIResource):
218
220
  options=make_request_options(
219
221
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
220
222
  ),
221
- cast_to=AnswerExtraction,
223
+ cast_to=AnswerExtractionResponse,
222
224
  )
223
225
 
224
226