Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mindee/client_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion mindee/client_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 2 additions & 7 deletions mindee/input/inference_predict_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions mindee/mindee_http/mindee_api_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion mindee/parsing/v2/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down