V2 Mindee HTTP

Mindee API V2

class MindeeAPIV2(api_key, http_client=None)

Settings class relating to API V2 requests.

Parameters:
  • api_key (str | None)

  • http_client (Client | None)

close()

Closes the underlying HTTP client.

Return type:

None

delete_http_client()

Delete the underlying HTTP client.

req_delete_extraction_rag_document(document_id)

Deletes a document from the RAG database. For extraction models only.

Return type:

bool

Parameters:

document_id (str)

req_get_job_by_id(job_id)

Get the result of an inference that was previously enqueued.

Parameters:

job_id (str) – Job ID, returned by the enqueue request.

Return type:

JobResponse

req_get_product_result_by_id(response_class, inference_id)

Sends a request matching a given queue_id. Returns either a Job or a Document.

Parameters:
  • inference_id (str) – Inference ID, returned by the job request.

  • response_class (type[TypeVar(TypeBaseInferenceResponse, bound= BaseInferenceResponse)]) – Type of the response to return.

Return type:

TypeVar(TypeBaseInferenceResponse, bound= BaseInferenceResponse)

req_get_product_result_by_url(response_class, url)

Get the result of an inference that was previously enqueued.

Parameters:
  • url (str) – URL to use for the request.

  • response_class (type[TypeVar(TypeBaseInferenceResponse, bound= BaseInferenceResponse)]) – Type of the response to return.

Return type:

TypeVar(TypeBaseInferenceResponse, bound= BaseInferenceResponse)

Returns:

Response object from the request.

req_get_rag_annotation(response_class, document_id)

Get a document’s info and annotations from the RAG database.

Return type:

TypeVar(TypeRagAnnotationResponse, bound= BaseRagAnnotationResponse)

Parameters:
  • response_class (type[TypeRagAnnotationResponse])

  • document_id (str)

req_get_search_models(name, model_type)

Deprecated: use req_search instead.

Return type:

SearchResponse

Parameters:
  • name (str | None)

  • model_type (str | None)

req_patch_rag_annotation(params)

Update a document’s annotations in the RAG database.

Return type:

TypeVar(TypeRagAnnotationResponse, bound= BaseRagAnnotationResponse)

Parameters:

params (BaseAnnotationParameters[TypeRagAnnotationResponse])

req_post_product_enqueue(input_source, params)

Send a file to the asynchronous processing queue for inference processing.

Parameters:
Return type:

JobResponse

Returns:

A JobResponse containing the enqueued job.

req_post_rag_document(input_source, params)

Add a document to the RAG database.

Return type:

TypeVar(TypeRagAnnotationResponse, bound= BaseRagAnnotationResponse)

Parameters:
  • input_source (LocalInputSource)

  • params (BaseRagDocumentUploadParameters[TypeRagAnnotationResponse])

Search for resources matching the given criteria. :type params: BaseSearchParameters[TypeVar(TypeSearchResponse, bound= BaseSearchResponse)] :param params: Search parameters

Return type:

TypeVar(TypeSearchResponse, bound= BaseSearchResponse)

Returns:

A search response containing the matching resources

Parameters:

params (BaseSearchParameters[TypeSearchResponse])

set_base_url(value)

Set the base URL for all requests.

Return type:

None

Parameters:

value (str)

set_timeout(value)

Set the timeout for all requests.

Return type:

None

Parameters:

value (str | int)

api_key: str | None

API Key for the client.

property base_headers: dict[str, str]

Base headers to send with all API requests.

base_url: str

Base URL for all V2 requests.

property delete_caller: Callable

Caller for DELETE requests.

property get_caller: Callable

Caller for GET requests.

property patch_caller: Callable

Caller for PATCH requests.

property post_caller: Callable

Caller for POST requests.

request_timeout: float

Timeout for all requests.

url_root: str

Root of the URL to use for polling.