AI / Google Antigravity Gemini Fundamentals Interview Questions
What is the Gemini context window and how do you manage long contexts?
The context window is the maximum number of tokens a model can process in a single request (input + output combined). Gemini models have among the largest context windows of any commercially available AI, with 1 million tokens for most current models.
| Model | Input context | Max output |
|---|---|---|
| Gemini 3.5 Flash | 1 million tokens | 64k tokens |
| Gemini 3.1 Pro Preview | 1 million tokens | 64k tokens |
| Gemini 2.5 Pro | 1 million tokens | 64k tokens |
| Gemini 2.5 Flash | 1 million tokens | 64k tokens |
from google import genai from google.genai import types client = genai.Client() # Count tokens before sending (avoid context overflow errors): token_response = client.models.count_tokens( model="gemini-3.5-flash", contents="Your very long document here...", ) print(f"Token count: {token_response.total_tokens}") # check vs 1M limit # Long context use cases Gemini excels at: # 1. Entire codebase analysis response = client.models.generate_content( model="gemini-3.5-flash", contents=[ "Summarise all TODO comments in this codebase and prioritise them.", entire_codebase_text, # can be hundreds of files ] ) # 2. Full book Q&A # 3. Hour-long video analysis # 4. Full conversation history # Context caching: cache large stable prompts to reduce cost: cached = client.caches.create( model="gemini-3.5-flash", contents=[large_document], # cache this expensive prefix ttl="3600s", ) # Reference the cache in subsequent calls: response = client.models.generate_content( model="gemini-3.5-flash", contents="Summarise section 3.", config=types.GenerateContentConfig(cached_content=cached.name), )
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...
