Skip to contents

This function sends a PDF file to the Vertex AI Model Garden (Mistral model) for processing, such as OCR. The PDF is encoded as base64 and sent to the rawPredict endpoint. The function is designed for future extension to support other document types and tasks.

Usage

gemini_garden(token, project_id, pdf_path)

Arguments

token

Token object (e.g., from token.vertex()) containing the access token, region, and model_id.

project_id

Google Cloud project ID.

pdf_path

Path to the PDF file to be processed.

Value

A parsed list containing the results from the Vertex AI API (e.g., OCR results).

Details

The PDF file is read and encoded as base64, then sent to the Vertex AI rawPredict endpoint for processing using a Mistral model. This function is structured for future extension to support other document types and model tasks available in Vertex AI Model Garden.

For more information about available models, endpoints, and supported tasks, see Vertex AI Model Garden documentation.

Examples

if (FALSE) { # \dontrun{
# Issue a token using token.vertex() first
my_token <- token.vertex(
  jsonkey = "your-service-account.json",
  region = "us-central1",
  model_id = "mistral-ocr-2505"
)
result <- gemini_garden(
  token = my_token,
  project_id = "your-project-id",
  pdf_path = "sample.pdf"
)
print(result)
} # }