Skip to content

Commit 01c9ff2

Browse files
committed
fixes from PR
1 parent 9ec16c6 commit 01c9ff2

3 files changed

Lines changed: 28 additions & 17 deletions

File tree

docs/code_samples/default_v2.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,19 @@ $mindeeClient = new ClientV2($apiKey);
1414
// Set inference parameters
1515
// Note: modelId is mandatory.
1616
$inferenceParams = new InferenceParameters(
17+
// ID of the model, required.
1718
$modelId,
18-
// If set to `true`, will enable Retrieval-Augmented Generation.
19+
20+
// Options: set to `true` or `false` to override defaults
21+
22+
// Enhance extraction accuracy with Retrieval-Augmented Generation.
23+
false,
24+
// Extract the full text content from the document as strings.
25+
false,
26+
// Calculate bounding box polygons for all fields.
27+
false,
28+
// Boost the precision and accuracy of all extractions.
29+
// Calculate confidence scores for all fields.
1930
false
2031
);
2132

src/Http/MindeeApiV2.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,17 +311,17 @@ private function documentEnqueuePost(
311311
$postFields['file'] = $inputSource->fileObject;
312312
}
313313

314-
if ($params->rawText != null) {
315-
$postFields['raw_text'] = strtolower($params->rawText);
314+
if (isset($params->rawText)) {
315+
$postFields['raw_text'] = strtolower("$params->rawText");
316316
}
317-
if ($params->polygon != null) {
318-
$postFields['polygon'] = strtolower($params->polygon);
317+
if (isset($params->polygon)) {
318+
$postFields['polygon'] = strtolower("$params->polygon");
319319
}
320-
if ($params->confidence != null) {
321-
$postFields['confidence'] = strtolower($params->confidence);
320+
if (isset($params->confidence)) {
321+
$postFields['confidence'] = strtolower("$params->confidence");
322322
}
323-
if ($params->rag != null) {
324-
$postFields['rag'] = strtolower($params->rag);
323+
if (isset($params->rag)) {
324+
$postFields['rag'] = strtolower("$params->rag");
325325
}
326326

327327
$url = $this->baseUrl . '/inferences/enqueue';

tests/ClientV2TestFunctional.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ protected function setUp(): void
2424
public function testParseFileEmptyMultiPageMustSucceed(): void
2525
{
2626
$source = new PathInput(__DIR__ . '/resources/file_types/pdf/multipage_cut-2.pdf');
27-
$options = new InferenceParameters($this->modelId, false, true);
27+
$inferenceParams = new InferenceParameters($this->modelId, false, true);
2828

29-
$response = $this->mindeeClient->enqueueAndGetInference($source, $options);
29+
$response = $this->mindeeClient->enqueueAndGetInference($source, $inferenceParams);
3030
$this->assertNotNull($response);
3131
$inference = $response->inference;
3232
$this->assertNotNull($inference);
@@ -60,9 +60,9 @@ public function testParseFileFilledSinglePageMustSucceed(): void
6060
{
6161
$source = new PathInput(__DIR__ . '/resources/products/financial_document/default_sample.jpg');
6262

63-
$options = new InferenceParameters($this->modelId, false);
63+
$inferenceParams = new InferenceParameters($this->modelId, false);
6464

65-
$response = $this->mindeeClient->enqueueAndGetInference($source, $options);
65+
$response = $this->mindeeClient->enqueueAndGetInference($source, $inferenceParams);
6666
$this->assertNotNull($response);
6767
$inference = $response->inference;
6868
$this->assertNotNull($inference);
@@ -92,12 +92,12 @@ public function testInvalidModelMustThrowError(): void
9292
{
9393
$source = new PathInput(__DIR__ . '/resources/file_types/pdf/multipage_cut-2.pdf');
9494

95-
$options = new InferenceParameters('INVALID MODEL ID');
95+
$inferenceParams = new InferenceParameters('INVALID MODEL ID');
9696

9797
$this->expectException(MindeeV2HttpException::class);
9898
$this->expectExceptionMessage('422');
9999

100-
$this->mindeeClient->enqueueInference($source, $options);
100+
$this->mindeeClient->enqueueInference($source, $inferenceParams);
101101
}
102102

103103
public function testInvalidJobMustThrowError(): void
@@ -112,9 +112,9 @@ public function testUrlInputSourceMustNotRaiseErrors(): void
112112
{
113113
$urlSource = new URLInputSource(getenv('MINDEE_V2_SE_TESTS_BLANK_PDF_URL'));
114114

115-
$options = new InferenceParameters($this->modelId);
115+
$inferenceParams = new InferenceParameters($this->modelId);
116116

117-
$response = $this->mindeeClient->enqueueAndGetInference($urlSource, $options);
117+
$response = $this->mindeeClient->enqueueAndGetInference($urlSource, $inferenceParams);
118118
$this->assertNotNull($response);
119119
$inference = $response->inference;
120120
$this->assertNotNull($inference);

0 commit comments

Comments
 (0)