V2 Utilities
Client V2
- class Client(api_key=None, http_client=None)
Mindee API Client.
- Parameters:
api_key (str | None)
http_client (Client | None)
- close()
Closes the underlying HTTP client.
- Return type:
None
- delete_extraction_rag_document(document_id)
Delete a document from the RAG database. For extraction models only.
- Return type:
bool- Parameters:
document_id (str)
- enqueue(input_source, params)
Enqueues a document to a given model.
- Parameters:
input_source (
LocalInputSource|URLInputSource) – The document/source file to use. Can be local or remote.params (
BaseProductParameters) – Parameters to set when sending a file.
- Return type:
- Returns:
A valid inference response.
- enqueue_and_get_result(response_type, input_source, params, cancellation_token=None)
Enqueues to an asynchronous endpoint and automatically polls for a response.
- Parameters:
input_source (
LocalInputSource|URLInputSource) – The document/source file to use. Can be local or remote.params (
BaseProductParameters) – Parameters to set when sending a file.response_type (
type[TypeVar(TypeBaseInferenceResponse, bound=BaseInferenceResponse)]) – The product class to use for the response object.cancellation_token (
CancellationToken|None, default:None) – A cancellation token that can be used to cancel the
- Return type:
TypeBaseInferenceResponse
request.
- Return type:
TypeVar(TypeBaseInferenceResponse, bound=BaseInferenceResponse)- Returns:
A valid inference response.
- Parameters:
response_type (type[TypeBaseInferenceResponse])
input_source (LocalInputSource | URLInputSource)
params (BaseProductParameters)
cancellation_token (CancellationToken | None)
- get_job(job_id)
Get the status of an inference that was previously enqueued.
Can be used for polling.
- Parameters:
job_id (
str) – UUID of the job to retrieve.- Return type:
- Returns:
A job response.
- get_rag_document(response_type, document_id)
Not recommended for general use, prefer
get_ready_rag_document. You will need to poll until the document is ready for use. Get a document’s info and annotations from the RAG database.- Return type:
TypeVar(TypeRagAnnotationResponse, bound=BaseRagAnnotationResponse)- Parameters:
response_type (type[TypeRagAnnotationResponse])
document_id (str)
- get_ready_rag_document(response_type, document_id, polling_options=None, cancellation_token=None)
Get a document’s info and annotations from the RAG database.
- Parameters:
response_type (type[TypeRagAnnotationResponse])
document_id (str)
polling_options (PollingOptions | None)
cancellation_token (CancellationToken | None)
- get_result(response_type, inference_id)
Get the result of an inference that was previously enqueued by its ID.
The inference will only be available after it has finished processing.
- Parameters:
inference_id (
str) – UUID of the inference to retrieve.response_type (
type[TypeVar(TypeBaseInferenceResponse, bound=BaseInferenceResponse)]) – Class of the product to instantiate.
- Return type:
TypeVar(TypeBaseInferenceResponse, bound=BaseInferenceResponse)- Returns:
An inference response.
- get_result_from_url(response_type, url)
Get the result of an inference that was previously enqueued by its URL.
- Parameters:
response_type (
type[TypeVar(TypeBaseInferenceResponse, bound=BaseInferenceResponse)]) – Type of the response to return.url (
str) – URL of the inference to retrieve.
- Return type:
TypeVar(TypeBaseInferenceResponse, bound=BaseInferenceResponse)- Returns:
The result of the inference.
- search(params)
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])
- search_models(name=None, model_type=None)
Deprecated: use search instead.
- Return type:
- Parameters:
name (str | None)
model_type (str | None)
- update_and_get_rag_annotations(parameters, polling_options=None, cancellation_token=None)
Update a document’s annotations in the RAG database.
- Return type:
TypeVar(TypeRagAnnotationResponse, bound=BaseRagAnnotationResponse)- Parameters:
parameters (BaseAnnotationParameters[TypeRagAnnotationResponse])
polling_options (PollingOptions | None)
cancellation_token (CancellationToken | None)
- update_rag_annotations(parameters)
Not recommended for general use, prefer
update_and_get_rag_annotations. You will need to poll until the document is ready for use. Update a document’s annotations in the RAG database.- Return type:
TypeVar(TypeRagAnnotationResponse, bound=BaseRagAnnotationResponse)- Parameters:
parameters (BaseAnnotationParameters[TypeRagAnnotationResponse])
- upload_and_get_rag_document(input_source, parameters, polling_options=None, cancellation_token=None)
Add a document to the RAG database and return the initial annotation.
- Return type:
TypeVar(TypeRagAnnotationResponse, bound=BaseRagAnnotationResponse)- Parameters:
input_source (LocalInputSource)
parameters (BaseRagDocumentUploadParameters[TypeRagAnnotationResponse])
polling_options (PollingOptions | None)
cancellation_token (CancellationToken | None)
- upload_rag_document(input_source, parameters)
Not recommended for general use, prefer
upload_and_get_rag_document. You will need to poll until the document is ready for use. Add a document to the RAG database.- Return type:
TypeVar(TypeRagAnnotationResponse, bound=BaseRagAnnotationResponse)- Parameters:
input_source (LocalInputSource)
parameters (BaseRagDocumentUploadParameters[TypeRagAnnotationResponse])