Package nl.dannyj.mistral.models.ocr
Class OCRRequest
java.lang.Object
nl.dannyj.mistral.models.ocr.OCRRequest
- All Implemented Interfaces:
Request
Represents the request body for the OCR API endpoint (`/v1/ocr`).
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionOCRRequest
(String model, String id, ContentChunk document, List<Integer> pages, Boolean includeImageBase64, Integer imageLimit, Integer imageMinSize) Creates a newOCRRequest
instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic OCRRequest.OCRRequestBuilder
builder()
protected boolean
boolean
Document to run OCR on.getId()
Optional ID for the request.Maximum images to extract.Minimum height and width of image to extract.Include image URLs in response.getModel()
ID of the model to use.getPages()
Specific pages user wants to process in various formats: single number, range, or list of both.int
hashCode()
void
setDocument
(ContentChunk document) Document to run OCR on.void
Optional ID for the request.void
setImageLimit
(Integer imageLimit) Maximum images to extract.void
setImageMinSize
(Integer imageMinSize) Minimum height and width of image to extract.void
setIncludeImageBase64
(Boolean includeImageBase64) Include image URLs in response.void
ID of the model to use.void
Specific pages user wants to process in various formats: single number, range, or list of both.toString()
-
Constructor Details
-
OCRRequest
public OCRRequest(String model, String id, ContentChunk document, List<Integer> pages, Boolean includeImageBase64, Integer imageLimit, Integer imageMinSize) Creates a newOCRRequest
instance.- Parameters:
model
- The model's ID. Can't be null.id
- The optional ID for the request.document
- The document to run OCR on. Can be aDocumentURLChunk
or anImageURLChunk
. Can't be null.pages
- A list of specific page indices to process. Starts from 0. Null to process all pages.includeImageBase64
- Whether to include image URLs in the response. Null for default behavior.imageLimit
- The maximum number of images to extract. Null for default behavior.imageMinSize
- The minimum height and width of images to extract. Null for default behavior.
-
OCRRequest
public OCRRequest()
-
-
Method Details
-
builder
-
getModel
ID of the model to use.- Returns:
- The model's ID.
-
getId
Optional ID for the request.- Returns:
- The optional ID for the request.
-
getDocument
Document to run OCR on. Can be a DocumentURLChunk or an ImageURLChunk.- Returns:
- The document to run OCR on.
-
getPages
Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0.- Returns:
- A list of specific page indices to process.
-
getIncludeImageBase64
Include image URLs in response.- Returns:
- Whether to include image URLs in the response.
-
getImageLimit
Maximum images to extract.- Returns:
- The maximum number of images to extract.
-
getImageMinSize
Minimum height and width of image to extract.- Returns:
- The minimum height and width of images to extract.
-
setModel
ID of the model to use.- Parameters:
model
- The model's ID. Can't be null.
-
setId
Optional ID for the request.- Parameters:
id
- The optional ID for the request.
-
setDocument
Document to run OCR on. Can be a DocumentURLChunk or an ImageURLChunk.- Parameters:
document
- The document to run OCR on. Can be aDocumentURLChunk
or anImageURLChunk
. Can't be null.
-
setPages
Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0.- Parameters:
pages
- A list of specific page indices to process. Starts from 0. Null to process all pages.
-
setIncludeImageBase64
Include image URLs in response.- Parameters:
includeImageBase64
- Whether to include image URLs in the response. Null for default behavior.
-
setImageLimit
Maximum images to extract.- Parameters:
imageLimit
- The maximum number of images to extract. Null for default behavior.
-
setImageMinSize
Minimum height and width of image to extract.- Parameters:
imageMinSize
- The minimum height and width of images to extract. Null for default behavior.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-