|
| 1 | +# Mindee Python SDK |
| 2 | + |
| 3 | +Use this skill for Mindee V2 integrations with the official Python SDK. |
| 4 | + |
| 5 | +## Scope |
| 6 | + |
| 7 | +- Use the official `mindee` Python SDK. |
| 8 | +- Focus on SDK-based integration patterns only. |
| 9 | +- Do not suggest direct HTTP calls, cURL, or non-SDK integrations. |
| 10 | +- Do not use undocumented SDK internals. |
| 11 | + |
| 12 | +## Primary documentation |
| 13 | + |
| 14 | +### SDK overview |
| 15 | +- https://docs.mindee.com/integrations/client-libraries-sdk.md |
| 16 | + |
| 17 | +### Client setup |
| 18 | +- https://docs.mindee.com/integrations/client-libraries-sdk/configure-the-client.md |
| 19 | + |
| 20 | +### Model parameters |
| 21 | +- https://docs.mindee.com/integrations/client-libraries-sdk/basic-model-configuration.md |
| 22 | + |
| 23 | +### Load local files |
| 24 | +- https://docs.mindee.com/integrations/client-libraries-sdk/load-and-adjust-a-file.md |
| 25 | + |
| 26 | +### Load remote URLs |
| 27 | +- https://docs.mindee.com/integrations/client-libraries-sdk/load-an-url.md |
| 28 | + |
| 29 | +### Send files and URLs |
| 30 | +- https://docs.mindee.com/integrations/client-libraries-sdk/send-a-file-or-url.md |
| 31 | + |
| 32 | +### Process responses |
| 33 | +- https://docs.mindee.com/integrations/client-libraries-sdk/process-the-response.md |
| 34 | + |
| 35 | +### Handle errors |
| 36 | +- https://docs.mindee.com/integrations/problem-database.md |
| 37 | + |
| 38 | +## Handling responses by model type |
| 39 | + |
| 40 | +### Extraction |
| 41 | +- Use: https://docs.mindee.com/extraction-models/sdk-integration/extraction-result.md |
| 42 | +- Use this page for accessing dynamic fields from `response.inference.result.fields`. |
| 43 | +- Use this page for examples of `SimpleField`, `ObjectField`, `ListField`, confidence, and locations. |
| 44 | + |
| 45 | +### Split |
| 46 | +- Use: https://docs.mindee.com/split-models/sdk-integration/split-result.md |
| 47 | +- Use this page for iterating over `response.inference.result.splits`. |
| 48 | +- Use this page for `document_type`, `page_range`, and optional chained extraction results. |
| 49 | + |
| 50 | +### Crop |
| 51 | +- Use: https://docs.mindee.com/crop-models/sdk-integration/crop-result.md |
| 52 | +- Use this page for iterating over `response.inference.result.crops`. |
| 53 | +- Use this page for `object_type`, crop location, polygon data, and optional chained extraction results. |
| 54 | + |
| 55 | +### Classification |
| 56 | +- Use: https://docs.mindee.com/classification-models/sdk-integration/classification-result.md |
| 57 | +- Use this page for accessing `response.inference.result.classification`. |
| 58 | +- Use this page for `document_type` and optional chained extraction results. |
| 59 | + |
| 60 | +### OCR |
| 61 | +- Use: https://docs.mindee.com/raw-text-ocr-models/sdk-integration/ocr-result.md |
| 62 | +- Use this page for iterating over `response.inference.result.pages`. |
| 63 | +- Use this page for page text, words, and word polygon data. |
| 64 | + |
| 65 | +## Default workflow |
| 66 | + |
| 67 | +When answering questions, follow this order: |
| 68 | + |
| 69 | +1. Initialize the SDK client. |
| 70 | +2. Configure `model_id` and other inference parameters. |
| 71 | +3. Load the input source. |
| 72 | +4. Optionally adjust the file before upload. |
| 73 | +5. Send with polling or webhooks. |
| 74 | +6. Process the response. |
| 75 | +7. Handle errors and retries. |
| 76 | + |
| 77 | +## Answering rules |
| 78 | + |
| 79 | +- Base answers on the documentation above. |
| 80 | +- Prefer documented SDK methods and patterns. |
| 81 | +- Use environment variables for API keys in production. |
| 82 | +- Reuse a client instance when possible. |
| 83 | +- Prefer polling for simple examples. |
| 84 | +- Prefer webhooks for production or high-volume workflows. |
| 85 | +- If a feature is not documented, say it is not officially supported. |
| 86 | +- If a user asks for code, keep examples minimal and working. |
| 87 | + |
| 88 | +## Code sample rules |
| 89 | + |
| 90 | +- Use Python examples only. |
| 91 | +- Use the official `mindee` package. |
| 92 | +- Show imports explicitly. |
| 93 | +- Include the exact documented class and method names. |
| 94 | +- Use placeholders like `MY_API_KEY`, `MY_MODEL_ID`, and `/path/to/file.pdf`. |
| 95 | +- Keep samples focused on one task. |
| 96 | + |
| 97 | +## Preferred example topics |
| 98 | + |
| 99 | +### Client initialization |
| 100 | +Use: |
| 101 | +- `Client(api_key="MY_API_KEY")` from `mindee.v2` |
| 102 | +- `Client()` with `MINDEE_V2_API_KEY` environment variable |
| 103 | +- Context manager: `with Client() as client:` |
| 104 | + |
| 105 | +### Input loading |
| 106 | +Use: |
| 107 | +- `PathInput` — load from a file path |
| 108 | +- `BytesInput` — load from raw bytes (requires `filename`) |
| 109 | +- `Base64Input` — load from a base64 string (requires `filename`) |
| 110 | +- `FileInput` — load from a binary file object (`BinaryIO`) |
| 111 | +- `URLInputSource` — load from a remote HTTPS URL |
| 112 | + |
| 113 | +### Sending documents |
| 114 | +Use: |
| 115 | +- `client.enqueue_and_get_result(ResponseClass, input_source, params)` for polling |
| 116 | +- `client.enqueue(input_source, params)` for webhooks |
| 117 | + |
| 118 | +### Response handling |
| 119 | +Use: |
| 120 | +- `response.inference` — access the inference result |
| 121 | +- `LocalResponse(payload).deserialize_response(ResponseClass)` for webhook payloads |
| 122 | +- `response.is_valid_hmac_signature(secret_key, signature)` for HMAC validation |
| 123 | + |
| 124 | +### File preparation |
| 125 | +Use: |
| 126 | +- `input_source.apply_page_options(page_options)` — trim or remove pages |
| 127 | +- `input_source.compress(quality=85)` — compress before upload |
| 128 | +- `input_source.fix_pdf()` — repair broken PDFs |
| 129 | +- `input_source.has_source_text()` — check for embedded text |
| 130 | +- `PageOptions(page_indexes=[...], operation="KEEP_ONLY", on_min_pages=0)` |
| 131 | + |
| 132 | +## Avoid |
| 133 | + |
| 134 | +- Direct REST examples |
| 135 | +- cURL examples |
| 136 | +- Manual authentication header construction |
| 137 | +- Bearer token examples for API keys |
| 138 | +- Non-Python examples |
| 139 | +- V1 examples unless the user explicitly asks for V1 |
| 140 | + |
| 141 | +## If the user is unclear |
| 142 | + |
| 143 | +Ask for only what is needed: |
| 144 | + |
| 145 | +- input type: local file or URL |
| 146 | +- delivery pattern: polling or webhook |
| 147 | +- model ID |
| 148 | +- runtime context: web server, worker, or script |
| 149 | + |
| 150 | +## Output style |
| 151 | + |
| 152 | +- Be concise. |
| 153 | +- Answer with runnable examples when code is requested. |
| 154 | +- Link to the most relevant doc section. |
| 155 | +- Do not overwhelm the user with every option. |
| 156 | +- Start with the documented default path. |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +# Agent Instructions: Querying The Documentation |
| 161 | + |
| 162 | +If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. |
| 163 | + |
| 164 | +Perform an HTTP GET request on the documentation URL with the `ask` query parameter. |
| 165 | +Include `python+sdk+-+` at the beginning of the question to get answers specific to this library: |
| 166 | + |
| 167 | +``` |
| 168 | +GET https://docs.mindee.com/integrations.md?ask=python+sdk+-+<question> |
| 169 | +``` |
| 170 | + |
| 171 | +The question should be specific, self-contained, and written in natural language. |
| 172 | +The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. |
| 173 | + |
| 174 | +Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. |
0 commit comments