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
- 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_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)