Skip to content

Commit 2af9ddd

Browse files
💥 ♻️ rename inference product to extraction and move internals
1 parent be54796 commit 2af9ddd

136 files changed

Lines changed: 622 additions & 619 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,6 @@ dmypy.json
137137
*.swp
138138
*-swp
139139
_test.py
140+
_test*.py
140141
_test.json
141142
local_test

docs/extras/code_samples/v2_classification.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
from mindee import (
2-
ClientV2,
3-
PathInput,
4-
ClassificationParameters,
5-
ClassificationResponse,
1+
from mindee import PathInput
2+
from mindee.v2 import (
3+
Client,
4+
ClassificationParameters,
5+
ClassificationResponse,
66
)
77

88
input_path = "/path/to/the/file.ext"
99
api_key = "MY_API_KEY"
1010
model_id = "MY_MODEL_ID"
1111

1212
# Init a new client
13-
mindee_client = ClientV2(api_key)
13+
mindee_client = Client(api_key)
1414

1515
# Set parameters
1616
params = ClassificationParameters(

docs/extras/code_samples/v2_crop.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
from mindee import (
2-
ClientV2,
3-
PathInput,
4-
CropParameters,
5-
CropResponse,
1+
from mindee import PathInput
2+
from mindee.v2 import (
3+
Client,
4+
CropParameters,
5+
CropResponse,
66
)
77

88
input_path = "/path/to/the/file.ext"
99
api_key = "MY_API_KEY"
1010
model_id = "MY_MODEL_ID"
1111

1212
# Init a new client
13-
mindee_client = ClientV2(api_key)
13+
mindee_client = Client(api_key)
1414

1515
# Set parameters
1616
params = CropParameters(

docs/extras/code_samples/v2_extraction.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
from mindee import (
2-
ClientV2,
3-
InferenceParameters,
4-
InferenceResponse,
5-
PathInput,
1+
from mindee import PathInput
2+
from mindee.v2 import (
3+
Client,
4+
ExtractionParameters,
5+
ExtractionResponse,
66
)
77

88
input_path = "/path/to/the/file.ext"
99
api_key = "MY_API_KEY"
1010
model_id = "MY_MODEL_ID"
1111

1212
# Init a new client
13-
mindee_client = ClientV2(api_key)
13+
mindee_client = Client(api_key)
1414

15-
# Set inference parameters
16-
params = InferenceParameters(
15+
# Set extraction parameters
16+
params = ExtractionParameters(
1717
# ID of the model, required.
1818
model_id=model_id,
1919

@@ -35,7 +35,7 @@ input_source = PathInput(input_path)
3535

3636
# Send for processing
3737
response = mindee_client.enqueue_and_get_result(
38-
InferenceResponse,
38+
ExtractionResponse,
3939
input_source,
4040
params,
4141
)

docs/extras/code_samples/v2_ocr.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
from mindee import (
2-
ClientV2,
3-
PathInput,
4-
OCRParameters,
5-
OCRResponse,
1+
from mindee import PathInput
2+
from mindee.v2 import (
3+
Client,
4+
OCRParameters,
5+
OCRResponse,
66
)
77

88
input_path = "/path/to/the/file.ext"
99
api_key = "MY_API_KEY"
1010
model_id = "MY_MODEL_ID"
1111

1212
# Init a new client
13-
mindee_client = ClientV2(api_key)
13+
mindee_client = Client(api_key)
1414

1515
# Set parameters
1616
params = OCRParameters(

docs/extras/code_samples/v2_split.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
from mindee import (
2-
ClientV2,
3-
PathInput,
4-
SplitParameters,
5-
SplitResponse,
1+
from mindee import PathInput
2+
from mindee.v2 import (
3+
Client,
4+
SplitParameters,
5+
SplitResponse,
66
)
77

88
input_path = "/path/to/the/file.ext"
99
api_key = "MY_API_KEY"
1010
model_id = "MY_MODEL_ID"
1111

1212
# Init a new client
13-
mindee_client = ClientV2(api_key)
13+
mindee_client = Client(api_key)
1414

1515
# Set parameters
1616
params = SplitParameters(

mindee/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
from mindee.v1 import product
22
from mindee.input import LocalResponse, PageOptions, PollingOptions
3-
from mindee.v2.product.extraction.params.inference_parameters import InferenceParameters
3+
from mindee.v2.parsing.inference.job_response import JobResponse
4+
from mindee.v2.product.extraction.params.extraction_parameters import (
5+
ExtractionParameters,
6+
)
47
from mindee.input.sources import (
58
Base64Input,
69
BytesInput,
710
FileInput,
811
PathInput,
912
UrlInputSource,
1013
)
11-
from mindee.v2.parsing import InferenceResponse, JobResponse
12-
from mindee.v2.product.classification.param.classification_parameters import (
14+
from mindee.v2.product.classification.params.classification_parameters import (
1315
ClassificationParameters,
1416
)
1517
from mindee.v2.product.classification.classification_response import (
1618
ClassificationResponse,
1719
)
1820
from mindee.v2.product.crop.params.crop_parameters import CropParameters
1921
from mindee.v2.product.crop.crop_response import CropResponse
22+
from mindee.v2.product.extraction.extraction_response import ExtractionResponse
23+
from mindee.v2.product.extraction.extraction_result import ExtractionResult
2024
from mindee.v2.product.ocr.params.ocr_parameters import OCRParameters
2125
from mindee.v2.product.ocr.ocr_response import OCRResponse
2226
from mindee.v2.product.split.params.split_parameters import SplitParameters
@@ -30,8 +34,9 @@
3034
"CropParameters",
3135
"CropResponse",
3236
"FileInput",
33-
"InferenceParameters",
34-
"InferenceResponse",
37+
"ExtractionParameters",
38+
"ExtractionResponse",
39+
"ExtractionResult",
3540
"JobResponse",
3641
"LocalResponse",
3742
"OCRParameters",

mindee/client_mixin.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def source_from_path(
1919
"""
2020
Load a document from a path, as a string or a `Path` object.
2121
22-
:param input_path: Path of file to open
23-
:param fix_pdf: Whether to attempt fixing PDF files before sending.
22+
:params input_path: Path of file to open
23+
:params fix_pdf: Whether to attempt fixing PDF files before sending.
2424
Setting this to `True` can modify the data sent to Mindee.
2525
"""
2626
input_doc = PathInput(input_path)
@@ -33,8 +33,8 @@ def source_from_file(input_file: BinaryIO, fix_pdf: bool = False) -> FileInput:
3333
"""
3434
Load a document from a normal Python file object/handle.
3535
36-
:param input_file: Input file handle
37-
:param fix_pdf: Whether to attempt fixing PDF files before sending.
36+
:params input_file: Input file handle
37+
:params fix_pdf: Whether to attempt fixing PDF files before sending.
3838
Setting this to `True` can modify the data sent to Mindee.
3939
"""
4040
input_doc = FileInput(input_file)
@@ -49,9 +49,9 @@ def source_from_b64string(
4949
"""
5050
Load a document from a base64 encoded string.
5151
52-
:param input_string: Input to parse as base64 string
53-
:param filename: The name of the file (without the path)
54-
:param fix_pdf: Whether to attempt fixing PDF files before sending.
52+
:params input_string: Input to parse as base64 string
53+
:params filename: The name of the file (without the path)
54+
:params fix_pdf: Whether to attempt fixing PDF files before sending.
5555
Setting this to `True` can modify the data sent to Mindee.
5656
"""
5757
input_doc = Base64Input(input_string, filename)
@@ -66,9 +66,9 @@ def source_from_bytes(
6666
"""
6767
Load a document from raw bytes.
6868
69-
:param input_bytes: Raw byte input
70-
:param filename: The name of the file (without the path)
71-
:param fix_pdf: Whether to attempt fixing PDF files before sending.
69+
:params input_bytes: Raw byte input
70+
:params filename: The name of the file (without the path)
71+
:params fix_pdf: Whether to attempt fixing PDF files before sending.
7272
Setting this to `True` can modify the data sent to Mindee.
7373
"""
7474
input_doc = BytesInput(input_bytes, filename)
@@ -101,7 +101,7 @@ def source_from_url(
101101
"""
102102
Load a document from a URL.
103103
104-
:param url: Raw byte input
104+
:params url: Raw byte input
105105
"""
106106
return UrlInputSource(
107107
url,

mindee/error/mindee_http_error.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def __init__(self, http_error: StringDict, url: str, code: int) -> None:
1616
"""
1717
Base exception for HTTP calls.
1818
19-
:param http_error: formatted & parsed error
20-
:param url: url/endpoint the exception was raised on
21-
:param code: HTTP code for the error
19+
:params http_error: formatted & parsed error
20+
:params url: url/endpoint the exception was raised on
21+
:params code: HTTP code for the error
2222
"""
2323
self.status_code = code
2424
self.api_code = http_error["code"] if "code" in http_error else None
@@ -33,7 +33,7 @@ def create_error_obj(response: Union[StringDict, str]) -> StringDict:
3333
"""
3434
Creates an error object based on a requests' payload.
3535
36-
:param response: response as sent by the server, as a dict.
36+
:params response: response as sent by the server, as a dict.
3737
In _very_ rare instances, this can be an html string.
3838
"""
3939
if not isinstance(response, str):
@@ -92,8 +92,8 @@ def handle_error(url: str, response: StringDict) -> MindeeHTTPError:
9292
"""
9393
Creates an appropriate HTTP error exception, based on retrieved HTTP error code.
9494
95-
:param url: url of the product
96-
:param response: StringDict
95+
:params url: url of the product
96+
:params response: StringDict
9797
"""
9898
error_obj = create_error_obj(response)
9999
if not isinstance(response, str) and ( # type: ignore

mindee/error/v2/mindee_http_error_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, response: ErrorResponse) -> None:
1212
"""
1313
Base exception for HTTP calls.
1414
15-
:param response:
15+
:params response:
1616
"""
1717
self.status = response.status
1818
self.title = response.title

0 commit comments

Comments
 (0)