AI / Google Antigravity Gemini Fundamentals Interview Questions
What is the Gemini Files API and when do you need it?
The Files API (/v1beta/files) allows you to upload files to Google's servers for reuse across multiple Gemini API requests. It is essential for large files that would be impractical to pass as base64 inline, and for files you want to reference multiple times without re-uploading.
from google import genai from pathlib import Path client = genai.Client() # Upload a file uploaded = client.files.upload( file=Path("large-document.pdf"), config={"display_name": "Q3 Report"} ) print(f"File URI: {uploaded.uri}") print(f"MIME type: {uploaded.mime_type}") print(f"State: {uploaded.state}") # PROCESSING | ACTIVE | FAILED # Wait for processing (videos may take time) import time while uploaded.state == "PROCESSING": time.sleep(2) uploaded = client.files.get(name=uploaded.name) # Use in multiple requests without re-uploading: for question in ["Summarise section 2", "List all action items", "Find risks"]: response = client.models.generate_content( model="gemini-3.5-flash", contents=[ question, types.Part(file_data=types.FileData(file_uri=uploaded.uri)) ] ) print(response.text) # List and delete files: for f in client.files.list(): print(f.name, f.display_name) client.files.delete(name=uploaded.name)
| Property | Detail |
|---|---|
| Supported files | Text, images, audio, video, PDFs, and more |
| File retention | 48 hours automatically; manually delete sooner if needed |
| Storage | Per-project storage quota applies |
| Processing | Large videos/audio may enter PROCESSING state before becoming ACTIVE |
| Reuse | Reference the same URI across unlimited API calls during the 48h window |
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
