Documentation

Client
in package
uses CustomSleepMixin

Mindee Client V2.

Table of Contents

Properties

$mindeeApi  : MindeeApiV2

Methods

__construct()  : mixed
Mindee Client V2.
deleteExtractionRagDocument()  : bool
Delete a document from the RAG database.
enqueue()  : JobResponse
Send the document to an asynchronous endpoint and return its ID in the queue.
enqueueAndGetResult()  : BaseResponse
Send a document to an endpoint and poll the server until the result is sent or until the maximum number of tries is reached.
getJob()  : JobResponse
Get the status of an inference that was previously enqueued.
getJobFromUrl()  : JobResponse
Get the status of a job from its polling URL.
getRagDocument()  : T
Not recommended for general use, prefer getReadyRagDocumentPoll().
getReadyRagDocumentPoll()  : T
Get a document's info and annotations from the RAG database.
getResult()  : BaseResponse
getResultFromUrl()  : BaseResponse
search()  : T
Searches for resources matching the given criteria.
searchModels()  : ModelSearchResponse
Searches for a list of available models for the given API key.
updateAndGetRagAnnotationPoll()  : BaseRagAnnotationResponse
Update a document's annotations in the RAG database.
updateRagAnnotation()  : T
Update a document's annotations in the RAG database.
uploadAndGetRagDocumentPoll()  : T
Add a document to the RAG database and return the initial annotation.
uploadRagDocument()  : T
Not recommended for general use, prefer uploadAndGetRagDocumentPoll().
customSleep()  : void
Waits for a custom amount of time from either a float or an integer.
pollForRagDocument()  : T
Poll until the RAG document is finished processing or the max number of attempts is reached.

Properties

Methods

__construct()

Mindee Client V2.

public __construct([string|null $apiKey = null ]) : mixed
Parameters
$apiKey : string|null = null

Optional API key. Will fall back to environment variable if not provided.

deleteExtractionRagDocument()

Delete a document from the RAG database.

public deleteExtractionRagDocument(string $documentId) : bool

For extraction models only.

Parameters
$documentId : string

Unique identifier of the RAG document to delete.

Return values
bool

True if the deletion was successful, false otherwise.

enqueue()

Send the document to an asynchronous endpoint and return its ID in the queue.

public enqueue(InputSource $inputSource, BaseProductParameters $params) : JobResponse
Parameters
$inputSource : InputSource

File to parse.

$params : BaseProductParameters

Parameters relating to prediction options.

Tags
throws
MindeeException

Throws if the input document is not provided.

category

Asynchronous

Return values
JobResponse

A JobResponse containing the job (queue) corresponding to a document.

enqueueAndGetResult()

Send a document to an endpoint and poll the server until the result is sent or until the maximum number of tries is reached.

public enqueueAndGetResult(string $responseClass, InputSource $inputDoc, BaseProductParameters $params[, PollingOptions|null $pollingOptions = null ][, CancellationToken|null $cancellationToken = null ]) : BaseResponse
Parameters
$responseClass : string

The response class to construct.

$inputDoc : InputSource

Input document to parse.

$params : BaseProductParameters

Parameters relating to prediction options.

$pollingOptions : PollingOptions|null = null

Options to apply to the polling.

$cancellationToken : CancellationToken|null = null

CancellationToken to check for cancellation.

Tags
template
phpstan-param

class-string<T> $responseClass

throws
MindeeException

Throws if enqueueing fails, job fails, or times out.

Return values
BaseResponse

A response containing parsing results.

getJob()

Get the status of an inference that was previously enqueued.

public getJob(string $jobId) : JobResponse

Can be used for polling.

Parameters
$jobId : string

ID of the queue to poll.

Tags
category

Asynchronous

Return values
JobResponse

A JobResponse containing a Job, which also contains a Document if the parsing is complete.

getJobFromUrl()

Get the status of a job from its polling URL.

public getJobFromUrl(string $pollingUrl) : JobResponse

Can be used for polling.

Parameters
$pollingUrl : string

URL to poll to retrieve the job.

Tags
category

Asynchronous

Return values
JobResponse

A JobResponse containing a Job.

getRagDocument()

Not recommended for general use, prefer getReadyRagDocumentPoll().

public getRagDocument(string $responseClass, string $documentId) : T

You will need to poll until the document is ready for use. Get a document's info and annotations from the RAG database.

Parameters
$responseClass : string

The response class to construct.

$documentId : string

Unique identifier of the RAG document.

Tags
template
phpstan-param

class-string<T> $responseClass

Return values
T

getReadyRagDocumentPoll()

Get a document's info and annotations from the RAG database.

public getReadyRagDocumentPoll(string $responseClass, string $documentId[, PollingOptions|null $pollingOptions = null ][, CancellationToken|null $cancellationToken = null ]) : T
Parameters
$responseClass : string

The response class to construct.

$documentId : string

Unique identifier of the RAG document.

$pollingOptions : PollingOptions|null = null

Options to apply to the polling.

$cancellationToken : CancellationToken|null = null

CancellationToken to check for cancellation.

Tags
template
phpstan-param

class-string<T> $responseClass

throws
MindeeException

Throws if polling times out.

Return values
T

getResult()

public getResult(string $responseClass, string $resultId) : BaseResponse
Parameters
$responseClass : string

The response class to construct.

$resultId : string

ID of the result.

Tags
template
phpstan-param

class-string<T> $responseClass

Return values
BaseResponse

A response containing parsing results.

getResultFromUrl()

public getResultFromUrl(string $responseClass, string $resultUrl) : BaseResponse
Parameters
$responseClass : string

The response class to construct.

$resultUrl : string

URL of the result.

Tags
template
phpstan-param

class-string<T> $responseClass

Return values
BaseResponse

A response containing parsing results.

searchModels()

Searches for a list of available models for the given API key.

public searchModels([string|null $modelName = null ][, string|null $modelType = null ]) : ModelSearchResponse

Use search(new ModelSearchParameters(...)) instead.

Parameters
$modelName : string|null = null

Optional model name to filter by.

$modelType : string|null = null

Optional model type to filter by.

Return values
ModelSearchResponse

The list of models matching the criteria.

updateAndGetRagAnnotationPoll()

Update a document's annotations in the RAG database.

public updateAndGetRagAnnotationPoll(BaseAnnotationParameters<string|int, T$params[, PollingOptions|null $pollingOptions = null ][, CancellationToken|null $cancellationToken = null ]) : BaseRagAnnotationResponse
Parameters
$params : BaseAnnotationParameters<string|int, T>

Annotation parameters including the document ID and fields to update.

$pollingOptions : PollingOptions|null = null

Options to apply to the polling.

$cancellationToken : CancellationToken|null = null

CancellationToken to check for cancellation.

Tags
template
throws
MindeeException

Throws if polling times out.

Return values
BaseRagAnnotationResponse

updateRagAnnotation()

Update a document's annotations in the RAG database.

public updateRagAnnotation(BaseAnnotationParameters<string|int, T$params) : T
Parameters
$params : BaseAnnotationParameters<string|int, T>

Annotation parameters including the document ID and fields to update.

Tags
template
Return values
T

uploadAndGetRagDocumentPoll()

Add a document to the RAG database and return the initial annotation.

public uploadAndGetRagDocumentPoll(LocalInputSource $inputSource, BaseRagDocumentUploadParameters<string|int, T$params[, PollingOptions|null $pollingOptions = null ][, CancellationToken|null $cancellationToken = null ]) : T
Parameters
$inputSource : LocalInputSource

Local file to upload.

$params : BaseRagDocumentUploadParameters<string|int, T>

Upload parameters.

$pollingOptions : PollingOptions|null = null

Options to apply to the polling.

$cancellationToken : CancellationToken|null = null

CancellationToken to check for cancellation.

Tags
template
throws
MindeeException

Throws if upload fails or polling times out.

Return values
T

customSleep()

Waits for a custom amount of time from either a float or an integer.

protected static customSleep(float|int $delay[, CancellationToken|null $cancellationToken = null ]) : void

Purposefully waits for one more millisecond on Windows due to flakiness in delays between OS.

Parameters
$delay : float|int

Delay in seconds.

$cancellationToken : CancellationToken|null = null

CancellationToken to check for cancellation.

pollForRagDocument()

Poll until the RAG document is finished processing or the max number of attempts is reached.

private pollForRagDocument(string $responseClass, BaseRagAnnotationResponse $initialResponse, PollingOptions $pollingOptions[, CancellationToken|null $cancellationToken = null ]) : T
Parameters
$responseClass : string

The response class to construct.

$initialResponse : BaseRagAnnotationResponse

Initial annotation response.

$pollingOptions : PollingOptions

Options to apply to the polling.

$cancellationToken : CancellationToken|null = null

CancellationToken to check for cancellation.

Tags
template
phpstan-param

class-string<T> $responseClass

throws
MindeeException

Throws if the job fails or polling times out.

Return values
T
On this page

Search results