### Install .NET Client Library Source: https://docs.mindee.com/crop-models/sdk-integration/crop-quick-start Install the Mindee .NET NuGet package using the .NET CLI. ```sh dotnet add package Mindee --version 4.0 ``` -------------------------------- ### Install Node.js Client Library Source: https://docs.mindee.com/crop-models/sdk-integration/crop-quick-start Install the Mindee Node.js client library using npm. ```sh npm install mindee@^5.1.1 ``` -------------------------------- ### Install PHP Client Library Source: https://docs.mindee.com/crop-models/sdk-integration/crop-quick-start Install the Mindee PHP client library using composer. ```sh php composer.phar require "mindee/mindee:>=2.7" ``` -------------------------------- ### PHP OCR Quick Start Source: https://docs.mindee.com/ocr-models/sdk-integration/ocr-quick-start Integrate OCR functionality using the Mindee PHP client library. Ensure you are using version 2.7.1 or greater. This example demonstrates initializing the client, setting OCR parameters including the mandatory model ID, loading a file, and processing it. ```php enqueueAndGetResult( OcrResponse::class, $inputSource, $ocrParams ); // Print a summary of the response echo strval($response->inference); // Access the ocr results $pages = $response->inference->result->pages; ``` -------------------------------- ### Install Ruby Client Library Source: https://docs.mindee.com/crop-models/sdk-integration/crop-quick-start Install the Mindee Ruby gem. ```shell gem install mindee -v '~> 5.1' ``` -------------------------------- ### Querying Documentation via HTTP GET Source: https://docs.mindee.com/crop-models/sdk-integration/crop-result Perform an HTTP GET request to a documentation URL with an 'ask' query parameter to get dynamic information. ```bash GET https://docs.mindee.com/crop-models/sdk-integration/crop-result.md?ask= ``` -------------------------------- ### Install Python Client Library Source: https://docs.mindee.com/crop-models/sdk-integration/crop-quick-start Install the Mindee Python client library using pip. Ensure you are using version 4.35.1 or greater. ```sh pip install -U mindee~=4.35 ``` -------------------------------- ### Install and Use Mindee CLI in .NET Source: https://docs.mindee.com/integrations/client-libraries-sdk/command-line-tools-cli Install the Mindee.Cli NuGet package separately. Use the `Mindee.Cli` command for general help or specific model help. Run extractions by providing your API key, model ID, and the file path. ```bash # General help Mindee.Cli --help # Help for extraction models Mindee.Cli extraction --help # Run extraction on a file # --api-key: API key, you can instead `export MINDEE_V2_API_KEY=md_XXXXXXXXXXXX` # --model-id: Your model ID # Positional arg: Absolute path to the file Mindee.Cli extraction \ --key md_XXXXXXXXXXXX \ --model-id abcd1234-aa11-bb22-cc33-abcdef1234567 \ /path/to/the/file.pdf ``` -------------------------------- ### Install and Use Mindee CLI in Python Source: https://docs.mindee.com/integrations/client-libraries-sdk/command-line-tools-cli Install the Python library using pip. Use the `mindeeV2` command for general help or specific model help. Run extractions by providing your API key, model ID, and the file path. ```bash # Install the library pip install mindee # General help mindeeV2 --help # Help for extraction models mindeeV2 extraction --help # Run extraction on a file # --key: API key, you can instead `export MINDEE_V2_API_API_KEY=md_XXXXXXXXXXXX` # --model: Your model ID # Positional arg: Absolute path to the file mindeeV2 extraction \ --key md_XXXXXXXXXXXX \ --model abcd1234-aa11-bb22-cc33-abcdef1234567 \ /path/to/the/file.pdf ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.mindee.com/use-cases/extraction-models Perform an HTTP GET request on the current page URL with the `ask` query parameter to get dynamic answers and relevant excerpts from the documentation. ```http GET https://docs.mindee.com/use-cases/extraction-models.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.mindee.com/integrations Perform an HTTP GET request to query the documentation dynamically. Include your question as the 'ask' query parameter. ```http GET https://docs.mindee.com/integrations.md?ask= ``` -------------------------------- ### Install and Use Mindee CLI in Node.js Source: https://docs.mindee.com/integrations/client-libraries-sdk/command-line-tools-cli Install the Node.js library using npm. Access the CLI via its path in `node_modules`. Use the `mindeeV2` command for general help or specific model help. Run extractions by providing your API key, model ID, and the file path. ```shellscript # Install the library npm install mindee # General help ./node_modules/.bin/mindeeV2 --help # Help for extraction models ./node_modules/.bin/mindeeV2 extraction --help # Run extraction on a file # --api-key: API key, you can instead `export MINDEE_V2_API_KEY=md_XXXXXXXXXXXX` # --model: Your model ID # Positional arg: Absolute path to the file ./node_modules/.bin/mindeeV2 extraction \ --api-key md_XXXXXXXXXXXX \ --model abcd1234-aa11-bb22-cc33-abcdef1234567 \ /path/to/the/file.pdf ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.mindee.com/crop-models/sdk-integration Perform an HTTP GET request to query the documentation dynamically. Include your question in the `ask` query parameter for a direct answer and relevant excerpts. ```http GET https://docs.mindee.com/crop-models/sdk-integration.md?ask= ``` -------------------------------- ### Querying Documentation via HTTP GET Source: https://docs.mindee.com/ocr-models/sdk-integration/ocr-result Perform an HTTP GET request to a documentation URL with an 'ask' query parameter to dynamically query the documentation. ```http GET https://docs.mindee.com/ocr-models/sdk-integration/ocr-result.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.mindee.com/classification-models/sdk-integration Perform an HTTP GET request to query the documentation dynamically. Include your question in the 'ask' query parameter for a direct answer and relevant excerpts. ```http GET https://docs.mindee.com/classification-models/sdk-integration.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.mindee.com/integrations/api-reference Perform an HTTP GET request on the current page URL with the `ask` query parameter to get dynamic information from the documentation. The question should be specific and self-contained. ```http GET https://docs.mindee.com/integrations/api-reference.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.mindee.com/integrations/api-reference/classification-models Perform an HTTP GET request to the current page URL with the 'ask' query parameter to dynamically query the documentation. The question should be specific and self-contained. ```http GET https://docs.mindee.com/integrations/api-reference/classification-models.md?ask= ``` -------------------------------- ### Query Documentation with GET Request Source: https://docs.mindee.com/extraction-models/data-schema-best-practices Perform an HTTP GET request on the current page URL with the `ask` query parameter to dynamically query the documentation. The question should be specific, self-contained, and written in natural language. ```http GET https://docs.mindee.com/extraction-models/data-schema-best-practices.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.mindee.com/getting-started Perform an HTTP GET request to query the documentation. Use the `ask` query parameter with a specific, self-contained question in natural language to get direct answers and relevant excerpts. ```http GET https://docs.mindee.com/getting-started.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.mindee.com/split-models Perform an HTTP GET request to query documentation dynamically. Use the 'ask' query parameter with a specific, self-contained question in natural language. The response includes a direct answer and relevant excerpts. ```http GET https://docs.mindee.com/split-models.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.mindee.com/split-models/sdk-integration/split-result Perform an HTTP GET request to query the documentation dynamically. Include the 'ask' query parameter with your question in natural language. Use this for information not explicitly present, clarifications, or related documentation. ```http GET https://docs.mindee.com/split-models/sdk-integration/split-result.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.mindee.com/crop-models Perform an HTTP GET request to query the documentation dynamically. Use the 'ask' query parameter with a specific, self-contained question in natural language. ```http GET https://docs.mindee.com/crop-models.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.mindee.com/models/model-settings Perform an HTTP GET request on the current page URL with the `ask` query parameter to get answers to specific questions. The question should be specific, self-contained, and written in natural language. Use this when the answer is not explicitly present, you need clarification, or want to retrieve related documentation. ```http GET https://docs.mindee.com/models/model-settings.md?ask= ``` -------------------------------- ### Accessing Object Fields in Node.js Source: https://docs.mindee.com/extraction-models/sdk-integration/extraction-result This Node.js example demonstrates how to retrieve object fields and their simple sub-fields. It covers accessing a specific sub-field and iterating through all available simple sub-fields, including how to get their string values. ```JavaScript handleResponse(response) { const fields = response.inference.result.fields; const objectField = fields.getObjectField("my_object_field"); const simpleSubFields = objectField.simpleFields; // grab a single sub-field const subfield1 = subFields.get("subfield_1"); // loop over simple sub-fields subFields.forEach((simpleSubFields, fieldName) => { // Choose the appropriate accessor: // stringValue, numberValue, booleanValue const fieldValue = subField.stringValue; }); // Object fields can also have lists: const listSubFields = objectField.listFields; ``` -------------------------------- ### Classify Document (PHP) Source: https://docs.mindee.com/classification-models/sdk-integration/classification-quick-start Utilize the Mindee PHP client library to classify a document. Requires version 2.7.1 or greater, an API key, file path, and model ID. This example uses polling to get the result. ```php enqueueAndGetInference( $inputSource, $inferenceParams ); // Print a summary of the response echo strval($response->inference); // Access the result fields $fields = $response->inference->result->fields; ``` -------------------------------- ### Java OCR Quick Start Source: https://docs.mindee.com/ocr-models/sdk-integration/ocr-quick-start Use this snippet to process a file with OCR using the Mindee Java client library. Ensure you have version 4.43.0 or greater installed. Replace placeholder values for API key, file path, and model ID. ```java import com.mindee.MindeeClientV2; import com.mindee.input.LocalInputSource; import com.mindee.v2.product.ocr.OcrResponse; import com.mindee.v2.product.ocr.OcrResult; import com.mindee.v2.product.ocr.params.OcrParameters; import java.io.IOException; public class SimpleMindeeClientV2 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "MY_API_KEY"; String filePath = "/path/to/the/file.ext"; String modelId = "MY_MODEL_ID"; // Init a new client MindeeClientV2 mindeeClient = new MindeeClientV2(apiKey); // Set inference parameters OcrParameters ocrParams = OcrParameters // ID of the model, required. .builder(modelId) .build(); // Load a file from disk LocalInputSource inputSource = new LocalInputSource(filePath); // Send for processing using polling OcrResponse response = mindeeClient.enqueueAndGetResult( OcrResponse.class, inputSource, ocrParams ); // Print a summary of the response System.out.println(response.getInference().toString()); // Access the result OCR pages OcrResult result = response.getInference().getResult(); } } ``` -------------------------------- ### Initialize and Process Document with Ruby SDK Source: https://docs.mindee.com/extraction-models/sdk-integration/quick-start This Ruby snippet shows how to initialize the Mindee Ruby client, set inference parameters, load a file from disk, and send it for processing. Requires version 5.1.0 or greater. ```ruby require 'mindee' require 'mindee/v2/product' input_path = '/path/to/the/file.ext' api_key = 'MY_API_KEY' model_id = 'MY_MODEL_ID' # Init a new client mindee_client = Mindee::V2::Client.new(api_key: api_key) # Set inference parameters extraction_params = { # ID of the model, required. model_id: model_id, # Options: set to `true` or `false` to override defaults # Enhance extraction accuracy with Retrieval-Augmented Generation. rag: nil, # Extract the full text content from the document as strings. raw_text: nil, # Calculate bounding box polygons for all fields. polygon: nil, # Boost the precision and accuracy of all extractions. # Calculate confidence scores for all fields. confidence: nil } # Load a file from disk input_source = Mindee::Input::Source::PathInputSource.new(input_path) # Send for processing response = mindee_client.enqueue_and_get_result( Mindee::V2::Product::Extraction::Extraction, input_source, extraction_params ) # Print a brief summary of the parsed data puts response.inference # Access the result fields fields = response.inference.result.fields # fields.get_simple_field('my_simple_field') # fields.get_list_field('my_list_field') ``` -------------------------------- ### Initialize and Process Document with PHP SDK Source: https://docs.mindee.com/extraction-models/sdk-integration/quick-start This PHP snippet demonstrates how to initialize the Mindee PHP client, configure inference parameters, load a file, and send it for processing. Requires version 2.7.1 or greater. ```php enqueueAndGetResult( $inputSource, $inferenceParams ); // Print a summary of the response echo strval($response->inference); // Access the result fields $fields = $response->inference->result->fields; ``` -------------------------------- ### Get Source File Metadata (.NET) Source: https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file Access filename, check if it's a PDF, and get the page count from a loaded source file. ```csharp string filename = inputSource.Filename; bool isPdf = inputSource.IsPdf(); int numberOfPages = inputSource.GetPageCount(); ``` -------------------------------- ### Initialize and Process Document with Node.js SDK Source: https://docs.mindee.com/extraction-models/sdk-integration/quick-start Use this snippet to initialize the Mindee Node.js client, set product parameters, load a file, and send it for processing. Ensure you have version 5.1.0 or greater. ```javascript import * as mindee from "mindee"; // If you're on CommonJS: // const mindee = require("mindee"); const apiKey = "MY_API_KEY"; const filePath = "/path/to/the/file.ext"; const modelId = "MY_MODEL_ID"; // Init a new client const mindeeClient = new mindee.Client( { apiKey: apiKey } ); // Set product parameters const productParams = { modelId: modelId, // Options: set to `true` or `false` to override defaults // Enhance extraction accuracy with Retrieval-Augmented Generation. rag: undefined, // Extract the full text content from the document as strings. rawText: undefined, // Calculate bounding box polygons for all fields. polygon: undefined, // Boost the precision and accuracy of all extractions. // Calculate confidence scores for all fields. confidence: undefined, }; // Load a file from disk const inputSource = new mindee.PathInput({ inputPath: filePath }); // Send for processing const response = await mindeeClient.enqueueAndGetResult( mindee.product.Extraction, inputSource, productParams, ); // print a string summary console.log(response.inference.toString()); // Access the result fields const fields = response.inference.result.fields; ``` -------------------------------- ### Get Source File Metadata (Java) Source: https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file Access filename, check if it's a PDF, and get the page count from a loaded source file. ```Java String filename = inputSource.getFilename(); boolean isPdf = inputSource.isPdf(); int numberOfPages = inputSource.getPageCount(); ``` -------------------------------- ### Get Source File Metadata (Ruby) Source: https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file Access filename, check if it's a PDF, and get the page count from a loaded source file. ```Ruby filename = input_source.filename is_pdf = input_source.pdf? number_of_pages = input_source.page_count ``` -------------------------------- ### Load File Instance (Java) Source: https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file Initialize LocalInputSource with a File instance. ```java var file = new File("/path/to/the/file.ext"); var inputSource = new LocalInputSource(file); ``` -------------------------------- ### Load Path Instance (Java) Source: https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file Initialize LocalInputSource with a Path instance. ```java var filePath = new Path("/path/to/the/file.ext"); var inputSource = new LocalInputSource(filePath); ``` -------------------------------- ### Get Source File Metadata (PHP) Source: https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file Access filename, check if it's a PDF, and get the page count from a loaded source file. ```PHP $filename = $inputSource->fileName; $isPdf = $inputSource->isPdf(); $numberOfPages = $inputSource->getPageCount(); ``` -------------------------------- ### Initialize Python Client with API Key Source: https://docs.mindee.com/integrations/client-libraries-sdk/configure-the-client Initialize the Mindee client by passing the API key directly. This is suitable for quick testing. Ensure you have imported the necessary classes. ```python from mindee import ( ClientV2, InferenceParameters, InferenceResponse, PathInput, # for loading files from disk ) ``` ```python api_key = "MY_API_KEY" mindee_client = ClientV2(api_key) ``` -------------------------------- ### Get Source File Metadata (Python) Source: https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file Access filename, check if it's a PDF, and get the page count from a loaded source file. ```Python filename: str = input_source.filename is_pdf: bool = input_source.is_pdf number_of_pages: int = input_source.page_count ``` -------------------------------- ### Initialize .NET Client using Environment Variable Source: https://docs.mindee.com/integrations/client-libraries-sdk/configure-the-client Initialize the Mindee client for .NET without passing the API key directly, by relying on the `MindeeV2__ApiKey` environment variable. This is recommended for production. -------------------------------- ### Load FileInfo Instance (C#) Source: https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file Initialize LocalInputSource with a FileInfo instance. ```csharp FileInfo fileinfo = new FileInfo("/path/to/the/file.ext"); var inputSource = new LocalInputSource(fileinfo) ``` -------------------------------- ### Query Documentation API Source: https://docs.mindee.com/classification-models/sdk-integration/classification-result Perform an HTTP GET request to the documentation URL with an 'ask' query parameter to get dynamic answers and relevant excerpts. ```http GET https://docs.mindee.com/classification-models/sdk-integration/classification-result.md?ask= ``` -------------------------------- ### Initialize Python Client using Environment Variable Source: https://docs.mindee.com/integrations/client-libraries-sdk/configure-the-client Initialize the Mindee client without passing the API key directly, by relying on the `MINDEE_V2_API_KEY` environment variable. This is the recommended approach for production. ```python mindee_client = ClientV2() ``` -------------------------------- ### Install Node.js Client Library in Supabase Edge Functions Source: https://docs.mindee.com/integrations/client-libraries-sdk Install the Mindee Node.js client library in your Supabase edge functions using npm. ```bash npm install @mindee/mindee-api-nodejs ``` -------------------------------- ### Initialize PHP Client with API Key Source: https://docs.mindee.com/integrations/client-libraries-sdk/configure-the-client Initialize the Mindee client for PHP by passing the API key directly. This is useful for quick testing. Ensure you have imported the necessary classes. ```php use Mindee\ClientV2; use Mindee\Input\InferenceParameters; use Mindee\Error\MindeeException; ``` ```php $apiKey = "MY_API_KEY"; $mindeeClient = new ClientV2($apiKey); ``` -------------------------------- ### Enqueue and Get Inference (Java) Source: https://docs.mindee.com/integrations/client-libraries-sdk/send-a-file-or-url Use the `enqueueAndGetInference` method with the Mindee client to send an input source and get the inference results. The inference can be printed to standard output. ```java InferenceResponse response = mindeeClient.enqueueAndGetInference( inputSource, inferenceParams ); // To easily test which data were extracted, // simply print an RST representation of the inference System.out.println(response.getInference().toString()); ``` -------------------------------- ### Querying Documentation Dynamically Source: https://docs.mindee.com/crop-models/crop To get information not explicitly on the page, make a GET request to the current URL with the 'ask' query parameter. The question should be specific and in natural language. ```http GET https://docs.mindee.com/crop-models/crop.md?ask= ``` -------------------------------- ### Initialize .NET Client with API Key Source: https://docs.mindee.com/integrations/client-libraries-sdk/configure-the-client Initialize the Mindee client for .NET by passing the API key directly. This is useful for quick testing. Ensure you have added the required namespaces. ```csharp using Mindee; using Mindee.Input; ``` ```csharp string apiKey = "MY_API_KEY"; MindeeClientV2 mindeeClient = new MindeeClientV2(apiKey); ``` -------------------------------- ### Get Source File Metadata (Node.js) Source: https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file Initialize the source, then access filename, check if it's a PDF, and get the page count. Ensure the source is initialized before accessing properties. ```JavaScript // make sure to initialze the source first await inputSource.init(); const filename = inputSource.filename; const isPdf = inputSource.isPdf(); const numberOfPages = await inputSource.getPageCount(); ``` -------------------------------- ### Initialize PHP Client using Environment Variable Source: https://docs.mindee.com/integrations/client-libraries-sdk/configure-the-client Initialize the Mindee client for PHP without passing the API key directly, by relying on the `MINDEE_V2_API_KEY` environment variable. This is recommended for production. ```php $mindeeClient = new ClientV2($apiKey); ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.mindee.com/integrations/client-libraries-sdk/basic-model-configuration To get additional information not directly on the page, make an HTTP GET request to the page URL with the `ask` query parameter. The question should be specific and self-contained. ```HTTP GET https://docs.mindee.com/integrations/client-libraries-sdk/basic-model-configuration.md?ask= ``` -------------------------------- ### Initialize Ruby Client using Environment Variable Source: https://docs.mindee.com/integrations/client-libraries-sdk/configure-the-client Initialize the Mindee client for Ruby without passing the API key directly, by relying on the `MINDEE_V2_API_KEY` environment variable. This is recommended for production. ```ruby mindee_client = Mindee::ClientV2.new() ``` -------------------------------- ### Initialize Ruby Client with API Key Source: https://docs.mindee.com/integrations/client-libraries-sdk/configure-the-client Initialize the Mindee client for Ruby by passing the API key directly. This is useful for quick testing. Ensure you have required the Mindee package. ```ruby require 'mindee' ``` ```ruby api_key = 'MY_API_KEY' mindee_client = Mindee::ClientV2.new(api_key: api_key) ```