-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathv2_extraction_webhook.txt
More file actions
46 lines (36 loc) · 1.16 KB
/
Copy pathv2_extraction_webhook.txt
File metadata and controls
46 lines (36 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
use Mindee\V2\Client;
use Mindee\V2\Product\Extraction\Params\ExtractionParameters;
use Mindee\Input\PathInput;
$apiKey = "MY_API_KEY";
$filePath = "/path/to/the/file.ext";
$modelId = "MY_MODEL_ID";
// Init a new client
$mindeeClient = new Client($apiKey);
// Set inference parameters
// Note: modelId is mandatory.
$inferenceParams = new ExtractionParameters(
// ID of the model, required.
$modelId,
webhookIds: ["MY_WEBHOOK_ID"],
// Options: set to `true` or `false` to override defaults
// Enhance extraction accuracy with Retrieval-Augmented Generation.
rag: null,
// Extract the full text content from the document as strings.
rawText: null,
// Calculate bounding box polygons for all fields.
polygon: null,
// Boost the precision and accuracy of all extractions.
// Calculate confidence scores for all fields.
confidence: null
);
// Load a file from disk
$inputSource = new PathInput($filePath);
// Send for processing
$response = $mindeeClient->enqueue(
$inputSource,
$inferenceParams
);
// Print the job ID
echo $response->job->id;
// IMPORTANT: save a record of which job ID corresponds to which file.