gemini_docs.vertex: Summarize or analyze documents using Vertex AI Gemini

View source: R/gemini_docs.R

gemini_docs.vertexR Documentation

Summarize or analyze documents using Vertex AI Gemini

Description

Summarize, compare, or analyze the content of one or more documents (PDF, TXT, HTML, etc.) using Vertex AI Gemini.

Usage

gemini_docs.vertex(
  file_uri,
  prompt,
  mime_type = "application/pdf",
  tokens = NULL,
  temperature = 1,
  maxOutputTokens = 8192,
  topK = 40,
  topP = 0.95,
  seed = 1234
)

Arguments

file_uri

The URI(s) or URL(s) of the file(s) to include in the prompt. Accepts Cloud Storage URI (gs://...), HTTP(S) URL, or YouTube video URL.

prompt

The text instructions to include in the prompt.

mime_type

The media type of the file (e.g., "application/pdf", "text/plain").

tokens

A list containing the API URL and key from token.vertex() function.

temperature

The temperature to use. Default is 1.

maxOutputTokens

The maximum number of tokens to generate. Default is 8192.

topK

The top-k value to use. Default is 40.

topP

The top-p value to use. Default is 0.95.

seed

The seed to use. Default is 1234.

Value

The summary or response text from Gemini Vertex.

See Also

https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/send-request-document

Examples

## Not run: 
tokens <- token.vertex()
gemini_docs.vertex(
  file_uri = "gs://cloud-samples-data/generative-ai/pdf/2403.05530.pdf",
  prompt = "Summarize this document.",
  mime_type = "application/pdf",
  tokens = tokens
)

## End(Not run)

gemini.R documentation built on June 20, 2025, 5:07 p.m.