diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f7014c3..a713055 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.11.0" + ".": "0.12.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c881b9a..3d7a14c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 5 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-d499915d5c9d28ffae10a108d7655c026676b21d3b34f07ead24c7d50c546633.yml -openapi_spec_hash: d91d2843e3799463b60832553d4faf70 -config_hash: 1d77b499f5b4f2dc6986fdd5936d18ef +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-fa910a5a3d1321234423bd8c042d202a64d4d956ef45847b4de358cb18e447eb.yml +openapi_spec_hash: 926b9b619c15e8570e496e11d4fb753e +config_hash: a23e347480e00cefa57ce68b1de9e16d diff --git a/CHANGELOG.md b/CHANGELOG.md index f06b9a6..aecae9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 0.12.0 (2026-02-03) + +Full Changelog: [v0.11.0...v0.12.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.11.0...v0.12.0) + +### Features + +* **sdk:** add `qa` as an initialism ([27162f3](https://github.com/isaacus-dev/isaacus-python/commit/27162f3e98efa095e41f67801c6a3497709be9d6)) +* **sdk:** force ilgs v1 prefix on models ([62bc9ff](https://github.com/isaacus-dev/isaacus-python/commit/62bc9ffc03feb68e3638cfee3d9df9a8547bb9e8)) +* **sdk:** modify how ILGSv1 models are cased ([f295222](https://github.com/isaacus-dev/isaacus-python/commit/f2952227e58618b33c4d0da9515a1c73942a771a)) +* **sdk:** order properties as in spec ([3dc865c](https://github.com/isaacus-dev/isaacus-python/commit/3dc865c2ee865b334b7f0ca8810226f3ac251be8)) + + +### Bug Fixes + +* **api:** merge duplicate components, reorder required fields ([55b68ce](https://github.com/isaacus-dev/isaacus-python/commit/55b68ce2bc294f094ccaf3750ea1b932ed4f95f5)) + ## 0.11.0 (2026-02-03) Full Changelog: [v0.10.1...v0.11.0](https://github.com/isaacus-dev/isaacus-python/compare/v0.10.1...v0.11.0) diff --git a/api.md b/api.md index 438bdae..4245c80 100644 --- a/api.md +++ b/api.md @@ -38,7 +38,7 @@ Methods: # Extractions -## Qa +## QA Types: @@ -55,7 +55,23 @@ Methods: Types: ```python -from isaacus.types import EnrichmentResponse +from isaacus.types import ( + EnrichmentResponse, + ILGSv1Crossreference, + ILGSv1Date, + ILGSv1Document, + ILGSv1Email, + ILGSv1ExternalDocument, + ILGSv1IDNumber, + ILGSv1Location, + ILGSv1Person, + ILGSv1PhoneNumber, + ILGSv1Quote, + ILGSv1Segment, + ILGSv1Span, + ILGSv1Term, + ILGSv1Website, +) ``` Methods: diff --git a/pyproject.toml b/pyproject.toml index 8dc0afb..3ae9563 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "isaacus" -version = "0.11.0" +version = "0.12.0" description = "The official Python library for the isaacus API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/isaacus/_version.py b/src/isaacus/_version.py index e96fb03..23add34 100644 --- a/src/isaacus/_version.py +++ b/src/isaacus/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "isaacus" -__version__ = "0.11.0" # x-release-please-version +__version__ = "0.12.0" # x-release-please-version diff --git a/src/isaacus/resources/classifications/universal.py b/src/isaacus/resources/classifications/universal.py index 8aee937..780394b 100644 --- a/src/isaacus/resources/classifications/universal.py +++ b/src/isaacus/resources/classifications/universal.py @@ -50,9 +50,9 @@ def create( model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"], query: str, texts: SequenceNotStr[str], - chunking_options: Optional[universal_create_params.ChunkingOptions] | Omit = omit, is_iql: bool | Omit = omit, scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | Omit = omit, + chunking_options: Optional[universal_create_params.ChunkingOptions] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -80,8 +80,6 @@ def create( Each text must contain at least one non-whitespace character. - chunking_options: Options for how to split text into smaller chunks. - is_iql: Whether the query should be interpreted as an [IQL](https://docs.isaacus.com/iql) query or else as a statement. @@ -97,6 +95,8 @@ def create( `chunk_min` uses the lowest confidence score of all of the texts' chunks. + chunking_options: Options for how to split text into smaller chunks. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -112,9 +112,9 @@ def create( "model": model, "query": query, "texts": texts, - "chunking_options": chunking_options, "is_iql": is_iql, "scoring_method": scoring_method, + "chunking_options": chunking_options, }, universal_create_params.UniversalCreateParams, ), @@ -151,9 +151,9 @@ async def create( model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"], query: str, texts: SequenceNotStr[str], - chunking_options: Optional[universal_create_params.ChunkingOptions] | Omit = omit, is_iql: bool | Omit = omit, scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | Omit = omit, + chunking_options: Optional[universal_create_params.ChunkingOptions] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -181,8 +181,6 @@ async def create( Each text must contain at least one non-whitespace character. - chunking_options: Options for how to split text into smaller chunks. - is_iql: Whether the query should be interpreted as an [IQL](https://docs.isaacus.com/iql) query or else as a statement. @@ -198,6 +196,8 @@ async def create( `chunk_min` uses the lowest confidence score of all of the texts' chunks. + chunking_options: Options for how to split text into smaller chunks. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -213,9 +213,9 @@ async def create( "model": model, "query": query, "texts": texts, - "chunking_options": chunking_options, "is_iql": is_iql, "scoring_method": scoring_method, + "chunking_options": chunking_options, }, universal_create_params.UniversalCreateParams, ), diff --git a/src/isaacus/resources/embeddings.py b/src/isaacus/resources/embeddings.py index 96f0c51..e7a5e3a 100644 --- a/src/isaacus/resources/embeddings.py +++ b/src/isaacus/resources/embeddings.py @@ -49,9 +49,9 @@ def create( *, model: Literal["kanon-2-embedder"], texts: Union[SequenceNotStr[str], str], - dimensions: Optional[int] | Omit = omit, - overflow_strategy: Optional[Literal["drop_end"]] | Omit = omit, task: Optional[Literal["retrieval/query", "retrieval/document"]] | Omit = omit, + overflow_strategy: Optional[Literal["drop_end"]] | Omit = omit, + dimensions: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -72,7 +72,13 @@ def create( No more than 128 texts can be embedded in a single request. - dimensions: A whole number greater than or equal to 1. + task: The task the embeddings will be used for. + + `retrieval/query` is meant for queries and statements, and `retrieval/document` + is meant for anything to be retrieved using query embeddings. + + If `null`, which is the default setting, embeddings will not be optimized for + any particular task. overflow_strategy: The strategy to employ when content exceeds the model's maximum input length. @@ -82,13 +88,7 @@ def create( If `null`, an error will be raised if any content exceeds the model's maximum input length. - task: The task the embeddings will be used for. - - `retrieval/query` is meant for queries and statements, and `retrieval/document` - is meant for anything to be retrieved using query embeddings. - - If `null`, which is the default setting, embeddings will not be optimized for - any particular task. + dimensions: A whole number greater than or equal to 1. extra_headers: Send extra headers @@ -104,9 +104,9 @@ def create( { "model": model, "texts": texts, - "dimensions": dimensions, - "overflow_strategy": overflow_strategy, "task": task, + "overflow_strategy": overflow_strategy, + "dimensions": dimensions, }, embedding_create_params.EmbeddingCreateParams, ), @@ -142,9 +142,9 @@ async def create( *, model: Literal["kanon-2-embedder"], texts: Union[SequenceNotStr[str], str], - dimensions: Optional[int] | Omit = omit, - overflow_strategy: Optional[Literal["drop_end"]] | Omit = omit, task: Optional[Literal["retrieval/query", "retrieval/document"]] | Omit = omit, + overflow_strategy: Optional[Literal["drop_end"]] | Omit = omit, + dimensions: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -165,7 +165,13 @@ async def create( No more than 128 texts can be embedded in a single request. - dimensions: A whole number greater than or equal to 1. + task: The task the embeddings will be used for. + + `retrieval/query` is meant for queries and statements, and `retrieval/document` + is meant for anything to be retrieved using query embeddings. + + If `null`, which is the default setting, embeddings will not be optimized for + any particular task. overflow_strategy: The strategy to employ when content exceeds the model's maximum input length. @@ -175,13 +181,7 @@ async def create( If `null`, an error will be raised if any content exceeds the model's maximum input length. - task: The task the embeddings will be used for. - - `retrieval/query` is meant for queries and statements, and `retrieval/document` - is meant for anything to be retrieved using query embeddings. - - If `null`, which is the default setting, embeddings will not be optimized for - any particular task. + dimensions: A whole number greater than or equal to 1. extra_headers: Send extra headers @@ -197,9 +197,9 @@ async def create( { "model": model, "texts": texts, - "dimensions": dimensions, - "overflow_strategy": overflow_strategy, "task": task, + "overflow_strategy": overflow_strategy, + "dimensions": dimensions, }, embedding_create_params.EmbeddingCreateParams, ), diff --git a/src/isaacus/resources/extractions/__init__.py b/src/isaacus/resources/extractions/__init__.py index 820c06a..f36d186 100644 --- a/src/isaacus/resources/extractions/__init__.py +++ b/src/isaacus/resources/extractions/__init__.py @@ -1,12 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .qa import ( - QaResource, - AsyncQaResource, - QaResourceWithRawResponse, - AsyncQaResourceWithRawResponse, - QaResourceWithStreamingResponse, - AsyncQaResourceWithStreamingResponse, + QAResource, + AsyncQAResource, + QAResourceWithRawResponse, + AsyncQAResourceWithRawResponse, + QAResourceWithStreamingResponse, + AsyncQAResourceWithStreamingResponse, ) from .extractions import ( ExtractionsResource, @@ -18,12 +18,12 @@ ) __all__ = [ - "QaResource", - "AsyncQaResource", - "QaResourceWithRawResponse", - "AsyncQaResourceWithRawResponse", - "QaResourceWithStreamingResponse", - "AsyncQaResourceWithStreamingResponse", + "QAResource", + "AsyncQAResource", + "QAResourceWithRawResponse", + "AsyncQAResourceWithRawResponse", + "QAResourceWithStreamingResponse", + "AsyncQAResourceWithStreamingResponse", "ExtractionsResource", "AsyncExtractionsResource", "ExtractionsResourceWithRawResponse", diff --git a/src/isaacus/resources/extractions/extractions.py b/src/isaacus/resources/extractions/extractions.py index a967336..ee0b810 100644 --- a/src/isaacus/resources/extractions/extractions.py +++ b/src/isaacus/resources/extractions/extractions.py @@ -3,12 +3,12 @@ from __future__ import annotations from .qa import ( - QaResource, - AsyncQaResource, - QaResourceWithRawResponse, - AsyncQaResourceWithRawResponse, - QaResourceWithStreamingResponse, - AsyncQaResourceWithStreamingResponse, + QAResource, + AsyncQAResource, + QAResourceWithRawResponse, + AsyncQAResourceWithRawResponse, + QAResourceWithStreamingResponse, + AsyncQAResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -18,8 +18,8 @@ class ExtractionsResource(SyncAPIResource): @cached_property - def qa(self) -> QaResource: - return QaResource(self._client) + def qa(self) -> QAResource: + return QAResource(self._client) @cached_property def with_raw_response(self) -> ExtractionsResourceWithRawResponse: @@ -43,8 +43,8 @@ def with_streaming_response(self) -> ExtractionsResourceWithStreamingResponse: class AsyncExtractionsResource(AsyncAPIResource): @cached_property - def qa(self) -> AsyncQaResource: - return AsyncQaResource(self._client) + def qa(self) -> AsyncQAResource: + return AsyncQAResource(self._client) @cached_property def with_raw_response(self) -> AsyncExtractionsResourceWithRawResponse: @@ -71,8 +71,8 @@ def __init__(self, extractions: ExtractionsResource) -> None: self._extractions = extractions @cached_property - def qa(self) -> QaResourceWithRawResponse: - return QaResourceWithRawResponse(self._extractions.qa) + def qa(self) -> QAResourceWithRawResponse: + return QAResourceWithRawResponse(self._extractions.qa) class AsyncExtractionsResourceWithRawResponse: @@ -80,8 +80,8 @@ def __init__(self, extractions: AsyncExtractionsResource) -> None: self._extractions = extractions @cached_property - def qa(self) -> AsyncQaResourceWithRawResponse: - return AsyncQaResourceWithRawResponse(self._extractions.qa) + def qa(self) -> AsyncQAResourceWithRawResponse: + return AsyncQAResourceWithRawResponse(self._extractions.qa) class ExtractionsResourceWithStreamingResponse: @@ -89,8 +89,8 @@ def __init__(self, extractions: ExtractionsResource) -> None: self._extractions = extractions @cached_property - def qa(self) -> QaResourceWithStreamingResponse: - return QaResourceWithStreamingResponse(self._extractions.qa) + def qa(self) -> QAResourceWithStreamingResponse: + return QAResourceWithStreamingResponse(self._extractions.qa) class AsyncExtractionsResourceWithStreamingResponse: @@ -98,5 +98,5 @@ def __init__(self, extractions: AsyncExtractionsResource) -> None: self._extractions = extractions @cached_property - def qa(self) -> AsyncQaResourceWithStreamingResponse: - return AsyncQaResourceWithStreamingResponse(self._extractions.qa) + def qa(self) -> AsyncQAResourceWithStreamingResponse: + return AsyncQAResourceWithStreamingResponse(self._extractions.qa) diff --git a/src/isaacus/resources/extractions/qa.py b/src/isaacus/resources/extractions/qa.py index 22168f3..454f3e0 100644 --- a/src/isaacus/resources/extractions/qa.py +++ b/src/isaacus/resources/extractions/qa.py @@ -21,28 +21,28 @@ from ...types.extractions import qa_create_params from ...types.extractions.answer_extraction_response import AnswerExtractionResponse -__all__ = ["QaResource", "AsyncQaResource"] +__all__ = ["QAResource", "AsyncQAResource"] -class QaResource(SyncAPIResource): +class QAResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> QaResourceWithRawResponse: + def with_raw_response(self) -> QAResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/isaacus-dev/isaacus-python#accessing-raw-response-data-eg-headers """ - return QaResourceWithRawResponse(self) + return QAResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> QaResourceWithStreamingResponse: + def with_streaming_response(self) -> QAResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/isaacus-dev/isaacus-python#with_streaming_response """ - return QaResourceWithStreamingResponse(self) + return QAResourceWithStreamingResponse(self) def create( self, @@ -50,9 +50,9 @@ def create( model: Literal["kanon-answer-extractor", "kanon-answer-extractor-mini"], query: str, texts: SequenceNotStr[str], - chunking_options: Optional[qa_create_params.ChunkingOptions] | Omit = omit, ignore_inextractability: bool | Omit = omit, top_k: int | Omit = omit, + chunking_options: Optional[qa_create_params.ChunkingOptions] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -82,8 +82,6 @@ def create( Each text must contain at least one non-whitespace character. - chunking_options: Options for how to split text into smaller chunks. - ignore_inextractability: Whether to, if the model's score of the likelihood that an answer can not be extracted from a text is greater than the highest score of all possible answers, still return the highest scoring answers for that text. @@ -96,6 +94,8 @@ def create( If `null`, which is the default, all answers will be returned. + chunking_options: Options for how to split text into smaller chunks. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -111,11 +111,11 @@ def create( "model": model, "query": query, "texts": texts, - "chunking_options": chunking_options, "ignore_inextractability": ignore_inextractability, "top_k": top_k, + "chunking_options": chunking_options, }, - qa_create_params.QaCreateParams, + qa_create_params.QACreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -124,25 +124,25 @@ def create( ) -class AsyncQaResource(AsyncAPIResource): +class AsyncQAResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncQaResourceWithRawResponse: + def with_raw_response(self) -> AsyncQAResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/isaacus-dev/isaacus-python#accessing-raw-response-data-eg-headers """ - return AsyncQaResourceWithRawResponse(self) + return AsyncQAResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncQaResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncQAResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/isaacus-dev/isaacus-python#with_streaming_response """ - return AsyncQaResourceWithStreamingResponse(self) + return AsyncQAResourceWithStreamingResponse(self) async def create( self, @@ -150,9 +150,9 @@ async def create( model: Literal["kanon-answer-extractor", "kanon-answer-extractor-mini"], query: str, texts: SequenceNotStr[str], - chunking_options: Optional[qa_create_params.ChunkingOptions] | Omit = omit, ignore_inextractability: bool | Omit = omit, top_k: int | Omit = omit, + chunking_options: Optional[qa_create_params.ChunkingOptions] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -182,8 +182,6 @@ async def create( Each text must contain at least one non-whitespace character. - chunking_options: Options for how to split text into smaller chunks. - ignore_inextractability: Whether to, if the model's score of the likelihood that an answer can not be extracted from a text is greater than the highest score of all possible answers, still return the highest scoring answers for that text. @@ -196,6 +194,8 @@ async def create( If `null`, which is the default, all answers will be returned. + chunking_options: Options for how to split text into smaller chunks. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -211,11 +211,11 @@ async def create( "model": model, "query": query, "texts": texts, - "chunking_options": chunking_options, "ignore_inextractability": ignore_inextractability, "top_k": top_k, + "chunking_options": chunking_options, }, - qa_create_params.QaCreateParams, + qa_create_params.QACreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -224,8 +224,8 @@ async def create( ) -class QaResourceWithRawResponse: - def __init__(self, qa: QaResource) -> None: +class QAResourceWithRawResponse: + def __init__(self, qa: QAResource) -> None: self._qa = qa self.create = to_raw_response_wrapper( @@ -233,8 +233,8 @@ def __init__(self, qa: QaResource) -> None: ) -class AsyncQaResourceWithRawResponse: - def __init__(self, qa: AsyncQaResource) -> None: +class AsyncQAResourceWithRawResponse: + def __init__(self, qa: AsyncQAResource) -> None: self._qa = qa self.create = async_to_raw_response_wrapper( @@ -242,8 +242,8 @@ def __init__(self, qa: AsyncQaResource) -> None: ) -class QaResourceWithStreamingResponse: - def __init__(self, qa: QaResource) -> None: +class QAResourceWithStreamingResponse: + def __init__(self, qa: QAResource) -> None: self._qa = qa self.create = to_streamed_response_wrapper( @@ -251,8 +251,8 @@ def __init__(self, qa: QaResource) -> None: ) -class AsyncQaResourceWithStreamingResponse: - def __init__(self, qa: AsyncQaResource) -> None: +class AsyncQAResourceWithStreamingResponse: + def __init__(self, qa: AsyncQAResource) -> None: self._qa = qa self.create = async_to_streamed_response_wrapper( diff --git a/src/isaacus/resources/rerankings.py b/src/isaacus/resources/rerankings.py index 94b7b31..cde9f98 100644 --- a/src/isaacus/resources/rerankings.py +++ b/src/isaacus/resources/rerankings.py @@ -50,10 +50,10 @@ def create( model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"], query: str, texts: SequenceNotStr[str], - chunking_options: Optional[reranking_create_params.ChunkingOptions] | Omit = omit, + top_n: Optional[int] | Omit = omit, is_iql: bool | Omit = omit, scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | Omit = omit, - top_n: Optional[int] | Omit = omit, + chunking_options: Optional[reranking_create_params.ChunkingOptions] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -82,7 +82,7 @@ def create( Each text must contain at least one non-whitespace character. - chunking_options: Options for how to split text into smaller chunks. + top_n: A whole number greater than or equal to 1. is_iql: Whether the query should be interpreted as an [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query, which is not @@ -104,7 +104,7 @@ def create( `chunk_min` uses the lowest relevance score of all of a text's chunks. - top_n: A whole number greater than or equal to 1. + chunking_options: Options for how to split text into smaller chunks. extra_headers: Send extra headers @@ -121,10 +121,10 @@ def create( "model": model, "query": query, "texts": texts, - "chunking_options": chunking_options, + "top_n": top_n, "is_iql": is_iql, "scoring_method": scoring_method, - "top_n": top_n, + "chunking_options": chunking_options, }, reranking_create_params.RerankingCreateParams, ), @@ -161,10 +161,10 @@ async def create( model: Literal["kanon-universal-classifier", "kanon-universal-classifier-mini"], query: str, texts: SequenceNotStr[str], - chunking_options: Optional[reranking_create_params.ChunkingOptions] | Omit = omit, + top_n: Optional[int] | Omit = omit, is_iql: bool | Omit = omit, scoring_method: Literal["auto", "chunk_max", "chunk_avg", "chunk_min"] | Omit = omit, - top_n: Optional[int] | Omit = omit, + chunking_options: Optional[reranking_create_params.ChunkingOptions] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -193,7 +193,7 @@ async def create( Each text must contain at least one non-whitespace character. - chunking_options: Options for how to split text into smaller chunks. + top_n: A whole number greater than or equal to 1. is_iql: Whether the query should be interpreted as an [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query, which is not @@ -215,7 +215,7 @@ async def create( `chunk_min` uses the lowest relevance score of all of a text's chunks. - top_n: A whole number greater than or equal to 1. + chunking_options: Options for how to split text into smaller chunks. extra_headers: Send extra headers @@ -232,10 +232,10 @@ async def create( "model": model, "query": query, "texts": texts, - "chunking_options": chunking_options, + "top_n": top_n, "is_iql": is_iql, "scoring_method": scoring_method, - "top_n": top_n, + "chunking_options": chunking_options, }, reranking_create_params.RerankingCreateParams, ), diff --git a/src/isaacus/types/__init__.py b/src/isaacus/types/__init__.py index f1751e9..98a4f77 100644 --- a/src/isaacus/types/__init__.py +++ b/src/isaacus/types/__init__.py @@ -2,9 +2,23 @@ from __future__ import annotations +from .ilgs_v1_date import ILGSv1Date as ILGSv1Date +from .ilgs_v1_span import ILGSv1Span as ILGSv1Span +from .ilgs_v1_term import ILGSv1Term as ILGSv1Term +from .ilgs_v1_email import ILGSv1Email as ILGSv1Email +from .ilgs_v1_quote import ILGSv1Quote as ILGSv1Quote +from .ilgs_v1_person import ILGSv1Person as ILGSv1Person +from .ilgs_v1_segment import ILGSv1Segment as ILGSv1Segment +from .ilgs_v1_website import ILGSv1Website as ILGSv1Website +from .ilgs_v1_document import ILGSv1Document as ILGSv1Document +from .ilgs_v1_location import ILGSv1Location as ILGSv1Location +from .ilgs_v1_id_number import ILGSv1IDNumber as ILGSv1IDNumber from .embedding_response import EmbeddingResponse as EmbeddingResponse from .reranking_response import RerankingResponse as RerankingResponse from .enrichment_response import EnrichmentResponse as EnrichmentResponse +from .ilgs_v1_phone_number import ILGSv1PhoneNumber as ILGSv1PhoneNumber +from .ilgs_v1_crossreference import ILGSv1Crossreference as ILGSv1Crossreference from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams from .reranking_create_params import RerankingCreateParams as RerankingCreateParams from .enrichment_create_params import EnrichmentCreateParams as EnrichmentCreateParams +from .ilgs_v1_external_document import ILGSv1ExternalDocument as ILGSv1ExternalDocument diff --git a/src/isaacus/types/classifications/universal_classification_response.py b/src/isaacus/types/classifications/universal_classification_response.py index aa4d93e..1c574fe 100644 --- a/src/isaacus/types/classifications/universal_classification_response.py +++ b/src/isaacus/types/classifications/universal_classification_response.py @@ -8,13 +8,6 @@ class ClassificationChunk(BaseModel): - end: int - """ - The index of the character immediately after the last character of the chunk in - the original text, beginning from `0` (such that, in Python, the chunk is - equivalent to `text[start:end]`). - """ - index: int """ The original position of the chunk in the outputted list of chunks before @@ -22,6 +15,19 @@ class ClassificationChunk(BaseModel): `1`). """ + start: int + """ + The index of the character in the original text where the chunk starts, + beginning from `0`. + """ + + end: int + """ + The index of the character immediately after the last character of the chunk in + the original text, beginning from `0` (such that, in Python, the chunk is + equivalent to `text[start:end]`). + """ + score: float """ The model's score of the likelihood that the query expressed about the chunk is @@ -31,26 +37,11 @@ class ClassificationChunk(BaseModel): score less than `0.5` indicates that the chunk does not support the query. """ - start: int - """ - The index of the character in the original text where the chunk starts, - beginning from `0`. - """ - text: str """The text of the chunk.""" class Classification(BaseModel): - chunks: Optional[List[ClassificationChunk]] = None - """ - The text as broken into chunks by - [semchunk](https://github.com/isaacus-dev/semchunk), each chunk with its own - confidence score, ordered from highest to lowest score. - - If no chunking occurred, this will be `null`. - """ - index: int """ The index of the text in the input array of texts, starting from `0` (and, @@ -66,6 +57,15 @@ class Classification(BaseModel): score less than `0.5` indicates that the text does not support the query. """ + chunks: Optional[List[ClassificationChunk]] = None + """ + The text as broken into chunks by + [semchunk](https://github.com/isaacus-dev/semchunk), each chunk with its own + confidence score, ordered from highest to lowest score. + + If no chunking occurred, this will be `null`. + """ + class Usage(BaseModel): """Statistics about the usage of resources in the process of classifying the text.""" diff --git a/src/isaacus/types/classifications/universal_create_params.py b/src/isaacus/types/classifications/universal_create_params.py index c79b494..8130d0e 100644 --- a/src/isaacus/types/classifications/universal_create_params.py +++ b/src/isaacus/types/classifications/universal_create_params.py @@ -34,9 +34,6 @@ class UniversalCreateParams(TypedDict, total=False): Each text must contain at least one non-whitespace character. """ - chunking_options: Optional[ChunkingOptions] - """Options for how to split text into smaller chunks.""" - is_iql: bool """ Whether the query should be interpreted as an @@ -57,15 +54,18 @@ class UniversalCreateParams(TypedDict, total=False): `chunk_min` uses the lowest confidence score of all of the texts' chunks. """ + chunking_options: Optional[ChunkingOptions] + """Options for how to split text into smaller chunks.""" + class ChunkingOptions(TypedDict, total=False): """Options for how to split text into smaller chunks.""" + size: Optional[int] + """A whole number greater than or equal to 1.""" + overlap_ratio: Optional[float] """A number greater than or equal to 0 and less than 1.""" overlap_tokens: Optional[int] """A whole number greater than or equal to 0.""" - - size: Optional[int] - """A whole number greater than or equal to 1.""" diff --git a/src/isaacus/types/embedding_create_params.py b/src/isaacus/types/embedding_create_params.py index 2db7c07..18803fb 100644 --- a/src/isaacus/types/embedding_create_params.py +++ b/src/isaacus/types/embedding_create_params.py @@ -25,8 +25,15 @@ class EmbeddingCreateParams(TypedDict, total=False): No more than 128 texts can be embedded in a single request. """ - dimensions: Optional[int] - """A whole number greater than or equal to 1.""" + task: Optional[Literal["retrieval/query", "retrieval/document"]] + """The task the embeddings will be used for. + + `retrieval/query` is meant for queries and statements, and `retrieval/document` + is meant for anything to be retrieved using query embeddings. + + If `null`, which is the default setting, embeddings will not be optimized for + any particular task. + """ overflow_strategy: Optional[Literal["drop_end"]] """The strategy to employ when content exceeds the model's maximum input length. @@ -38,12 +45,5 @@ class EmbeddingCreateParams(TypedDict, total=False): input length. """ - task: Optional[Literal["retrieval/query", "retrieval/document"]] - """The task the embeddings will be used for. - - `retrieval/query` is meant for queries and statements, and `retrieval/document` - is meant for anything to be retrieved using query embeddings. - - If `null`, which is the default setting, embeddings will not be optimized for - any particular task. - """ + dimensions: Optional[int] + """A whole number greater than or equal to 1.""" diff --git a/src/isaacus/types/embedding_response.py b/src/isaacus/types/embedding_response.py index 13d6c89..ed81db9 100644 --- a/src/isaacus/types/embedding_response.py +++ b/src/isaacus/types/embedding_response.py @@ -8,15 +8,15 @@ class Embedding(BaseModel): - embedding: List[float] - """The embedding of the content represented as an array of floating point numbers.""" - index: int """ The position of the content in the input array of contents, starting from `0` (and, therefore, ending at the number of contents minus `1`). """ + embedding: List[float] + """The embedding of the content represented as an array of floating point numbers.""" + class Usage(BaseModel): """Statistics about the usage of resources in the process of embedding the inputs.""" diff --git a/src/isaacus/types/enrichment_response.py b/src/isaacus/types/enrichment_response.py index 95d00e6..70de77f 100644 --- a/src/isaacus/types/enrichment_response.py +++ b/src/isaacus/types/enrichment_response.py @@ -1,1423 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from typing_extensions import Literal +from typing import List from .._models import BaseModel +from .ilgs_v1_document import ILGSv1Document -__all__ = [ - "EnrichmentResponse", - "Result", - "ResultDocument", - "ResultDocumentCrossreference", - "ResultDocumentCrossreferenceSpan", - "ResultDocumentDate", - "ResultDocumentDateMention", - "ResultDocumentEmail", - "ResultDocumentEmailMention", - "ResultDocumentExternalDocument", - "ResultDocumentExternalDocumentMention", - "ResultDocumentExternalDocumentName", - "ResultDocumentExternalDocumentPinpoint", - "ResultDocumentHeading", - "ResultDocumentIDNumber", - "ResultDocumentIDNumberMention", - "ResultDocumentJunk", - "ResultDocumentLocation", - "ResultDocumentLocationMention", - "ResultDocumentLocationName", - "ResultDocumentPerson", - "ResultDocumentPersonMention", - "ResultDocumentPersonName", - "ResultDocumentPhoneNumber", - "ResultDocumentPhoneNumberMention", - "ResultDocumentQuote", - "ResultDocumentQuoteSpan", - "ResultDocumentSegment", - "ResultDocumentSegmentCode", - "ResultDocumentSegmentSpan", - "ResultDocumentSegmentTitle", - "ResultDocumentSegmentTypeName", - "ResultDocumentSubtitle", - "ResultDocumentTerm", - "ResultDocumentTermMeaning", - "ResultDocumentTermMention", - "ResultDocumentTermName", - "ResultDocumentTitle", - "ResultDocumentWebsite", - "ResultDocumentWebsiteMention", - "Usage", -] - - -class ResultDocumentCrossreferenceSpan(BaseModel): - """The span of the segment within the document's text.""" - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentCrossreference(BaseModel): - """A cross-reference within the document pointing to one or more segments.""" - - end: str - """ - The unique identifier of the latest segment in the span of segments being - cross-referenced with ties broken in favor of the least-nested (i.e., largest) - segment. If the cross-reference points to a single segment, `start` and `end` - will be identical. - """ - - span: ResultDocumentCrossreferenceSpan - """The span of the segment within the document's text.""" - - start: str - """ - The unique identifier of the earliest segment in the span of segments being - cross-referenced with ties broken in favor of the least-nested (i.e., largest) - segment. If the cross-reference points to a single segment, `start` and `end` - will be identical. - """ - - -class ResultDocumentDateMention(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentDate(BaseModel): - """ - A date identified in a document belonging to one of the following types: `creation`, `signature`, `effective`, `expiry`, `delivery`, `renewal`, `payment`, `birth`, or `death`. - - Only Gregorian dates between the years 1000 and 9999 (inclusive) fitting into one of the supported date types are extractable. - """ - - mentions: List[ResultDocumentDateMention] - """ - An array of one or more spans within the document's text where the date is - mentioned. - """ - - person: Optional[str] = None - """ - A unique identifier for a legal person in the format `per:{index}` where - `{index}` is a non-negative incrementing integer starting from zero. - """ - - type: Literal["creation", "signature", "effective", "expiry", "delivery", "renewal", "payment", "birth", "death"] - """ - The type of the date, being one of `creation`, `signature`, `effective`, - `expiry`, `delivery`, `renewal`, `payment`, `birth`, or `death`. If a date is - mentioned in a document that does not fit into a supported type, it will not be - extracted. - - `creation` denotes the date the document was created. There may only be one - `creation` date per document. - - `signature` denotes the date the document was signed. - - `effective` denotes the date when the document or a part thereof comes into - effect (e.g., commencement or enactment dates). - - `expiry` denotes the date when the document or a part thereof is no longer in - effect. - - `delivery` denotes the date when goods or services are to be delivered under the - document. - - `renewal` denotes the date when one or more of the document's terms are to be - renewed. - - `payment` denotes the date when payment is to be made under the document. - - `birth` denotes the birth date of a natural person or establishment (e.g., - incorporation) date of a non-natural legal person identified in the document. - There can only be one `birth` date linked to a single person and all `birth` - dates must be linked to a person. A person's `birth` date will never be after - their `death` date. - - `death` denotes the death date of a natural person or dissolution date of a - non-natural legal person identified in the document. There can only be one - `death` date linked to a single person and all `death` dates must be linked to a - person. A person's `death` date will never be before their `birth` date. - """ - - value: str - """The date in ISO 8601 format (YYYY-MM-DD).""" - - -class ResultDocumentEmailMention(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentEmail(BaseModel): - """An email address identified in a document belonging to a legal person. - - If an email address was mentioned in the document but is not attributable to a legal person, it will not be extracted. - """ - - address: str - """The normalized email address.""" - - mentions: List[ResultDocumentEmailMention] - """ - An array of one or more spans within the document's text where the email address - is mentioned. - """ - - person: str - """The unique identifier of the person that this email address belongs to.""" - - -class ResultDocumentExternalDocumentMention(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentExternalDocumentName(BaseModel): - """The span of the segment within the document's text.""" - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentExternalDocumentPinpoint(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentExternalDocument(BaseModel): - """A document identified within another document.""" - - id: str - """ - The unique identifier of the external document in the format `exd:{index}` where - `{index}` is a non-negative incrementing integer starting from zero. - """ - - jurisdiction: Optional[str] = None - """ - A jurisdiction code representing a country (via an initial country code) and, - optionally, a subdivision within that country (via a subsequent subdivision code - prefixed by a hyphen). - - All 249 ISO 3166-1 alpha-2 country codes are representable in addition to - special `INT` and `EU` codes for international and European Union law, - respectively. - - All 5,046 ISO 3166-2 codes are also representable in addition to a special `FED` - code for federal law. - """ - - mentions: List[ResultDocumentExternalDocumentMention] - """ - An array of one or more spans within the document's text where the external - document is mentioned by name, for example, 'the US Constitution' in 'the Second - Amendment to the US Constitution protects freedom of speech'. - """ - - name: ResultDocumentExternalDocumentName - """The span of the segment within the document's text.""" - - pinpoints: List[ResultDocumentExternalDocumentPinpoint] - """ - An array of spans within the document's text where specific parts of the - external document are referenced, for example, 'Section 2' in 'as defined in - Section 2 of the US Constitution'. - """ - - reception: Literal["positive", "mixed", "negative", "neutral"] - """ - The sentiment of the document towards the external document, being one of - `positive`, `mixed`, `negative`, or `neutral`. - - `positive` indicates that the document expresses a favorable view of the - external document whether by endorsing or approving it. - - `mixed` indicates that the document expresses both favorable and unfavorable - views of the external document, for example, by affirming parts of it and - disapproving others. - - `negative` indicates that the document expresses an unfavorable view of the - external document whether by criticizing, repealing, overruling, or explicitly - contradicting it. - - `neutral` indicates that the document references the external document without - expressing any particular sentiment towards it. - """ - - type: Literal["statute", "regulation", "decision", "contract", "other"] - """ - The type of the external document, being one of `statute`, `regulation`, - `decision`, `contract`, or `other`. - - `statute` denotes primary legislation such as acts, bills, codes, and - constitutions. - - `regulation` denotes secondary legislation such as rules, statutory instruments, - and ordinances. - - `decision` denotes judicial or quasi-judicial decisions such as court judgments, - judicial opinions, and tribunal rulings. - - `other` is used for all other types of legal documents that do not fit into any - of the predefined types. - """ - - -class ResultDocumentHeading(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentIDNumberMention(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentIDNumber(BaseModel): - """An identification number mentioned in a document belonging to a legal person. - - If an identification number was mentioned in the document but is not attributable to a legal person, it will not be extracted. - """ - - mentions: List[ResultDocumentIDNumberMention] - """ - An array of one or more spans within the document's text where the - identification number is mentioned. - """ - - number: str - """The identification number.""" - - person: str - """The unique identifier of the person that this identification number belongs to.""" - - -class ResultDocumentJunk(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentLocationMention(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentLocationName(BaseModel): - """The span of the segment within the document's text.""" - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentLocation(BaseModel): - """A location identified within a document.""" - - id: str - """ - The unique identifier of the location in the format `loc:{index}` where - `{index}` is a non-negative incrementing integer starting from zero. - """ - - mentions: List[ResultDocumentLocationMention] - """ - An array of one or more spans within the document's text where the location is - mentioned. - """ - - name: ResultDocumentLocationName - """The span of the segment within the document's text.""" - - parent: Optional[str] = None - """ - A unique identifier for a location in the format `loc:{index}` where `{index}` - is a non-negative incrementing integer starting from zero. - """ - - type: Literal["country", "state", "city", "address", "other"] - """ - The type of the location, being one of `country`, `state`, `city`, `address`, or - `other`. - """ - - -class ResultDocumentPersonMention(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentPersonName(BaseModel): - """The span of the segment within the document's text.""" - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentPerson(BaseModel): - """A legal person identified in a document.""" - - id: str - """ - The unique identifier of the person in the format `per:{index}` where `{index}` - is a non-negative incrementing integer starting from zero. - """ - - mentions: List[ResultDocumentPersonMention] - """ - An array of one or more spans within the document's text where the person is - mentioned. - """ - - name: ResultDocumentPersonName - """The span of the segment within the document's text.""" - - parent: Optional[str] = None - """ - A unique identifier for a legal person in the format `per:{index}` where - `{index}` is a non-negative incrementing integer starting from zero. - """ - - residence: Optional[str] = None - """ - A unique identifier for a location in the format `loc:{index}` where `{index}` - is a non-negative incrementing integer starting from zero. - """ - - role: Literal[ - "plaintiff", - "petitioner", - "applicant", - "appellant", - "appellee", - "claimant", - "complainant", - "defendant", - "respondent", - "prior_authority", - "prosecutor", - "defense_counsel", - "amicus", - "intervener", - "borrower", - "lender", - "guarantor", - "lessee", - "lessor", - "employer", - "employee", - "licensor", - "licensee", - "franchisor", - "franchisee", - "buyer", - "seller", - "contractor", - "shareholder", - "joint_venturer", - "investor", - "insurer", - "insured", - "enacting_authority", - "empowered_authority", - "settlor", - "trustee", - "beneficiary", - "debater", - "director", - "governing_jurisdiction", - "clerk", - "witness", - "other", - "non_party", - ] - """The role of the person in relation to the subject of the document. - - The following roles are currently supported: | | | | ------------------------ | - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - | | `plaintiff` | A party initiating the case that is the subject of the - document. | | `petitioner` | A party initiating the petition that is the subject - of the document. | | `applicant` | A party initiating the application that is - the subject of the document. | | `appellant` | A party appealing the decision - that is the subject of the document. | | `appellee` | A party responding to the - appeal that is the subject of the document if they are explicitly referred to as - an 'appellee'. | | `claimant` | A party making a claim in the case that is the - subject of the document. | | `complainant` | A party making a complaint in the - case that is the subject of the document. | | `defendant` | A party defending - against the case that is the subject of the document. | | `respondent` | A party - responding to the petition, appeal, or application that is the subject of the - document. | | `prior_authority` | An authority (e.g., judge, tribunal, court) - that made a prior decision in the case that is the subject of the document. Both - individual judges and courts should be annotated with this role where - applicable. This is not to be used for authorities cited as precedent, only for - those that made prior decisions in the same case. | | `prosecutor` | A lawyer - prosecuting the case that is the subject of the document. | | `defense_counsel` - | A lawyer defending the case that is the subject of the document. | | `amicus` - | A party filing an amicus curiae brief in the case that is the subject of the - document. | | `intervener` | A party attempting to or that has intervened in the - case that is the subject of the document. | | `borrower` | A party borrowing - money or other assets under the agreement that is the subject of the document, - including 'mortgagors' and 'debtors'. | | `lender` | A party lending money or - other assets under the agreement that is the subject of the document, including - 'mortgagees' and 'creditors'. | | `guarantor` | A party guaranteeing obligations - under the agreement that is the subject of the document, including 'sureties'. | - | `lessee` | A party leasing goods or services under the agreement that is the - subject of the document, including 'tenants'. | | `lessor` | A party leasing - goods or services under the agreement that is the subject of the document, - including 'landlords'. | | `employer` | A party employing personnel under the - agreement that is the subject of the document. | | `employee` | A party employed - under the agreement that is the subject of the document. | | `licensor` | A - party licensing intellectual property or other rights under the agreement that - are the subject of the document. | | `licensee` | A party licensed to use - intellectual property or other rights under the agreement that are the subject - of the document. | | `franchisor` | A party granting a franchise under the - agreement that is the subject of the document. | | `franchisee` | A party - granted a franchise under the agreement that is the subject of the document. | | - `buyer` | A party purchasing goods or services under the agreement that is the - subject of the document, including 'purchasers', 'customers', and 'clients'. | | - `seller` | A party selling or providing goods or services under the agreement - that is the subject of the document, including 'Vendors', 'Suppliers', and - 'Service Providers' (where such parties are actually providing goods or services - under the agreement). | | `contractor` | A party contracted to perform work or - services under the agreement that is the subject of the document, including - 'consultants'. | | `shareholder` | A party holding shares or equity under the - agreement that is the subject of the document. | | `joint_venturer` | A party - participating in a joint venture under the agreement that is the subject of the - document. | | `investor` | A party investing money or assets under the agreement - that is the subject of the document. | | `insurer` | A party providing insurance - under the agreement that is the subject of the document. | | `insured` | A party - insured under the agreement that is the subject of the document. | | `settlor` | - A party establishing the trust that is the subject of the document. | | - `trustee` | A party managing the trust that is the subject of the document. | | - `beneficiary` | A party benefiting from the trust that is the subject of the - document. | | `enacting_authority` | An authority (e.g., legislature, regulator, - Minister/Secretary, President/Prime Minister, tribunal, court, judge) giving - legal effect to or authorizing the document. All relevant individuals and bodies - should be annotated with this role where applicable. | | `empowered_authority` | - An authority (e.g., government agency, regulator, Minister/Secretary, - President/Prime Minister, tribunal, court) empowered by the document to carry - out functions or duties. | | `debater` | A person participating in the debate - that is the subject of the document. | | `governing_jurisdiction` | The - jurisdiction whose laws govern the document. | | `director` | A director or - other officer of a corporate legal person mentioned in the document. | | `clerk` - | A clerk, notary, or other official certifying, witnessing, filing, recording, - registering, or otherwise administering the document. | | `witness` | A witness - witnessing the signing of the document, or whose testimony is part of the case - that is the subject of the document. | | `other` | A party to the case, - agreement, legislation, or regulation that is the subject of the document that - does not fit into any of the other roles. | | `non_party` | A legal person - mentioned in the document that is not a party to the case, agreement, - legislation, or regulation that is the subject of the document. | - """ - - type: Literal["natural", "corporate", "politic"] - """ - The legal entity type of the person, being one of `natural`, `corporate`, or - `politic`. - - `natural` denotes a human being in their capacity as a natural legal person, - including when representing unincorporated entities such as partnerships and - trusts. - - `corporate` denotes a body corporate such as a company, incorporated - partnership, or statutory corporation. - - `politic` denotes a body politic such as a court, state, government, or - intergovernmental organization. - """ - - -class ResultDocumentPhoneNumberMention(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentPhoneNumber(BaseModel): - """A valid phone number identified in a document belonging to a legal person. - - If a phone number was mentioned in the document but is not valid, possible, or attributable to a legal person, it will not be extracted. - """ - - mentions: List[ResultDocumentPhoneNumberMention] - """ - An array of one or more spans within the document's text where the phone number - is mentioned. - """ - - number: str - """ - The normalized phone number in E.123 international notation conforming with - local conventions on the use of spaces and hyphens as separators. - """ - - person: str - """The unique identifier of the person that this phone number belongs to.""" - - -class ResultDocumentQuoteSpan(BaseModel): - """The span of the segment within the document's text.""" - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentQuote(BaseModel): - """A quotation within a document.""" - - amending: bool - """ - Whether the quote is being used to amend or modify content, typically in other - documents. - """ - - source_document: Optional[str] = None - """ - A unique identifier for an external document in the format `exd:{index}` where - `{index}` is a non-negative incrementing integer starting from zero. - """ - - source_person: Optional[str] = None - """ - A unique identifier for a legal person in the format `per:{index}` where - `{index}` is a non-negative incrementing integer starting from zero. - """ - - source_segment: Optional[str] = None - """ - A unique identifier for a segment in the format `seg:{index}` where `{index}` is - a non-negative incrementing integer starting from zero. - """ - - span: ResultDocumentQuoteSpan - """The span of the segment within the document's text.""" - - -class ResultDocumentSegmentCode(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentSegmentSpan(BaseModel): - """The span of the segment within the document's text.""" - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentSegmentTitle(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentSegmentTypeName(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentSegment(BaseModel): - """ - A segment within the document representing a structurally distinct portion of the document's content. - """ - - id: str - """ - The unique identifier of the segment in the format `seg:{index}` where `{index}` - is a non-negative incrementing integer starting from zero. - """ - - category: Literal["front_matter", "scope", "main", "annotation", "back_matter", "other"] - """ - The functional 'category' of the segment within the document, being one of - `front_matter`, `scope`, `main`, `annotation`, `back_matter`, or `other`. - - `front_matter` denotes non-operative contextualizing content occurring at the - start of a document such as a preamble or recitals. - - `scope` denotes operative content defining the application or interpretation of - a document such as definition sections and governing law clauses. - - `main` denotes operative, non-scopal content. - - `annotation` denotes non-operative annotative content providing explanatory or - referential information such as commentary, footnotes, and endnotes. - - `back_matter` denotes non-operative contextualizing content occurring at the end - of a document such as authority statements. - - `other` denotes content that does not fit into any of the other categories. - """ - - code: Optional[ResultDocumentSegmentCode] = None - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible - for any two spans to partially overlap; they can only be disjoint, adjacent, or - wholly nested. Spans of the exact same type (e.g., segments) will never be - duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses - zero-based, half-open, Unicode code point-spaced string indexing), indices may - need to be translated accordingly (for example, JavaScript slices into UTF-16 - code units instead of Unicode code points). - """ - - kind: Literal["container", "unit", "item", "figure"] - """ - The structural 'kind' of the segment, being one of `container`, `unit`, `item`, - or `figure`. - - A `container` is a structural or semantic grouping of content such as a chapter. - It can contain segments of any kind or none at all. - - A `unit` is a single syntactically independent unit of text such as a paragraph. - It can only contain `item`s and `figure`s. - - An `item` is a syntactically subordinate unit of text such as an item in a - run-in list. It can only contain other `item`s. Note that an `item` is - conceptually distinct from a list item—it is perfectly possible to encounter - list items that are syntactically independent of their surrounding items just as - it is possible to encounter dependent clauses that do not appear as part of a - list. - - A `figure` is a visually structured or tabular unit of content such as a - diagram, equation, or table. It cannot contain segments. - """ - - parent: Optional[str] = None - """ - A unique identifier for a segment in the format `seg:{index}` where `{index}` is - a non-negative incrementing integer starting from zero. - """ - - span: ResultDocumentSegmentSpan - """The span of the segment within the document's text.""" - - title: Optional[ResultDocumentSegmentTitle] = None - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible - for any two spans to partially overlap; they can only be disjoint, adjacent, or - wholly nested. Spans of the exact same type (e.g., segments) will never be - duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses - zero-based, half-open, Unicode code point-spaced string indexing), indices may - need to be translated accordingly (for example, JavaScript slices into UTF-16 - code units instead of Unicode code points). - """ - - type: Optional[ - Literal[ - "title", - "book", - "part", - "chapter", - "subchapter", - "division", - "subdivision", - "subpart", - "subtitle", - "table_of_contents", - "article", - "section", - "regulation", - "rule", - "clause", - "paragraph", - "subarticle", - "subsection", - "subregulation", - "subrule", - "subclause", - "subparagraph", - "item", - "subitem", - "point", - "indent", - "schedule", - "annex", - "appendix", - "exhibit", - "recital", - "signature", - "note", - "figure", - "table", - "formula", - ] - ] = None - """ - The addressable 'type' of the segment within the document's referential scheme - and hierarchy, whether defined explicitly (e.g., by headings, such as - 'Section 2. Definitions'), implicitly (e.g., by way of reference, such as 'as - defined in Section 2'), or by convention (e.g., [42] in a judgment often denotes - a `paragraph`, independent provisions in statute are often `section`s, etc.). If - the type is not known or not applicable, it will be set to `null`. - - Note that, although many segment types may coincide with syntactic constructs, - they should be thought of purely as distinct formal citable units. Most - paragraphs (in the syntactic sense) will not have the `paragraph` type, for - example. That type is reserved for segments that would formally be cited as a - 'Paragraph' within the document's referential scheme. - - The following types are currently supported: `title`, `book`, `part`, `chapter`, - `subchapter`, `division`, `subdivision`, `subpart`, `subtitle`, - `table_of_contents`, `article`, `section`, `regulation`, `rule`, `clause`, - `paragraph`, `subarticle`, `subsection`, `subregulation`, `subrule`, - `subclause`, `subparagraph`, `item`, `subitem`, `point`, `indent`, `schedule`, - `annex`, `appendix`, `exhibit`, `recital`, `signature`, `note`, `figure`, - `table`, and `formula`. - - The `title`, `book`, `part`, `chapter`, `subchapter`, `division`, `subdivision`, - `subpart`, `subtitle`, and `table_of_contents` types are exclusive to the - `container` kind. - - The `figure` kind only supports the `figure`, `table`, and `formula` types, all - of which are exclusive to it. - """ - - type_name: Optional[ResultDocumentSegmentTypeName] = None - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible - for any two spans to partially overlap; they can only be disjoint, adjacent, or - wholly nested. Spans of the exact same type (e.g., segments) will never be - duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses - zero-based, half-open, Unicode code point-spaced string indexing), indices may - need to be translated accordingly (for example, JavaScript slices into UTF-16 - code units instead of Unicode code points). - """ - - -class ResultDocumentSubtitle(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentTermMeaning(BaseModel): - """The span of the segment within the document's text.""" - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentTermMention(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentTermName(BaseModel): - """The span of the segment within the document's text.""" - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentTerm(BaseModel): - """A term assigned a definite meaning within a document.""" - - id: str - """ - The unique identifier of the term in the format `term:{index}` where `{index}` - is a non-negative incrementing integer starting from zero. - """ - - meaning: ResultDocumentTermMeaning - """The span of the segment within the document's text.""" - - mentions: List[ResultDocumentTermMention] - """ - An array of spans within the document's text where the term is mentioned outside - of its definition. - - It is possible for the term to have no mentions if, outside of its definition, - it is never referred to in the document. - """ - - name: ResultDocumentTermName - """The span of the segment within the document's text.""" - - -class ResultDocumentTitle(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentWebsiteMention(BaseModel): - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). - """ - - end: int - """ - The zero-based end index of the half-open span (i.e., the end is exclusive) of - Unicode code points in the input text. - """ - - start: int - """ - The zero-based start index of the half-open span of Unicode code points in the - input text. - """ - - -class ResultDocumentWebsite(BaseModel): - """A website identified in a document belonging to a legal person. - - If a website was mentioned in the document but is not attributable to a legal person, it will not be extracted. - """ - - mentions: List[ResultDocumentWebsiteMention] - """ - An array of one or more spans within the document's text where the website is - mentioned (including paths and slugs which are not part of the website's - normalized URL). - """ - - person: str - """The unique identifier of the person that this website belongs to.""" - - url: str - """The normalized URL of the website in the form `https://{host}/`.""" - - -class ResultDocument(BaseModel): - """The enriched document.""" - - crossreferences: List[ResultDocumentCrossreference] - """ - An array of cross-references within the document pointing to a single segment or - a span of segments. - """ - - dates: List[ResultDocumentDate] - """ - An array of dates identified in the document belonging to one of the following - types: `creation`, `signature`, `effective`, `expiry`, `delivery`, `renewal`, - `payment`, `birth`, or `death`. - - Only Gregorian dates between the years 1000 and 9999 (inclusive) fitting into - one of the supported date types are extractable. - """ - - emails: List[ResultDocumentEmail] - """ - An array of email addresses identified in the document belonging to legal - persons. - - Email addresses mentioned in the document that are not attributable to legal - persons will not be extracted. - """ - - external_documents: List[ResultDocumentExternalDocument] - """An array of documents identified within the document.""" - - headings: List[ResultDocumentHeading] - """An array of spans within the document's text constituting headings.""" - - id_numbers: List[ResultDocumentIDNumber] - """ - An array of identification numbers identified in the document belonging to legal - persons. - - Identification numbers mentioned in the document that are not attributable to - legal persons will not be extracted. - """ - - junk: List[ResultDocumentJunk] - """ - An array of spans within the document's text constituting non-operative, - non-substantive 'junk' content such as headers, footers, page numbers, and OCR - artifacts. - """ - - jurisdiction: Optional[str] = None - """ - A jurisdiction code representing a country (via an initial country code) and, - optionally, a subdivision within that country (via a subsequent subdivision code - prefixed by a hyphen). - - All 249 ISO 3166-1 alpha-2 country codes are representable in addition to - special `INT` and `EU` codes for international and European Union law, - respectively. - - All 5,046 ISO 3166-2 codes are also representable in addition to a special `FED` - code for federal law. - """ - - locations: List[ResultDocumentLocation] - """An array of locations identified in the document.""" - - persons: List[ResultDocumentPerson] - """An array of legal persons identified in the document.""" - - phone_numbers: List[ResultDocumentPhoneNumber] - """ - An array of valid phone numbers identified in the document belonging to legal - persons. - - Phone numbers mentioned in the document that are not valid, possible, or - attributable to legal persons will not be extracted. - """ - - quotes: List[ResultDocumentQuote] - """An array of quotations within the document.""" - - segments: List[ResultDocumentSegment] - """ - An array of segments within the document representing structurally distinct - portions of its content. - """ - - subtitle: Optional[ResultDocumentSubtitle] = None - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible - for any two spans to partially overlap; they can only be disjoint, adjacent, or - wholly nested. Spans of the exact same type (e.g., segments) will never be - duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses - zero-based, half-open, Unicode code point-spaced string indexing), indices may - need to be translated accordingly (for example, JavaScript slices into UTF-16 - code units instead of Unicode code points). - """ - - terms: List[ResultDocumentTerm] - """An array of terms assigned definite meanings within the document.""" - - title: Optional[ResultDocumentTitle] = None - """A zero-based, half-open span into the Unicode code point space of input text. - - All spans are globally laminar and well-nested similar to XML—it is impossible - for any two spans to partially overlap; they can only be disjoint, adjacent, or - wholly nested. Spans of the exact same type (e.g., segments) will never be - duplicated. - - A span cannot be empty and will never start or end at whitespace. - - Note that, when using programming languages other than Python (which uses - zero-based, half-open, Unicode code point-spaced string indexing), indices may - need to be translated accordingly (for example, JavaScript slices into UTF-16 - code units instead of Unicode code points). - """ - - type: Literal["statute", "regulation", "decision", "contract", "other"] - """ - The type of the document, being one of `statute`, `regulation`, `decision`, - `contract`, or `other`. - - `statute` denotes primary legislation such as acts, bills, codes, and - constitutions. - - `regulation` denotes secondary legislation such as rules, statutory instruments, - and ordinances. - - `decision` denotes judicial or quasi-judicial decisions such as court judgments, - judicial opinions, and tribunal rulings. - - `other` is used for all other types of legal documents that do not fit into any - of the predefined types. - """ - - version: Literal["ilgs@1"] - - websites: List[ResultDocumentWebsite] - """An array of websites identified in the document belonging to legal persons. - - Websites mentioned in the document that are not attributable to legal persons - will not be extracted. - """ +__all__ = ["EnrichmentResponse", "Result", "Usage"] class Result(BaseModel): """An enriched document alongside its index in the input array of texts.""" - document: ResultDocument - """The enriched document.""" - index: int """ The index of this document in the input array of texts, starting at `0` (and, therefore, ending at the number of inputs minus `1`). """ + document: ILGSv1Document + """The enriched document.""" + class Usage(BaseModel): """Statistics about the usage of resources in the process of enriching the input.""" diff --git a/src/isaacus/types/extractions/__init__.py b/src/isaacus/types/extractions/__init__.py index 39de7b6..a23d9ed 100644 --- a/src/isaacus/types/extractions/__init__.py +++ b/src/isaacus/types/extractions/__init__.py @@ -2,5 +2,5 @@ from __future__ import annotations -from .qa_create_params import QaCreateParams as QaCreateParams +from .qa_create_params import QACreateParams as QACreateParams from .answer_extraction_response import AnswerExtractionResponse as AnswerExtractionResponse diff --git a/src/isaacus/types/extractions/answer_extraction_response.py b/src/isaacus/types/extractions/answer_extraction_response.py index ba610f6..c6df224 100644 --- a/src/isaacus/types/extractions/answer_extraction_response.py +++ b/src/isaacus/types/extractions/answer_extraction_response.py @@ -10,6 +10,15 @@ class ExtractionAnswer(BaseModel): """An answer extracted from a text.""" + text: str + """The text of the answer.""" + + start: int + """ + The index of the first character of the answer in the text, starting from `0` + (and, therefore, ending at the number of characters in the text minus `1`). + """ + end: int """ The index of the character immediately after the last character of the answer in @@ -22,28 +31,19 @@ class ExtractionAnswer(BaseModel): A score between `0` and `1`, inclusive, representing the strength of the answer. """ - start: int - """ - The index of the first character of the answer in the text, starting from `0` - (and, therefore, ending at the number of characters in the text minus `1`). - """ - - text: str - """The text of the answer.""" - class Extraction(BaseModel): """The result of extracting answers from a text.""" - answers: List[ExtractionAnswer] - """Answers extracted from the text, ordered from highest to lowest score.""" - index: int """ The index of the text in the input array of texts that this result represents, starting from `0` (and, therefore, ending at the number of texts minus `1`). """ + answers: List[ExtractionAnswer] + """Answers extracted from the text, ordered from highest to lowest score.""" + inextractability_score: float """ A score between `0` and `1`, inclusive, representing the likelihood that an diff --git a/src/isaacus/types/extractions/qa_create_params.py b/src/isaacus/types/extractions/qa_create_params.py index 8cc1b91..994fc00 100644 --- a/src/isaacus/types/extractions/qa_create_params.py +++ b/src/isaacus/types/extractions/qa_create_params.py @@ -7,10 +7,10 @@ from ..._types import SequenceNotStr -__all__ = ["QaCreateParams", "ChunkingOptions"] +__all__ = ["QACreateParams", "ChunkingOptions"] -class QaCreateParams(TypedDict, total=False): +class QACreateParams(TypedDict, total=False): model: Required[Literal["kanon-answer-extractor", "kanon-answer-extractor-mini"]] """ The ID of the @@ -35,9 +35,6 @@ class QaCreateParams(TypedDict, total=False): Each text must contain at least one non-whitespace character. """ - chunking_options: Optional[ChunkingOptions] - """Options for how to split text into smaller chunks.""" - ignore_inextractability: bool """ Whether to, if the model's score of the likelihood that an answer can not be @@ -55,15 +52,18 @@ class QaCreateParams(TypedDict, total=False): If `null`, which is the default, all answers will be returned. """ + chunking_options: Optional[ChunkingOptions] + """Options for how to split text into smaller chunks.""" + class ChunkingOptions(TypedDict, total=False): """Options for how to split text into smaller chunks.""" + size: Optional[int] + """A whole number greater than or equal to 1.""" + overlap_ratio: Optional[float] """A number greater than or equal to 0 and less than 1.""" overlap_tokens: Optional[int] """A whole number greater than or equal to 0.""" - - size: Optional[int] - """A whole number greater than or equal to 1.""" diff --git a/src/isaacus/types/ilgs_v1_crossreference.py b/src/isaacus/types/ilgs_v1_crossreference.py new file mode 100644 index 0000000..69b1fdc --- /dev/null +++ b/src/isaacus/types/ilgs_v1_crossreference.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1Crossreference"] + + +class ILGSv1Crossreference(BaseModel): + """A cross-reference within the document pointing to one or more segments.""" + + start: str + """ + The unique identifier of the earliest segment in the span of segments being + cross-referenced with ties broken in favor of the least-nested (i.e., largest) + segment. If the cross-reference points to a single segment, `start` and `end` + will be identical. + """ + + end: str + """ + The unique identifier of the latest segment in the span of segments being + cross-referenced with ties broken in favor of the least-nested (i.e., largest) + segment. If the cross-reference points to a single segment, `start` and `end` + will be identical. + """ + + span: ILGSv1Span + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ diff --git a/src/isaacus/types/ilgs_v1_date.py b/src/isaacus/types/ilgs_v1_date.py new file mode 100644 index 0000000..f210daf --- /dev/null +++ b/src/isaacus/types/ilgs_v1_date.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1Date"] + + +class ILGSv1Date(BaseModel): + """ + A date identified in a document belonging to one of the following types: `creation`, `signature`, `effective`, `expiry`, `delivery`, `renewal`, `payment`, `birth`, or `death`. + + Only Gregorian dates between the years 1000 and 9999 (inclusive) fitting into one of the supported date types are extractable. + """ + + value: str + """The date in ISO 8601 format (YYYY-MM-DD).""" + + type: Literal["creation", "signature", "effective", "expiry", "delivery", "renewal", "payment", "birth", "death"] + """ + The type of the date, being one of `creation`, `signature`, `effective`, + `expiry`, `delivery`, `renewal`, `payment`, `birth`, or `death`. If a date is + mentioned in a document that does not fit into a supported type, it will not be + extracted. + + `creation` denotes the date the document was created. There may only be one + `creation` date per document. + + `signature` denotes the date the document was signed. + + `effective` denotes the date when the document or a part thereof comes into + effect (e.g., commencement or enactment dates). + + `expiry` denotes the date when the document or a part thereof is no longer in + effect. + + `delivery` denotes the date when goods or services are to be delivered under the + document. + + `renewal` denotes the date when one or more of the document's terms are to be + renewed. + + `payment` denotes the date when payment is to be made under the document. + + `birth` denotes the birth date of a natural person or establishment (e.g., + incorporation) date of a non-natural legal person identified in the document. + There can only be one `birth` date linked to a single person and all `birth` + dates must be linked to a person. A person's `birth` date will never be after + their `death` date. + + `death` denotes the death date of a natural person or dissolution date of a + non-natural legal person identified in the document. There can only be one + `death` date linked to a single person and all `death` dates must be linked to a + person. A person's `death` date will never be before their `birth` date. + """ + + person: Optional[str] = None + """ + A unique identifier for a legal person in the format `per:{index}` where + `{index}` is a non-negative incrementing integer starting from zero. + """ + + mentions: List[ILGSv1Span] + """ + An array of one or more spans within the document's text where the date is + mentioned. + """ diff --git a/src/isaacus/types/ilgs_v1_document.py b/src/isaacus/types/ilgs_v1_document.py new file mode 100644 index 0000000..d173736 --- /dev/null +++ b/src/isaacus/types/ilgs_v1_document.py @@ -0,0 +1,172 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .ilgs_v1_date import ILGSv1Date +from .ilgs_v1_span import ILGSv1Span +from .ilgs_v1_term import ILGSv1Term +from .ilgs_v1_email import ILGSv1Email +from .ilgs_v1_quote import ILGSv1Quote +from .ilgs_v1_person import ILGSv1Person +from .ilgs_v1_segment import ILGSv1Segment +from .ilgs_v1_website import ILGSv1Website +from .ilgs_v1_location import ILGSv1Location +from .ilgs_v1_id_number import ILGSv1IDNumber +from .ilgs_v1_phone_number import ILGSv1PhoneNumber +from .ilgs_v1_crossreference import ILGSv1Crossreference +from .ilgs_v1_external_document import ILGSv1ExternalDocument + +__all__ = ["ILGSv1Document"] + + +class ILGSv1Document(BaseModel): + """The enriched document.""" + + title: Optional[ILGSv1Span] = None + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + subtitle: Optional[ILGSv1Span] = None + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + type: Literal["statute", "regulation", "decision", "contract", "other"] + """ + The type of the document, being one of `statute`, `regulation`, `decision`, + `contract`, or `other`. + + `statute` denotes primary legislation such as acts, bills, codes, and + constitutions. + + `regulation` denotes secondary legislation such as rules, statutory instruments, + and ordinances. + + `decision` denotes judicial or quasi-judicial decisions such as court judgments, + judicial opinions, and tribunal rulings. + + `other` is used for all other types of legal documents that do not fit into any + of the predefined types. + """ + + jurisdiction: Optional[str] = None + """ + A jurisdiction code representing a country (via an initial country code) and, + optionally, a subdivision within that country (via a subsequent subdivision code + prefixed by a hyphen). + + All 249 ISO 3166-1 alpha-2 country codes are representable in addition to + special `INT` and `EU` codes for international and European Union law, + respectively. + + All 5,046 ISO 3166-2 codes are also representable in addition to a special `FED` + code for federal law. + """ + + segments: List[ILGSv1Segment] + """ + An array of segments within the document representing structurally distinct + portions of its content. + """ + + crossreferences: List[ILGSv1Crossreference] + """ + An array of cross-references within the document pointing to a single segment or + a span of segments. + """ + + locations: List[ILGSv1Location] + """An array of locations identified in the document.""" + + persons: List[ILGSv1Person] + """An array of legal persons identified in the document.""" + + emails: List[ILGSv1Email] + """ + An array of email addresses identified in the document belonging to legal + persons. + + Email addresses mentioned in the document that are not attributable to legal + persons will not be extracted. + """ + + websites: List[ILGSv1Website] + """An array of websites identified in the document belonging to legal persons. + + Websites mentioned in the document that are not attributable to legal persons + will not be extracted. + """ + + phone_numbers: List[ILGSv1PhoneNumber] + """ + An array of valid phone numbers identified in the document belonging to legal + persons. + + Phone numbers mentioned in the document that are not valid, possible, or + attributable to legal persons will not be extracted. + """ + + id_numbers: List[ILGSv1IDNumber] + """ + An array of identification numbers identified in the document belonging to legal + persons. + + Identification numbers mentioned in the document that are not attributable to + legal persons will not be extracted. + """ + + terms: List[ILGSv1Term] + """An array of terms assigned definite meanings within the document.""" + + external_documents: List[ILGSv1ExternalDocument] + """An array of documents identified within the document.""" + + quotes: List[ILGSv1Quote] + """An array of quotations within the document.""" + + dates: List[ILGSv1Date] + """ + An array of dates identified in the document belonging to one of the following + types: `creation`, `signature`, `effective`, `expiry`, `delivery`, `renewal`, + `payment`, `birth`, or `death`. + + Only Gregorian dates between the years 1000 and 9999 (inclusive) fitting into + one of the supported date types are extractable. + """ + + headings: List[ILGSv1Span] + """An array of spans within the document's text constituting headings.""" + + junk: List[ILGSv1Span] + """ + An array of spans within the document's text constituting non-operative, + non-substantive 'junk' content such as headers, footers, page numbers, and OCR + artifacts. + """ + + version: Literal["ilgs@1"] diff --git a/src/isaacus/types/ilgs_v1_email.py b/src/isaacus/types/ilgs_v1_email.py new file mode 100644 index 0000000..ccae60d --- /dev/null +++ b/src/isaacus/types/ilgs_v1_email.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1Email"] + + +class ILGSv1Email(BaseModel): + """An email address identified in a document belonging to a legal person. + + If an email address was mentioned in the document but is not attributable to a legal person, it will not be extracted. + """ + + address: str + """The normalized email address.""" + + person: str + """The unique identifier of the person that this email address belongs to.""" + + mentions: List[ILGSv1Span] + """ + An array of one or more spans within the document's text where the email address + is mentioned. + """ diff --git a/src/isaacus/types/ilgs_v1_external_document.py b/src/isaacus/types/ilgs_v1_external_document.py new file mode 100644 index 0000000..893624c --- /dev/null +++ b/src/isaacus/types/ilgs_v1_external_document.py @@ -0,0 +1,101 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1ExternalDocument"] + + +class ILGSv1ExternalDocument(BaseModel): + """A document identified within another document.""" + + id: str + """ + The unique identifier of the external document in the format `exd:{index}` where + `{index}` is a non-negative incrementing integer starting from zero. + """ + + name: ILGSv1Span + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + type: Literal["statute", "regulation", "decision", "contract", "other"] + """ + The type of the external document, being one of `statute`, `regulation`, + `decision`, `contract`, or `other`. + + `statute` denotes primary legislation such as acts, bills, codes, and + constitutions. + + `regulation` denotes secondary legislation such as rules, statutory instruments, + and ordinances. + + `decision` denotes judicial or quasi-judicial decisions such as court judgments, + judicial opinions, and tribunal rulings. + + `other` is used for all other types of legal documents that do not fit into any + of the predefined types. + """ + + jurisdiction: Optional[str] = None + """ + A jurisdiction code representing a country (via an initial country code) and, + optionally, a subdivision within that country (via a subsequent subdivision code + prefixed by a hyphen). + + All 249 ISO 3166-1 alpha-2 country codes are representable in addition to + special `INT` and `EU` codes for international and European Union law, + respectively. + + All 5,046 ISO 3166-2 codes are also representable in addition to a special `FED` + code for federal law. + """ + + reception: Literal["positive", "mixed", "negative", "neutral"] + """ + The sentiment of the document towards the external document, being one of + `positive`, `mixed`, `negative`, or `neutral`. + + `positive` indicates that the document expresses a favorable view of the + external document whether by endorsing or approving it. + + `mixed` indicates that the document expresses both favorable and unfavorable + views of the external document, for example, by affirming parts of it and + disapproving others. + + `negative` indicates that the document expresses an unfavorable view of the + external document whether by criticizing, repealing, overruling, or explicitly + contradicting it. + + `neutral` indicates that the document references the external document without + expressing any particular sentiment towards it. + """ + + mentions: List[ILGSv1Span] + """ + An array of one or more spans within the document's text where the external + document is mentioned by name, for example, 'the US Constitution' in 'the Second + Amendment to the US Constitution protects freedom of speech'. + """ + + pinpoints: List[ILGSv1Span] + """ + An array of spans within the document's text where specific parts of the + external document are referenced, for example, 'Section 2' in 'as defined in + Section 2 of the US Constitution'. + """ diff --git a/src/isaacus/types/ilgs_v1_id_number.py b/src/isaacus/types/ilgs_v1_id_number.py new file mode 100644 index 0000000..33fe661 --- /dev/null +++ b/src/isaacus/types/ilgs_v1_id_number.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1IDNumber"] + + +class ILGSv1IDNumber(BaseModel): + """An identification number mentioned in a document belonging to a legal person. + + If an identification number was mentioned in the document but is not attributable to a legal person, it will not be extracted. + """ + + number: str + """The identification number.""" + + person: str + """The unique identifier of the person that this identification number belongs to.""" + + mentions: List[ILGSv1Span] + """ + An array of one or more spans within the document's text where the + identification number is mentioned. + """ diff --git a/src/isaacus/types/ilgs_v1_location.py b/src/isaacus/types/ilgs_v1_location.py new file mode 100644 index 0000000..a441c4d --- /dev/null +++ b/src/isaacus/types/ilgs_v1_location.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1Location"] + + +class ILGSv1Location(BaseModel): + """A location identified within a document.""" + + id: str + """ + The unique identifier of the location in the format `loc:{index}` where + `{index}` is a non-negative incrementing integer starting from zero. + """ + + name: ILGSv1Span + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + type: Literal["country", "state", "city", "address", "other"] + """ + The type of the location, being one of `country`, `state`, `city`, `address`, or + `other`. + """ + + parent: Optional[str] = None + """ + A unique identifier for a location in the format `loc:{index}` where `{index}` + is a non-negative incrementing integer starting from zero. + """ + + mentions: List[ILGSv1Span] + """ + An array of one or more spans within the document's text where the location is + mentioned. + """ diff --git a/src/isaacus/types/ilgs_v1_person.py b/src/isaacus/types/ilgs_v1_person.py new file mode 100644 index 0000000..db1a9e7 --- /dev/null +++ b/src/isaacus/types/ilgs_v1_person.py @@ -0,0 +1,195 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1Person"] + + +class ILGSv1Person(BaseModel): + """A legal person identified in a document.""" + + id: str + """ + The unique identifier of the person in the format `per:{index}` where `{index}` + is a non-negative incrementing integer starting from zero. + """ + + name: ILGSv1Span + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + type: Literal["natural", "corporate", "politic"] + """ + The legal entity type of the person, being one of `natural`, `corporate`, or + `politic`. + + `natural` denotes a human being in their capacity as a natural legal person, + including when representing unincorporated entities such as partnerships and + trusts. + + `corporate` denotes a body corporate such as a company, incorporated + partnership, or statutory corporation. + + `politic` denotes a body politic such as a court, state, government, or + intergovernmental organization. + """ + + role: Literal[ + "plaintiff", + "petitioner", + "applicant", + "appellant", + "appellee", + "claimant", + "complainant", + "defendant", + "respondent", + "prior_authority", + "prosecutor", + "defense_counsel", + "amicus", + "intervener", + "borrower", + "lender", + "guarantor", + "lessee", + "lessor", + "employer", + "employee", + "licensor", + "licensee", + "franchisor", + "franchisee", + "buyer", + "seller", + "contractor", + "shareholder", + "joint_venturer", + "investor", + "insurer", + "insured", + "enacting_authority", + "empowered_authority", + "settlor", + "trustee", + "beneficiary", + "debater", + "director", + "governing_jurisdiction", + "clerk", + "witness", + "other", + "non_party", + ] + """The role of the person in relation to the subject of the document. + + The following roles are currently supported: | | | | ------------------------ | + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + | | `plaintiff` | A party initiating the case that is the subject of the + document. | | `petitioner` | A party initiating the petition that is the subject + of the document. | | `applicant` | A party initiating the application that is + the subject of the document. | | `appellant` | A party appealing the decision + that is the subject of the document. | | `appellee` | A party responding to the + appeal that is the subject of the document if they are explicitly referred to as + an 'appellee'. | | `claimant` | A party making a claim in the case that is the + subject of the document. | | `complainant` | A party making a complaint in the + case that is the subject of the document. | | `defendant` | A party defending + against the case that is the subject of the document. | | `respondent` | A party + responding to the petition, appeal, or application that is the subject of the + document. | | `prior_authority` | An authority (e.g., judge, tribunal, court) + that made a prior decision in the case that is the subject of the document. Both + individual judges and courts should be annotated with this role where + applicable. This is not to be used for authorities cited as precedent, only for + those that made prior decisions in the same case. | | `prosecutor` | A lawyer + prosecuting the case that is the subject of the document. | | `defense_counsel` + | A lawyer defending the case that is the subject of the document. | | `amicus` + | A party filing an amicus curiae brief in the case that is the subject of the + document. | | `intervener` | A party attempting to or that has intervened in the + case that is the subject of the document. | | `borrower` | A party borrowing + money or other assets under the agreement that is the subject of the document, + including 'mortgagors' and 'debtors'. | | `lender` | A party lending money or + other assets under the agreement that is the subject of the document, including + 'mortgagees' and 'creditors'. | | `guarantor` | A party guaranteeing obligations + under the agreement that is the subject of the document, including 'sureties'. | + | `lessee` | A party leasing goods or services under the agreement that is the + subject of the document, including 'tenants'. | | `lessor` | A party leasing + goods or services under the agreement that is the subject of the document, + including 'landlords'. | | `employer` | A party employing personnel under the + agreement that is the subject of the document. | | `employee` | A party employed + under the agreement that is the subject of the document. | | `licensor` | A + party licensing intellectual property or other rights under the agreement that + are the subject of the document. | | `licensee` | A party licensed to use + intellectual property or other rights under the agreement that are the subject + of the document. | | `franchisor` | A party granting a franchise under the + agreement that is the subject of the document. | | `franchisee` | A party + granted a franchise under the agreement that is the subject of the document. | | + `buyer` | A party purchasing goods or services under the agreement that is the + subject of the document, including 'purchasers', 'customers', and 'clients'. | | + `seller` | A party selling or providing goods or services under the agreement + that is the subject of the document, including 'Vendors', 'Suppliers', and + 'Service Providers' (where such parties are actually providing goods or services + under the agreement). | | `contractor` | A party contracted to perform work or + services under the agreement that is the subject of the document, including + 'consultants'. | | `shareholder` | A party holding shares or equity under the + agreement that is the subject of the document. | | `joint_venturer` | A party + participating in a joint venture under the agreement that is the subject of the + document. | | `investor` | A party investing money or assets under the agreement + that is the subject of the document. | | `insurer` | A party providing insurance + under the agreement that is the subject of the document. | | `insured` | A party + insured under the agreement that is the subject of the document. | | `settlor` | + A party establishing the trust that is the subject of the document. | | + `trustee` | A party managing the trust that is the subject of the document. | | + `beneficiary` | A party benefiting from the trust that is the subject of the + document. | | `enacting_authority` | An authority (e.g., legislature, regulator, + Minister/Secretary, President/Prime Minister, tribunal, court, judge) giving + legal effect to or authorizing the document. All relevant individuals and bodies + should be annotated with this role where applicable. | | `empowered_authority` | + An authority (e.g., government agency, regulator, Minister/Secretary, + President/Prime Minister, tribunal, court) empowered by the document to carry + out functions or duties. | | `debater` | A person participating in the debate + that is the subject of the document. | | `governing_jurisdiction` | The + jurisdiction whose laws govern the document. | | `director` | A director or + other officer of a corporate legal person mentioned in the document. | | `clerk` + | A clerk, notary, or other official certifying, witnessing, filing, recording, + registering, or otherwise administering the document. | | `witness` | A witness + witnessing the signing of the document, or whose testimony is part of the case + that is the subject of the document. | | `other` | A party to the case, + agreement, legislation, or regulation that is the subject of the document that + does not fit into any of the other roles. | | `non_party` | A legal person + mentioned in the document that is not a party to the case, agreement, + legislation, or regulation that is the subject of the document. | + """ + + parent: Optional[str] = None + """ + A unique identifier for a legal person in the format `per:{index}` where + `{index}` is a non-negative incrementing integer starting from zero. + """ + + residence: Optional[str] = None + """ + A unique identifier for a location in the format `loc:{index}` where `{index}` + is a non-negative incrementing integer starting from zero. + """ + + mentions: List[ILGSv1Span] + """ + An array of one or more spans within the document's text where the person is + mentioned. + """ diff --git a/src/isaacus/types/ilgs_v1_phone_number.py b/src/isaacus/types/ilgs_v1_phone_number.py new file mode 100644 index 0000000..6906278 --- /dev/null +++ b/src/isaacus/types/ilgs_v1_phone_number.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1PhoneNumber"] + + +class ILGSv1PhoneNumber(BaseModel): + """A valid phone number identified in a document belonging to a legal person. + + If a phone number was mentioned in the document but is not valid, possible, or attributable to a legal person, it will not be extracted. + """ + + number: str + """ + The normalized phone number in E.123 international notation conforming with + local conventions on the use of spaces and hyphens as separators. + """ + + person: str + """The unique identifier of the person that this phone number belongs to.""" + + mentions: List[ILGSv1Span] + """ + An array of one or more spans within the document's text where the phone number + is mentioned. + """ diff --git a/src/isaacus/types/ilgs_v1_quote.py b/src/isaacus/types/ilgs_v1_quote.py new file mode 100644 index 0000000..36a2288 --- /dev/null +++ b/src/isaacus/types/ilgs_v1_quote.py @@ -0,0 +1,52 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1Quote"] + + +class ILGSv1Quote(BaseModel): + """A quotation within a document.""" + + source_segment: Optional[str] = None + """ + A unique identifier for a segment in the format `seg:{index}` where `{index}` is + a non-negative incrementing integer starting from zero. + """ + + source_document: Optional[str] = None + """ + A unique identifier for an external document in the format `exd:{index}` where + `{index}` is a non-negative incrementing integer starting from zero. + """ + + source_person: Optional[str] = None + """ + A unique identifier for a legal person in the format `per:{index}` where + `{index}` is a non-negative incrementing integer starting from zero. + """ + + amending: bool + """ + Whether the quote is being used to amend or modify content, typically in other + documents. + """ + + span: ILGSv1Span + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ diff --git a/src/isaacus/types/ilgs_v1_segment.py b/src/isaacus/types/ilgs_v1_segment.py new file mode 100644 index 0000000..b3a61dd --- /dev/null +++ b/src/isaacus/types/ilgs_v1_segment.py @@ -0,0 +1,205 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1Segment"] + + +class ILGSv1Segment(BaseModel): + """ + A segment within the document representing a structurally distinct portion of the document's content. + """ + + id: str + """ + The unique identifier of the segment in the format `seg:{index}` where `{index}` + is a non-negative incrementing integer starting from zero. + """ + + kind: Literal["container", "unit", "item", "figure"] + """ + The structural 'kind' of the segment, being one of `container`, `unit`, `item`, + or `figure`. + + A `container` is a structural or semantic grouping of content such as a chapter. + It can contain segments of any kind or none at all. + + A `unit` is a single syntactically independent unit of text such as a paragraph. + It can only contain `item`s and `figure`s. + + An `item` is a syntactically subordinate unit of text such as an item in a + run-in list. It can only contain other `item`s. Note that an `item` is + conceptually distinct from a list item—it is perfectly possible to encounter + list items that are syntactically independent of their surrounding items just as + it is possible to encounter dependent clauses that do not appear as part of a + list. + + A `figure` is a visually structured or tabular unit of content such as a + diagram, equation, or table. It cannot contain segments. + """ + + type: Optional[ + Literal[ + "title", + "book", + "part", + "chapter", + "subchapter", + "division", + "subdivision", + "subpart", + "subtitle", + "table_of_contents", + "article", + "section", + "regulation", + "rule", + "clause", + "paragraph", + "subarticle", + "subsection", + "subregulation", + "subrule", + "subclause", + "subparagraph", + "item", + "subitem", + "point", + "indent", + "schedule", + "annex", + "appendix", + "exhibit", + "recital", + "signature", + "note", + "figure", + "table", + "formula", + ] + ] = None + """ + The addressable 'type' of the segment within the document's referential scheme + and hierarchy, whether defined explicitly (e.g., by headings, such as + 'Section 2. Definitions'), implicitly (e.g., by way of reference, such as 'as + defined in Section 2'), or by convention (e.g., [42] in a judgment often denotes + a `paragraph`, independent provisions in statute are often `section`s, etc.). If + the type is not known or not applicable, it will be set to `null`. + + Note that, although many segment types may coincide with syntactic constructs, + they should be thought of purely as distinct formal citable units. Most + paragraphs (in the syntactic sense) will not have the `paragraph` type, for + example. That type is reserved for segments that would formally be cited as a + 'Paragraph' within the document's referential scheme. + + The following types are currently supported: `title`, `book`, `part`, `chapter`, + `subchapter`, `division`, `subdivision`, `subpart`, `subtitle`, + `table_of_contents`, `article`, `section`, `regulation`, `rule`, `clause`, + `paragraph`, `subarticle`, `subsection`, `subregulation`, `subrule`, + `subclause`, `subparagraph`, `item`, `subitem`, `point`, `indent`, `schedule`, + `annex`, `appendix`, `exhibit`, `recital`, `signature`, `note`, `figure`, + `table`, and `formula`. + + The `title`, `book`, `part`, `chapter`, `subchapter`, `division`, `subdivision`, + `subpart`, `subtitle`, and `table_of_contents` types are exclusive to the + `container` kind. + + The `figure` kind only supports the `figure`, `table`, and `formula` types, all + of which are exclusive to it. + """ + + category: Literal["front_matter", "scope", "main", "annotation", "back_matter", "other"] + """ + The functional 'category' of the segment within the document, being one of + `front_matter`, `scope`, `main`, `annotation`, `back_matter`, or `other`. + + `front_matter` denotes non-operative contextualizing content occurring at the + start of a document such as a preamble or recitals. + + `scope` denotes operative content defining the application or interpretation of + a document such as definition sections and governing law clauses. + + `main` denotes operative, non-scopal content. + + `annotation` denotes non-operative annotative content providing explanatory or + referential information such as commentary, footnotes, and endnotes. + + `back_matter` denotes non-operative contextualizing content occurring at the end + of a document such as authority statements. + + `other` denotes content that does not fit into any of the other categories. + """ + + type_name: Optional[ILGSv1Span] = None + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + code: Optional[ILGSv1Span] = None + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + title: Optional[ILGSv1Span] = None + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + parent: Optional[str] = None + """ + A unique identifier for a segment in the format `seg:{index}` where `{index}` is + a non-negative incrementing integer starting from zero. + """ + + span: ILGSv1Span + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ diff --git a/src/isaacus/types/ilgs_v1_span.py b/src/isaacus/types/ilgs_v1_span.py new file mode 100644 index 0000000..45aad71 --- /dev/null +++ b/src/isaacus/types/ilgs_v1_span.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel + +__all__ = ["ILGSv1Span"] + + +class ILGSv1Span(BaseModel): + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible for any two spans to partially overlap; they can only be disjoint, adjacent, or wholly nested. Spans of the exact same type (e.g., segments) will never be duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses zero-based, half-open, Unicode code point-spaced string indexing), indices may need to be translated accordingly (for example, JavaScript slices into UTF-16 code units instead of Unicode code points). + """ + + start: int + """ + The zero-based start index of the half-open span of Unicode code points in the + input text. + """ + + end: int + """ + The zero-based end index of the half-open span (i.e., the end is exclusive) of + Unicode code points in the input text. + """ diff --git a/src/isaacus/types/ilgs_v1_term.py b/src/isaacus/types/ilgs_v1_term.py new file mode 100644 index 0000000..db03338 --- /dev/null +++ b/src/isaacus/types/ilgs_v1_term.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1Term"] + + +class ILGSv1Term(BaseModel): + """A term assigned a definite meaning within a document.""" + + id: str + """ + The unique identifier of the term in the format `term:{index}` where `{index}` + is a non-negative incrementing integer starting from zero. + """ + + name: ILGSv1Span + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + meaning: ILGSv1Span + """A zero-based, half-open span into the Unicode code point space of input text. + + All spans are globally laminar and well-nested similar to XML—it is impossible + for any two spans to partially overlap; they can only be disjoint, adjacent, or + wholly nested. Spans of the exact same type (e.g., segments) will never be + duplicated. + + A span cannot be empty and will never start or end at whitespace. + + Note that, when using programming languages other than Python (which uses + zero-based, half-open, Unicode code point-spaced string indexing), indices may + need to be translated accordingly (for example, JavaScript slices into UTF-16 + code units instead of Unicode code points). + """ + + mentions: List[ILGSv1Span] + """ + An array of spans within the document's text where the term is mentioned outside + of its definition. + + It is possible for the term to have no mentions if, outside of its definition, + it is never referred to in the document. + """ diff --git a/src/isaacus/types/ilgs_v1_website.py b/src/isaacus/types/ilgs_v1_website.py new file mode 100644 index 0000000..5c0ac9a --- /dev/null +++ b/src/isaacus/types/ilgs_v1_website.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .ilgs_v1_span import ILGSv1Span + +__all__ = ["ILGSv1Website"] + + +class ILGSv1Website(BaseModel): + """A website identified in a document belonging to a legal person. + + If a website was mentioned in the document but is not attributable to a legal person, it will not be extracted. + """ + + url: str + """The normalized URL of the website in the form `https://{host}/`.""" + + person: str + """The unique identifier of the person that this website belongs to.""" + + mentions: List[ILGSv1Span] + """ + An array of one or more spans within the document's text where the website is + mentioned (including paths and slugs which are not part of the website's + normalized URL). + """ diff --git a/src/isaacus/types/reranking_create_params.py b/src/isaacus/types/reranking_create_params.py index 416cab9..ab4a75a 100644 --- a/src/isaacus/types/reranking_create_params.py +++ b/src/isaacus/types/reranking_create_params.py @@ -34,8 +34,8 @@ class RerankingCreateParams(TypedDict, total=False): Each text must contain at least one non-whitespace character. """ - chunking_options: Optional[ChunkingOptions] - """Options for how to split text into smaller chunks.""" + top_n: Optional[int] + """A whole number greater than or equal to 1.""" is_iql: bool """ @@ -62,18 +62,18 @@ class RerankingCreateParams(TypedDict, total=False): `chunk_min` uses the lowest relevance score of all of a text's chunks. """ - top_n: Optional[int] - """A whole number greater than or equal to 1.""" + chunking_options: Optional[ChunkingOptions] + """Options for how to split text into smaller chunks.""" class ChunkingOptions(TypedDict, total=False): """Options for how to split text into smaller chunks.""" + size: Optional[int] + """A whole number greater than or equal to 1.""" + overlap_ratio: Optional[float] """A number greater than or equal to 0 and less than 1.""" overlap_tokens: Optional[int] """A whole number greater than or equal to 0.""" - - size: Optional[int] - """A whole number greater than or equal to 1.""" diff --git a/tests/api_resources/classifications/test_universal.py b/tests/api_resources/classifications/test_universal.py index 48de376..c85ac3a 100644 --- a/tests/api_resources/classifications/test_universal.py +++ b/tests/api_resources/classifications/test_universal.py @@ -34,13 +34,13 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None: model="kanon-universal-classifier", query="This is a confidentiality clause.", texts=["I agree not to tell anyone about the document."], + is_iql=True, + scoring_method="auto", chunking_options={ + "size": 512, "overlap_ratio": 0.1, "overlap_tokens": 10, - "size": 512, }, - is_iql=True, - scoring_method="auto", ) assert_matches_type(UniversalClassificationResponse, universal, path=["response"]) @@ -97,13 +97,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) - model="kanon-universal-classifier", query="This is a confidentiality clause.", texts=["I agree not to tell anyone about the document."], + is_iql=True, + scoring_method="auto", chunking_options={ + "size": 512, "overlap_ratio": 0.1, "overlap_tokens": 10, - "size": 512, }, - is_iql=True, - scoring_method="auto", ) assert_matches_type(UniversalClassificationResponse, universal, path=["response"]) diff --git a/tests/api_resources/extractions/test_qa.py b/tests/api_resources/extractions/test_qa.py index 181cfce..9aa7ecb 100644 --- a/tests/api_resources/extractions/test_qa.py +++ b/tests/api_resources/extractions/test_qa.py @@ -14,7 +14,7 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestQa: +class TestQA: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip(reason="Prism tests are disabled") @@ -38,13 +38,13 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None: texts=[ "The standard sentence for murder in the State of Victoria is 30 years if the person murdered was a police officer and 25 years in any other case." ], + ignore_inextractability=False, + top_k=1, chunking_options={ + "size": 512, "overlap_ratio": 0.1, "overlap_tokens": 10, - "size": 512, }, - ignore_inextractability=False, - top_k=1, ) assert_matches_type(AnswerExtractionResponse, qa, path=["response"]) @@ -83,7 +83,7 @@ def test_streaming_response_create(self, client: Isaacus) -> None: assert cast(Any, response.is_closed) is True -class TestAsyncQa: +class TestAsyncQA: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @@ -109,13 +109,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) - texts=[ "The standard sentence for murder in the State of Victoria is 30 years if the person murdered was a police officer and 25 years in any other case." ], + ignore_inextractability=False, + top_k=1, chunking_options={ + "size": 512, "overlap_ratio": 0.1, "overlap_tokens": 10, - "size": 512, }, - ignore_inextractability=False, - top_k=1, ) assert_matches_type(AnswerExtractionResponse, qa, path=["response"]) diff --git a/tests/api_resources/test_embeddings.py b/tests/api_resources/test_embeddings.py index abab3cc..af293c5 100644 --- a/tests/api_resources/test_embeddings.py +++ b/tests/api_resources/test_embeddings.py @@ -32,9 +32,9 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None: embedding = client.embeddings.create( model="kanon-2-embedder", texts=["Are restraints of trade enforceable under English law?", "What is a non-compete clause?"], - dimensions=1, - overflow_strategy="drop_end", task="retrieval/query", + overflow_strategy="drop_end", + dimensions=1, ) assert_matches_type(EmbeddingResponse, embedding, path=["response"]) @@ -87,9 +87,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) - embedding = await async_client.embeddings.create( model="kanon-2-embedder", texts=["Are restraints of trade enforceable under English law?", "What is a non-compete clause?"], - dimensions=1, - overflow_strategy="drop_end", task="retrieval/query", + overflow_strategy="drop_end", + dimensions=1, ) assert_matches_type(EmbeddingResponse, embedding, path=["response"]) diff --git a/tests/api_resources/test_rerankings.py b/tests/api_resources/test_rerankings.py index a9d965b..36707ac 100644 --- a/tests/api_resources/test_rerankings.py +++ b/tests/api_resources/test_rerankings.py @@ -46,14 +46,14 @@ def test_method_create_with_all_params(self, client: Isaacus) -> None: "Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.", "The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm.", ], + top_n=1, + is_iql=False, + scoring_method="auto", chunking_options={ + "size": 512, "overlap_ratio": 0.1, "overlap_tokens": 10, - "size": 512, }, - is_iql=False, - scoring_method="auto", - top_n=1, ) assert_matches_type(RerankingResponse, reranking, path=["response"]) @@ -134,14 +134,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncIsaacus) - "Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.", "The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm.", ], + top_n=1, + is_iql=False, + scoring_method="auto", chunking_options={ + "size": 512, "overlap_ratio": 0.1, "overlap_tokens": 10, - "size": 512, }, - is_iql=False, - scoring_method="auto", - top_n=1, ) assert_matches_type(RerankingResponse, reranking, path=["response"])