Class OCRRequest

java.lang.Object
nl.dannyj.mistral.models.ocr.OCRRequest
All Implemented Interfaces:
Request

public class OCRRequest extends Object implements Request
Represents the request body for the OCR API endpoint (`/v1/ocr`).
  • Constructor Details

    • OCRRequest

      public OCRRequest(String model, String id, ContentChunk document, List<Integer> pages, Boolean includeImageBase64, Integer imageLimit, Integer imageMinSize)
      Creates a new OCRRequest 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 a DocumentURLChunk or an ImageURLChunk. 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

      public static OCRRequest.OCRRequestBuilder builder()
    • getModel

      public String getModel()
      ID of the model to use.
      Returns:
      The model's ID.
    • getId

      public String getId()
      Optional ID for the request.
      Returns:
      The optional ID for the request.
    • getDocument

      public ContentChunk getDocument()
      Document to run OCR on. Can be a DocumentURLChunk or an ImageURLChunk.
      Returns:
      The document to run OCR on.
    • getPages

      public List<Integer> 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

      public Boolean getIncludeImageBase64()
      Include image URLs in response.
      Returns:
      Whether to include image URLs in the response.
    • getImageLimit

      public Integer getImageLimit()
      Maximum images to extract.
      Returns:
      The maximum number of images to extract.
    • getImageMinSize

      public Integer getImageMinSize()
      Minimum height and width of image to extract.
      Returns:
      The minimum height and width of images to extract.
    • setModel

      public void setModel(String model)
      ID of the model to use.
      Parameters:
      model - The model's ID. Can't be null.
    • setId

      public void setId(String id)
      Optional ID for the request.
      Parameters:
      id - The optional ID for the request.
    • setDocument

      public void setDocument(ContentChunk document)
      Document to run OCR on. Can be a DocumentURLChunk or an ImageURLChunk.
      Parameters:
      document - The document to run OCR on. Can be a DocumentURLChunk or an ImageURLChunk. Can't be null.
    • setPages

      public void setPages(List<Integer> pages)
      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

      public void setIncludeImageBase64(Boolean includeImageBase64)
      Include image URLs in response.
      Parameters:
      includeImageBase64 - Whether to include image URLs in the response. Null for default behavior.
    • setImageLimit

      public void setImageLimit(Integer imageLimit)
      Maximum images to extract.
      Parameters:
      imageLimit - The maximum number of images to extract. Null for default behavior.
    • setImageMinSize

      public void setImageMinSize(Integer imageMinSize)
      Minimum height and width of image to extract.
      Parameters:
      imageMinSize - The minimum height and width of images to extract. Null for default behavior.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object