google_upload {ellmer} | R Documentation |
Upload a file to gemini
Description
This function uploads a file then waits for Gemini to finish processing it so that you can immediately use it in a prompt. It's experimental because it's currently Gemini specific, and we expect other providers to evolve similar feature in the future.
Uploaded files are automatically deleted after 2 days. Each file must be less than 2 GB and you can upload a total of 20 GB. ellmer doesn't currently provide a way to delete files early; please file an issue if this would be useful for you.
Usage
google_upload(
path,
base_url = "https://generativelanguage.googleapis.com/v1beta/",
api_key = NULL,
mime_type = NULL
)
Arguments
path |
Path to a file to upload. |
base_url |
The base URL to the endpoint; the default uses OpenAI. |
api_key |
API key to use for authentication. You generally should not supply this directly, but instead set the |
mime_type |
Optionally, specify the mime type of the file. If not specified, will be guesses from the file extension. |
Value
A <ContentUploaded>
object that can be passed to $chat()
.
Examples
## Not run:
file <- google_upload("path/to/file.pdf")
chat <- chat_google_gemini()
chat$chat(file, "Give me a three paragraph summary of this PDF")
## End(Not run)