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 |
More Related questions...