Migrate from deprecated gemini-1.5-flash and @google/generative-ai to current packages#40
Merged
na-trium-144 merged 3 commits intomainfrom Sep 29, 2025
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
my-code | dc02868 | Commit Preview URL Branch Preview URL |
Sep 29 2025, 08:00 AM |
Co-authored-by: na-trium-144 <100704180+na-trium-144@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] gemini-1.5-flashと@google/generative-aiはdeprecated
Migrate from deprecated gemini-1.5-flash and @google/generative-ai to current packages
Sep 29, 2025
na-trium-144
requested changes
Sep 29, 2025
Co-authored-by: na-trium-144 <100704180+na-trium-144@users.noreply.github.com>
na-trium-144
approved these changes
Sep 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migration from deprecated packages to current ones
This PR migrates from deprecated packages to their current replacements:
gemini-1.5-flash→gemini-2.5-flash@google/generative-ai→@google/genaiMigration Plan
@google/genaipackage API structure@google/generative-aiwith@google/genai@google/generative-aito@google/genaiGoogleGenerativeAIwithGoogleGenAIgenAI.getGenerativeModel()toai.models.generateContent()gemini-1.5-flashtogemini-2.5-flashhttpOptions.baseUrlapp/actions/chatActions.ts(fromresult.response.text()toresult.text)app/actions/questionExample.ts(fromresult.response.text()toresult.text)paramsvariable for better maintainabilityFiles modified:
package.json- Updated dependency from@google/generative-aito@google/genaiapp/actions/gemini.ts- Complete API migration to new package with extracted parametersapp/actions/questionExample.ts- Updated response handling for new APIapp/actions/chatActions.ts- Updated response handling for new APIKey changes:
@google/generative-aiv0.24.1 to current@google/genaiv1.21.0gemini-1.5-flashtogemini-2.5-flashnew GoogleGenerativeAI().getGenerativeModel().generateContent()new GoogleGenAI().models.generateContent()result.response.text()result.text(with proper null checks)httpOptions.baseUrlfor the proxy fallbackmodelandcontentsinto a reusableparamsvariable, similar to the originalModelParamspattern, making it easier to modify parameters and reducing code duplicationAll TypeScript compilation, linting, and build processes pass successfully.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.