Repository navigation
Conversation
- Add Thinking controls (includeThoughts and thinkingBudget) - Remove deprecated sampling parameters (temperature, topP, topK) - Add Google Search and Google Maps grounding - Add Context Caching workflow (create, list, query, delete) - Add Text and Multimodal Embeddings with gemini-embedding-2 - Add Gemini 3 section (thinking levels, media resolution, thought signatures, migration guide) - Modernize model selector with gemini-3.8-flash default
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request aligns the JavaScript quickstart guide with the existing Python documentation, ensuring feature parity across SDKs. It introduces advanced Gemini API capabilities, including support for thinking models, grounding, context caching, and embeddings. Additionally, the update modernizes the code by removing deprecated parameters and providing a clear migration path for users transitioning to Gemini 3. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the JavaScript quickstart guide to showcase new features of the Google GenAI SDK, including model parameter configuration, thinking process control, Google Search and Maps grounding, context caching, text and multimodal embeddings, and Gemini 3 features. It also updates the default model to gemini-3.8-flash and removes deprecated sampling parameters. The review feedback highlights several instances where iterating over response.candidates[0].content.parts directly could lead to runtime errors if the API returns an empty candidate list. It is recommended to use optional chaining and a fallback array to safely handle these scenarios.
| type: "image", | ||
| data: imageDataUrl, | ||
| mime_type: "image/png", | ||
| media_resolution: "media_resolution_low", |
There was a problem hiding this comment.
media_resolution: "media_resolution_low" isn't a field on ImageContent the type defines resolution?: "low" | "medium" | "high" | "ultra_high". Currently it's silently ignored.
| console.log(response.text); | ||
| for (const step of interaction.steps) { | ||
| if (step.type === "thought") { | ||
| console.log("💭 Thought:", step.text || "(thinking...)"); |
There was a problem hiding this comment.
ThoughtStep has no text field, only summary and signature, so this always prints the fallback. Should be step.summary?.[0]?.text, with thinking_summaries: "auto" added to generation_config.
| and https://en.wikipedia.org/wiki/Apollo_12 | ||
| `; | ||
|
|
||
| interaction = await ai.interactions.create({ |
There was a problem hiding this comment.
The ai.interactions.create call below has no tools: [{ type: "url_context" }], so the model answers from its own knowledge rather than fetching the pages.
| --- | ||
| for await (const chunk of stream) { | ||
| if (chunk.delta?.text) { | ||
| process.stdout.write(chunk.delta.text); |
There was a problem hiding this comment.
process.stdout.write is Node-only and probably fails in the browser applet. No other JS quickstart uses it; console.log would match the rest.
Description
This PR migrates
quickstarts-js/Get_Started.jsto the Interactions API (ai.interactions), bringing it fully on par with the Python quickstart (quickstarts/Get_started.ipynb).Key Migrations & Updates:
ai.interactions):ai.models.generateContentwithai.interactions.createacross text, multimodal, image generation, streaming, code execution, and grounding workflows.previous_interaction_id.MODEL_ID->gemini-nano-banana-2.1).ai.interactions.gettraversal and resuming withsaved_steps.thinking_level("high","minimal", etc.) ingeneration_config.step.type === "thought") and access cryptographicstep.signature.response_format: { type: "text", mime_type: "application/json", schema: ... }.{ type: "google_search" },{ type: "google_maps" },{ type: "code_execution" }, and{ type: "function", ... }.function_callsteps and returningfunction_resultinput steps.ai.models.countTokens.ai.models.embedContentusinggemini-embedding-2.ai.caches.createfor shared multi-session caches.temperature,top_k,top_p).