Skip to contents

Generate text completions using Google AI Studio's API

Usage

create_completion_google(
  prompt,
  model = "gemini-pro",
  key = Sys.getenv("GOOGLE_API_KEY")
)

Arguments

prompt

The prompt for generating completions

model

The model to use for generating text. By default, the function will try to use "text-bison-001"

key

The API key for accessing Google AI Studio's API. By default, the function will try to use the GOOGLE_API_KEY environment variable.

Value

A list with the generated completions and other information returned by the API.

Examples

if (FALSE) {
create_completion_google(
  prompt = "Write a story about a magic backpack",
  temperature = 1.0,
  candidate_count = 3
)
}