Quick Start
Quickest way to get started using the client libraries.
Installation Instructions
Requires Python ≥ 3.9. Python ≥ 3.10 is highly recommended.
Simply install the PyPi package using pip:
pip install mindee>=4.32Requires Node.js ≥ 20. Node.js ≥ 22 is recommended.
Simply install the NPM package:
npm install [email protected]Requires PHP ≥ 8.1. PHP ≥ 8.3 is recommended.
Simply install the Packagist package using composer:
php composer.phar require "mindee/mindee:>=2.3"Requires Ruby ≥ 3.0. Simply install the gem using:
gem install mindee -v '~> 4.10'Requires Java ≥ 11. Java ≥ 17 is recommended.
Group ID: com.mindee.sdk
Artifact ID: mindee-api-java
Version:
There are various installation methods, Maven, Gradle, etc:
Requires .NET ≥ 6.0. .NET ≥ 8.0 is recommended.
Simply install the NuGet package using .NET CLI:
dotnet add package Mindee --version 3.37Don't see support for your favorite language or framework? Make a feature request!
Send a File and Poll
Make a note of your model's ID for use in the API.
When getting started, we recommend using the polling method which will be quickest (unless you happen to already have access to a public-facing Web server).
Here are basic code examples, these are self-contained and can be run as-is:
Requires Python ≥ 3.9. Python ≥ 3.10 is highly recommended. Requires the Mindee Python client library version 4.32.1 or greater.
Also take a look at the Processing Results documentation.
Requires Node.js ≥ 20. Node.js ≥ 22 is recommended. Requires the Mindee Node.js client library version 4.36.2 or greater.
Also take a look at the Processing Results documentation.
Requires PHP ≥ 8.1 Requires the Mindee PHP client library version 2.3.0 or greater.
Also take a look at the Processing Results documentation.
Requires Ruby ≥ 3.0. Requires the Mindee Ruby client library version 4.10.0 or greater.
Also take a look at the Processing Results documentation.
Requires Java ≥ 8. Java ≥ 11 recommended. Requires the Mindee Java client library version 4.38.0 or greater.
Also take a look at the Processing Results documentation.
Requires .NET ≥ 6. Requires the Mindee .NET client library version 3.37.0 or greater.
Also take a look at the Processing Results documentation.
Details on Sending
For details on available options and advanced usage, check the following sections:
Processing the Results
Once you've sent the file and retrieved the results, you can start extracting the JSON payload.
The model's fields will be in the fields object in the returned JSON, in the response variable returned from the above step.
Each key in the fields object corresponds to the field's name in your model configuration.
You'll want to adapt your processing depending on the type of field, for example when looping over lists or accessing sub-fields.
Accessing simple values, using the name of the field in the Data Schema.
You can (should!) specify the type of value, the possible types are str , bool , float .
Note that all types may be None.
from mindee import InferenceResponse
def handle_response(response: InferenceResponse):
fields: dict = response.inference.result.fields
# texts, dates, classifications ...
string_field_value: str | None = fields["string_field"].value
# a JSON float will be a float
float_field_value: float | None = fields["float_field"].value
# even if the API always returns an integer, the type will be float
int_field_value: float | None = fields["int_field"].value
# booleans
bool_field_value: bool | None = fields["bool_field"].valueAccessing a list of simple values, where my_list_field is the name of the field in the Model.
from mindee import InferenceResponse
def handle_response(response: InferenceResponse):
fields: dict = response.inference.result.fields
simple_list_field = fields["my_simple_list_field"]
# Loop over the list of Simple fields
for list_item in simple_list_field.items:
item_value = list_item.valueAccessing an object field and its sub-fields, where my_object_field is the name of the field in the Model. In this hypothetical case, the object has a sub-field named subfield_1 .
from mindee import InferenceResponse
def handle_response(response: InferenceResponse):
fields: dict = response.inference.result.fields
object_field = fields["my_object_field"]
sub_fields: dict = object_field.fields
# grab a single sub-field
subfield_1 = sub_fields["subfield_1"]
# loop over sub-fields
for field_name, sub_field in sub_fields.items():
sub_field.valueAccessing a list of objects, where my_object_list_field is the name of the field in the Model.
from mindee import InferenceResponse
def handle_response(response: InferenceResponse):
fields: dict = response.inference.result.fields
object_list_field = fields["my_object_list_field"]
# Loop over the list of Object fields
for object_item in object_list_field.items:
# grab a single sub-field
sub_field_value = object_item.fields["sub_field"].value
# loop over sub-fields
for field_name, sub_field in object_item.fields.items():
sub_field.valueAccessing simple values, using the name of the field in the Data Schema.
Access fields as SimpleField instances when retrieving their value.
handleResponse(response) {
const fields = response.inference.result.fields;
// texts, dates, classifications ...
const stringFieldValue = fields.getSimpleField("string_field").stringValue;
// no distinction between floats and integers
const floatFieldValue = fields.getSimpleField("float_field").numberValue;
const intFieldValue = fields.getSimpleField("int_field").numberValue;
// booleans
const boolFieldValue = fields.getSimpleField("bool_field").booleanValue;
}Accessing a list of values, where my_simple_list_field is the name of the field in the Model.
We need to specify that the field is a ListField in order to access its items.
handleResponse(response) {
const fields = response.inference.result.fields;
const simpleListField = fields.getListField("my_simple_list_field");
const simpleItems = simpleListField.simpleItems;
// Loop over the list of Simple fields
for (const itemField of simpleItems) {
// Choose the appropriate accessor:
// stringValue, doubleValue, booleanValue
const fieldValue = itemField.stringValue;
}
}Accessing an object field and its sub-fields, where my_object_field is the name of the field in the Model. In this hypothetical case, the object has a sub-field named subfield_1 .
handleResponse(response) {
const fields = response.inference.result.fields;
const objectField = fields.getObjectField("my_object_field");
const subFields = objectField.simpleFields;
// grab a single sub-field
const subfield1 = subFields.get("subfield_1");
// loop over sub-fields
subFields.forEach((subField, fieldName) => {
// Choose the appropriate accessor:
// stringValue, doubleValue, booleanValue
const fieldValue = subField.stringValue;
});
}Accessing a list of objects, where my_object_list_field is the name of the field in the Model.
We need to specify that the field is a ListField in order to access its items.
Accessing simple values, using the name of the field in the Data Schema.
Access fields as SimpleField instances when retrieving their value.
Accessing a list of values, where my_simple_list_field is the name of the field in the Model.
We need to specify that the field is a ListField in order to access its items.
Accessing an object field and its sub-fields, where my_object_field is the name of the field in the Model. In this hypothetical case, the object has a sub-field named subfield_1 .
Accessing a list of objects, where my_object_list_field is the name of the field in the Model.
We need to specify that the field is a ListField in order to access its items.
Accessing simple values, using the name of the field in the Data Schema.
Access fields as SimpleField instances when retrieving their value.
Accessing a list of values, where my_simple_list_field is the name of the field in the Model.
Access the list as a ListField instance, and the items as SimpleField instances.
Accessing an object field and its sub-fields, where my_object_field is the name of the field in the Model. In this hypothetical case, the object has a sub-field named subfield_1 .
Accessing a list of objects, where my_object_list_field is the name of the field in the Model.
Access the list as a ListField instance, and the items as ObjectField instances.
Accessing simple values, using the name of the field in the Data Schema.
Access fields as SimpleField instances when retrieving their value.
We also need to specify the type of value, the possible types are String , Boolean , Double .
Note that all types may be null.
Accessing a list of simple values, where my_simple_list_field is the name of the field in the Model.
We need to specify that the field is a ListField in order to access its SimpleItems.
For each item in the list, we also need to specify the correct field and value type, as described above.
Accessing an object field and its sub-fields, where my_object_field is the name of the field in the Model. In this hypothetical case, the object has a sub-field named subfield_1 .
Accessing a list of objects, where my_object_list_field is the name of the field in the Model.
Depending on your requirements, this can be simplified using various custom methods.
Accessing simple values, using the name of the field in the Data Schema.
Access fields as SimpleField instances when retrieving their value.
We also need to specify the type of value, the possible types are string , Boolean , Double .
Note that all types may be null.
Accessing a list of simple values, where my_list_field is the name of the field in the Model.
We need to specify that the field is a ListField in order to access its SimpleItems.
Accessing an object field and its sub-fields, where my_object_field is the name of the field in the Model. In this hypothetical case, the object has a sub-field named subfield_1 .
Accessing a list of objects, where my_object_list_field is the name of the field in the Model.
Details on Processing
For details on available options and advanced usage, check the following sections:
Last updated
Was this helpful?

