Skip to main content
The Gemini API now supports external HTTPS URLs (up to 100MB). Generate a pre-signed URL from S3 and pass it directly to Gemini.
s3_url_file_input.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your Google API key

4

Configure AWS credentials

Configure boto3 through environment variables, ~/.aws/credentials, or an IAM role. The source presigns s3://agno-public/recipes/ThaiRecipes.pdf; if you use another object, update the bucket and key and give the AWS identity permission to read it.
5

Run the example

Save the code above as s3_url_file_input.py, then run:
Full source: cookbook/90_models/google/gemini/s3_url_file_input.py