From cbb7e7a24bd1e9aba7a7bb63f0bbb21fbfb49038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Thu, 10 Jul 2025 18:50:28 +0200 Subject: [PATCH] :recycle: minor fixes and tweaks to options and outputs --- mindee/client_mixin.py | 4 ++-- mindee/client_v2.py | 8 +++++++- mindee/input/inference_predict_options.py | 9 ++------- mindee/mindee_http/mindee_api_v2.py | 2 -- mindee/parsing/v2/inference.py | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/mindee/client_mixin.py b/mindee/client_mixin.py index 18be1867..833f77ee 100644 --- a/mindee/client_mixin.py +++ b/mindee/client_mixin.py @@ -6,14 +6,14 @@ class ClientMixin: - """Mixin for client Client V1 & V2 common static methods.""" + """Mixin for clients V1 & V2 common static methods.""" @staticmethod def source_from_path( input_path: Union[Path, str], fix_pdf: bool = False ) -> PathInput: """ - Load a document from an absolute path, as a string. + Load a document from a path, as a string or a `Path` object. :param input_path: Path of file to open :param fix_pdf: Whether to attempt fixing PDF files before sending. diff --git a/mindee/client_v2.py b/mindee/client_v2.py index c30706bb..ed7cc4ef 100644 --- a/mindee/client_v2.py +++ b/mindee/client_v2.py @@ -121,7 +121,13 @@ def enqueue_and_parse( if not isinstance(poll_results, JobResponse): break if poll_results.job.status == "Failed": - raise MindeeError(f"Parsing failed for job {poll_results.job.id}") + if poll_results.job.error: + detail = poll_results.job.error.detail + else: + detail = "No error detail available." + raise MindeeError( + f"Parsing failed for job {poll_results.job.id}: {detail}" + ) logger.debug( "Polling server for parsing result with job id: %s", queue_result.job.id, diff --git a/mindee/input/inference_predict_options.py b/mindee/input/inference_predict_options.py index 6d224168..dcc54710 100644 --- a/mindee/input/inference_predict_options.py +++ b/mindee/input/inference_predict_options.py @@ -10,14 +10,9 @@ class InferencePredictOptions: """Inference prediction options.""" model_id: str - """ID of the model.""" - full_text: bool = False - """ - Whether to include the full text data for async APIs. - This performs a full OCR operation on the server and will increase response time and payload size. - """ + """ID of the model, required.""" rag: bool = False - """If set, will enable Retrieval-Augmented Generation.""" + """If set to `True`, will enable Retrieval-Augmented Generation.""" alias: Optional[str] = None """Optional alias for the file.""" webhook_ids: Optional[List[str]] = None diff --git a/mindee/mindee_http/mindee_api_v2.py b/mindee/mindee_http/mindee_api_v2.py index deb17cba..48b87419 100644 --- a/mindee/mindee_http/mindee_api_v2.py +++ b/mindee/mindee_http/mindee_api_v2.py @@ -80,8 +80,6 @@ def predict_async_req_post( data = {"model_id": options.model_id} url = f"{self.url_root}/inferences/enqueue" - if options.full_text: - data["full_text_ocr"] = "true" if options.rag: data["rag"] = "true" if options.webhook_ids and len(options.webhook_ids) > 0: diff --git a/mindee/parsing/v2/inference.py b/mindee/parsing/v2/inference.py index becfcaf0..61e63c49 100644 --- a/mindee/parsing/v2/inference.py +++ b/mindee/parsing/v2/inference.py @@ -29,7 +29,7 @@ def __str__(self) -> str: f"Inference\n" f"#########\n" f":Model: {self.model.id}\n" - f":File: {self.file}\n" + f":File:\n" f" :Name: {self.file.name}\n" f" :Alias: {self.file.alias}\n\n" f"Result\n"