# Upgrade Google Generative AI SDK integration from @google/generative-ai to @google/genai

**URL:** <https://forum.langchain.com/t/upgrade-google-generative-ai-sdk-integration-from-google-generative-ai-to-google-genai/2110>\
**Category:** LangChain\
**Tags:** js-help\
**Created:** [November 5, 2025, 5:01pm UTC](https://forum.langchain.com/t/upgrade-google-generative-ai-sdk-integration-from-google-generative-ai-to-google-genai/2110 "2025-11-05T17:01:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ries0703](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/ries0703/32/1493_2.png) [@Ries0703](https://forum.langchain.com/u/Ries0703)\
**Post date:** [November 5, 2025, 5:01pm UTC](https://forum.langchain.com/t/upgrade-google-generative-ai-sdk-integration-from-google-generative-ai-to-google-genai/2110/1 "2025-11-05T17:01:33Z")

</div>

The current integration of the Google Generative AI SDK in LangChain.js (via `@google/generative-ai` or equivalent) is tracking a library that is now _deprecated_. According to Google’s documentation:

- The legacy library `@google/generative-ai` is flagged as end-of-life. ([Yarn](https://classic.yarnpkg.com/en/package/%40google/generative-ai?utm_source=chatgpt.com "@google/generative-ai | Yarn"))
- The recommended library for JavaScript/TypeScript is `@google/genai`, provided at [https://github.com/googleapis/js-genai](https://github.com/googleapis/js-genai). ([GitHub](https://github.com/googleapis/js-genai?utm_source=chatgpt.com "TypeScript/JavaScript SDK for Gemini and Vertex AI. - GitHub"))
- Google Cloud’s deprecation guide states that the “Generative AI module in the Vertex AI SDK” will be removed June 24, 2026 (and that migrating to Google Gen AI SDK is advised). ([Google Cloud](https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations?utm_source=chatgpt.com "Generative AI on Vertex AI deprecations - Google Cloud"))
- In addition, for the Gemini API libraries Google explicitly states: “If you’re using one of our legacy libraries, we strongly recommend you migrate to the new Google Gen AI SDK.” ([Google AI for Developers](https://ai.google.dev/gemini-api/docs/libraries?utm_source=chatgpt.com "Gemini API libraries | Google AI for Developers"))

By continuing to rely on the older SDK, LangChain.js risks:

- missing out on performance improvements / new features in the newer SDK
- hitting breaking changes or removal of critical functionality once the old library is fully deprecated
- maintaining extra compatibility burden for users, and potentially confusing documentation references

**Expected behaviour**  
The integration should upgrade to use `@google/genai` (or whichever current stable package Google supports) so that:

- users of LangChain.js can leverage the up-to-date Google Gen AI SDK, including new Gemini models, streaming, and latest features
- the library avoids dependencies on deprecated modules and aligns with Google’s current recommendations
- migration instructions or compatibility layers are provided (if needed) for users of the old SDK

**Additional context & relevance to LangChain**  
As a multi-provider developer (and as LangChain aims to support broad LLM integrations), keeping the Google side up-to-date is important. Many users will rely on this being stable and maintained. Given your focus on abstractions and flexibility (this aligns with my own work as well), reducing dependency risk is beneficial.

**Suggested action items**

- Identify where the old package (`@google/generative-ai`, `google-generativeai`, etc) is referenced in the codebase (integration modules, example code, docs).
- Change the dependency to `@google/genai` (for JavaScript/TypeScript).
- Update documentation, examples, and plugin code to reference the new SDK usage (imports, initialization, API calls).
- If breaking changes exist between the old and new SDK (e.g., class names, method signatures), provide a compatibility shim or migration guide in the LangChain.js docs.
- Write a test or sample project using the new SDK and ensure existing functionality (e.g., embeddings, generation, streaming) works as expected with `@google/genai`.
- Mark the old integration module as deprecated (with clear warnings) and plan its removal in a future major version of LangChain.js.

**Why this matters now**  
The deprecation timeline is already published: the legacy SDKs and modules are no longer receiving new features, and may be deprecated fully. For example:

- The legacy npm package page for `@google/generative-ai` states it is [Deprecated] and points developers toward the new SDK. ([Yarn](https://classic.yarnpkg.com/en/package/%40google/generative-ai?utm_source=chatgpt.com "@google/generative-ai | Yarn"))
- The “Gemini API libraries” page explicitly states to migrate to the new SDK for best performance and support. ([Google AI for Developers](https://ai.google.dev/gemini-api/docs/libraries?utm_source=chatgpt.com "Gemini API libraries | Google AI for Developers"))

Since LangChain.js aims for production readiness, user-confidence, and maintainability, making this migration sooner rather than later would avoid potential future issues.

**Environment**

- LangChain.js version: (please fill current version)
- Node.js / TypeScript environment: typical setups using LLM provider abstractions
- Integration: Google Generative AI provider module (e.g., `@langchain/google-genai`, or `@langchain/google-generativeai`, whichever is currently in use

---

<div class="post-metadata">

**Author:** ![hntrl](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@hntrl](https://forum.langchain.com/u/hntrl)\
**Post date:** [November 5, 2025, 5:10pm UTC](https://forum.langchain.com/t/upgrade-google-generative-ai-sdk-integration-from-google-generative-ai-to-google-genai/2110/2 "2025-11-05T17:10:53Z")

</div>

Thanks for bringing this up! You’ve caught us in the middle of a sprint to revisit our google integration, and we’ll have an answer for this very soon.

---

<div class="post-metadata">

**Author:** ![brainvine](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/brainvine/32/1901_2.png) [@brainvine](https://forum.langchain.com/u/brainvine)\
**Post date:** [December 10, 2025, 9:46am UTC](https://forum.langchain.com/t/upgrade-google-generative-ai-sdk-integration-from-google-generative-ai-to-google-genai/2110/3 "2025-12-10T09:46:06Z")

</div>

Any update to this? I want to use Gemini Pro 3 with function-calling, but keep hitting the 400 error regarding the though\_signature stuff.

---

<div class="post-metadata">

**Author:** ![coawazie](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/coawazie/32/2010_2.png) [@coawazie](https://forum.langchain.com/u/coawazie)\
**Post date:** [December 22, 2025, 3:56pm UTC](https://forum.langchain.com/t/upgrade-google-generative-ai-sdk-integration-from-google-generative-ai-to-google-genai/2110/4 "2025-12-22T15:56:44Z")

</div>

Imports such as `import {GoogleGenAI, HarmBlockThreshold, HarmCategory, SafetySetting} from "@google/genai";`are now also throwing errors with configs for instantiating `ChatGoogleGenerativeAI`. I think Google was going for backward compatibility when they mapped the `category` and `threshold` config params in their new SDK to string ([new genai sdk](https://ai.google.dev/gemini-api/docs/migrate#javascript_14)) to the enums in their _ **legacy** _ SDK. But depending on runtime Javascript not enforcing types is too brittle, and Typescript will ordinarily throw on this. Using `@ts-expect-error: legacy` also is a non-ideal workaround as this is Google we are talking about here, and we know _breaking changes_ is their bread and butter!

---

<div class="post-metadata">

**Author:** ![chkn](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/chkn/32/2229_2.png) [@chkn](https://forum.langchain.com/u/chkn)\
**Post date:** [January 22, 2026, 4:46pm UTC](https://forum.langchain.com/t/upgrade-google-generative-ai-sdk-integration-from-google-generative-ai-to-google-genai/2110/5 "2026-01-22T16:46:31Z")

</div>

@hntrl Any word on this? It looks like the Python integration [got some love](https://github.com/langchain-ai/langchain-google/discussions/1422), but the LangChain.js provider still [depends on](https://github.com/langchain-ai/langchainjs/blob/main/libs/providers/langchain-google-genai/package.json#L37) the @google/generative-ai package that reached end-of-life back on August 31st, 2025.

---

<div class="post-metadata">

**Author:** ![hntrl](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@hntrl](https://forum.langchain.com/u/hntrl)\
**Post date:** [March 2, 2026, 7:31pm UTC](https://forum.langchain.com/t/upgrade-google-generative-ai-sdk-integration-from-google-generative-ai-to-google-genai/2110/6 "2026-03-02T19:31:13Z")

</div>

Hey all! Just to provide an update here – we shipped the @langchain/google package ([https://www.npmjs.com/package/@langchain/google](https://www.npmjs.com/package/@langchain/google)). We’ll keep supporting the existing packages for some time, but consider this our solve for migrating away from the deprecated SDK
