-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathInferenceParameters.php
More file actions
115 lines (102 loc) · 3.47 KB
/
InferenceParameters.php
File metadata and controls
115 lines (102 loc) · 3.47 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
namespace Mindee\Input;
/**
* Parameters accepted by the asynchronous **inference** v2 endpoint.
*/
class InferenceParameters
{
/**
* @var string Model ID.
*/
public string $modelId;
/**
* @var boolean|null Enhance extraction accuracy with Retrieval-Augmented Generation..
*/
public ?bool $rag;
/**
* @var boolean|null Extract the full text content from the document as strings.
*/
public ?bool $rawText;
/**
* @var boolean|null Calculate bounding box polygons for all fields.
*/
public ?bool $polygon;
/**
* @var boolean|null Boost the precision and accuracy of all extractions.
* Calculate confidence scores for all fields.
*/
public ?bool $confidence;
/**
* @var string|null Optional file alias.
*/
public ?string $alias;
/**
* @var array<string> Optional webhook IDs.
*/
public array $webhooksIds;
/**
* @var string|null Additional text context used by the model during inference.
* Not recommended, for specific use only.
*/
public ?string $textContext;
/**
* @var DataSchema|null Data schema for inference.
*/
public ?DataSchema $dataSchema;
/**
* @var PollingOptions Polling options.
*/
public PollingOptions $pollingOptions;
/**
* @param string $modelId ID of the model.
* @param boolean|null $rag Whether to enable Retrieval-Augmented Generation.
* @param boolean|null $rawText Whether to extract the full text content from the
* document as strings.
* @param boolean|null $polygon Whether to calculate bounding box polygons for all
* fields.
* @param boolean|null $confidence Whether to calculate confidence scores for all fields.
* @param string|null $alias Optional file alias.
* @param array<string>|null $webhooksIds List of webhook IDs.
* @param string|null $textContext Additional text context used by the model during
* inference.
* @param DataSchema|string|array|null $dataSchema Additional text context used by the model during
* inference.
* @param PollingOptions|null $pollingOptions Polling options.
*/
public function __construct(
string $modelId,
?bool $rag = null,
?bool $rawText = null,
?bool $polygon = null,
?bool $confidence = null,
?string $alias = null,
?array $webhooksIds = null,
?string $textContext = null,
DataSchema|string|array|null $dataSchema = null,
?PollingOptions $pollingOptions = null,
) {
$this->modelId = $modelId;
if (!$pollingOptions) {
$pollingOptions = new PollingOptions();
}
$this->pollingOptions = $pollingOptions;
$this->rag = $rag;
$this->rawText = $rawText;
$this->polygon = $polygon;
$this->confidence = $confidence;
if (isset($alias)) {
$this->alias = $alias;
}
if (isset($textContext)) {
$this->textContext = $textContext;
}
if (isset($webhooksIds)) {
$this->webhooksIds = $webhooksIds;
} else {
$this->webhooksIds = [];
}
if (isset($dataSchema)) {
$this->dataSchema = new DataSchema($dataSchema);
}
}
}