gemini_image {gemini.R}R Documentation

Generate text from text and image with Gemini

Description

Generate text from text and image with Gemini

Usage

gemini_image(
  image = NULL,
  prompt = "Explain this image",
  model = "1.5-flash",
  temperature = 0.5,
  maxOutputTokens = 1024,
  type = "png"
)

Arguments

image

The image to generate text

prompt

The prompt to generate text, Default is "Explain this image"

model

The model to use. Options are '1.5-flash', '1.5-pro'. Default is '1.5-flash' see https://ai.google.dev/gemini-api/docs/models/gemini

temperature

The temperature to use. Default is 0.5 value should be between 0 and 2 see https://ai.google.dev/gemini-api/docs/models/generative-models#model-parameters

maxOutputTokens

The maximum number of tokens to generate. Default is 1024 and 100 tokens correspond to roughly 60-80 words.

type

The type of image. Options are 'png', 'jpeg', 'webp', 'heic', 'heif'. Default is 'png'

Value

Generated text

See Also

https://ai.google.dev/docs/gemini_api_overview#text_image_input

Examples

## Not run: 
library(gemini.R)
setAPI("YOUR_API_KEY")
gemini_image(image = system.file("docs/reference/figures/image.png", package = "gemini.R"))

## End(Not run)


[Package gemini.R version 0.6.1 Index]