Learn R Programming

gemini.R (version 0.8.0)

gemini_audio: Analyze audio using Gemini

Description

This function sends audio to the Gemini API and returns a text description.

Usage

gemini_audio(
  audio = NULL,
  prompt = "Describe this audio",
  model = "1.5-flash",
  temperature = 0.5,
  maxOutputTokens = 1024
)

Value

A character vector containing the Gemini API's response.

Arguments

audio

Path to the audio file (default: uses a sample file). Must be an MP3.

prompt

A string describing what to do with the audio.

model

The Gemini model to use ("1.5-flash" or "1.5-pro", "2.0-flash-exp"). Defaults to "1.5-flash".

temperature

Controls the randomness of the generated text (0-2). Defaults to 0.5.

maxOutputTokens

The maximum number of tokens in the generated text. Defaults to 1024.

Examples

Run this code
if (FALSE) {
library(gemini.R)
setAPI("YOUR_API_KEY")
gemini_image(audio = system.file("docs/reference/helloworld.mp3", package = "gemini.R"))
}

Run the code above in your browser using DataLab