AI / Google Antigravity Gemini Fundamentals Interview Questions
How do you use Python and JavaScript SDKs with the Gemini API?
Google provides official SDKs for Python (google-genai) and JavaScript/TypeScript (@google/genai). Both are available from version 2.3.0 onwards for Interactions API support.
# Python SDK setup: pip install google-genai import os from google import genai # Authentication - reads GEMINI_API_KEY from environment os.environ["GEMINI_API_KEY"] = "your-key-here" # or set externally client = genai.Client() # Basic text generation: interaction = client.interactions.create( model="gemini-3.5-flash", input="Write a Python web scraper.", ) print(interaction.output_text) # Async version: import asyncio async def async_example(): interaction = await client.aio.interactions.create( model="gemini-3.5-flash", input="Async web scraping example", ) return interaction.output_text asyncio.run(async_example())
// JavaScript/TypeScript SDK: npm install @google/genai import { GoogleGenAI } from "@google/genai"; const ai = new GoogleGenAI({}); // reads GEMINI_API_KEY from env // Basic interaction: const interaction = await ai.interactions.create({ model: "gemini-3.5-flash", input: "Explain async/await in JavaScript.", }); console.log(interaction.outputText); // Streaming: const stream = await ai.interactions.create({ model: "gemini-3.5-flash", input: "Write a long blog post about AI.", stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.outputText ?? ""); }
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...
