Inference V2

Base Inference

class BaseInference(raw_response)

Base class for V2 inference objects.

Parameters:

raw_response (dict[str, Any])

file: InferenceFile

File info for the inference.

id: str

ID of the inference.

job: InferenceJob

Job the inference belongs to.

model: InferenceModel

Model info for the inference.

Base Response

Inference Active Options

class InferenceActiveOptions(raw_response)

Active options for the inference.

Parameters:

raw_response (dict[str, Any])

confidence: bool

Boost the precision and accuracy of all extractions. Calculate confidence scores for all fields, and fill their confidence attribute.

data_schema: DataSchemaActiveOptions

Data schema options provided for the inference.

polygon: bool

Calculate bounding box polygons for all fields, and fill their locations attribute.

rag: bool

Enhance extraction accuracy with Retrieval-Augmented Generation.

raw_text: bool

Extract the full text content from the document as strings, and fill the raw_text attribute.

text_context: bool

Whether the text context feature was activated. When this feature is activated, the provided context is used to improve the accuracy of the inference.

Inference File

class InferenceFile(raw_response)

Inference File info.

Parameters:

raw_response (dict[str, Any])

alias: str

Alias of the file.

mime_type: str

Mime type of the file.

name: str

Name of the file.

page_count: str

Number of pages in the file.

Inference Model

class InferenceModel(raw_response)

Inference model info.

Parameters:

raw_response (dict[str, Any])

id: str

ID of the model.

RAG Metadata

class RAGMetadata(raw_response)

Metadata about the RAG operation.

Parameters:

raw_response (dict[str, Any])

retrieved_document_id: str | None

The UUID of the matched document used during the RAG operation.

Raw Text

class RawText(raw_response)

Raw text extracted from the document.

Parameters:

raw_response (dict[str, Any])

pages: list[RawTextPage]

Pages of raw text content.

Raw Text Page

class RawTextPage(raw_response)

Raw text extracted from the page.

Parameters:

raw_response (dict[str, Any])

content: str

Content of the raw text.