DEV Community

LangChainJS and Gemini 4 Argon: What's here and what's coming?

Google has released the latest version in the Gemini family, Gemini 4 Argon, and I was fortunate enough to be able to preview and test it.

The first thing I did was try it against the LangChainJS test suite - and it passed with flying colors.

However, if you're looking to use LangChainJS with Gemini 4 Argon today, there are a few things you need to keep in mind. And if you have some big future plans with Argon - there are a few things we're working on to make them working together better. This is a quick note to help let you know where we are and what we're working on.

An incomplete sketch of a parrot, two stars, and the Roman numeral IV, generated by Gemini / Nano-Banana

Gemini 4 Argon works today!

You can use LangChainJS with Gemini 4 Argon using either the Google AI (gai) or Google Enterprise / Vertex (gcp) platforms. No changes or new libraries necessary. Just use the model name "gemini-4-argon" and you're all set to go!

There are two things to keep in mind, however:

  • The "minimal" thinking level (and a thinking budget of 0) aren't supported, but LangChainJS doesn't turn this into "low" like it does for other models where "minimal" isn't supported. A fix for this is coming shortly.
  • "maxOutputTokens" has a 64k limit. Although Gemini 4 Argon supports up to 1M output tokens using a feature called Long Decode, but this requires some additional work. More about this below.

If you're using either "maxReasoningTokens" or "thinkingBudget", we'll continue to support these parameters for backwards compatibility, mapping them to Google's "thinkingLevel" values.

Exciting new updates soon.

First, if you're not already using the "@langchain/google" library, this might be a great time for you to do so. This is where we're focusing all new work.

As mentioned above, some changes to fix the thinking level will be available soon. Follow issue 11940 to learn more.

Long Decode allows for output up to 1M tokens, the most of any of the frontier models. But this required some internal changes in Google's API. There are two ways to address this, and we'll be adding support for both:

  • Currently we support Google's "Generate Content" API. Google has added a "continuationToken" parameter which will let you read the response in 64k chunks.
  • Google also has the "Interactions" API, which allows for many new features. We have just started the first phase of a project to make the Interactions API available through LangChainJS in a transparent way.

We'll be adding support for the "continuationToken", which will allow you to read the Long Decode responses one chunk at a time. This is, however, only meant as a stop-gap solution while we work on a better approach.

The Interactions API supports Long Decode directly when in "background" mode. We'll be implementing support for the Interactions API as quickly as we can, and "background" mode will be one of the initial features supported. We even hope to make it transparent in some cases, so the only thing you'll need to do is set "maxOutputTokens" to more than 64k and things should "just work".

Both of these require issue 11879 to be completed first - and our focus is on getting that released ASAP so we can begin work on the other components. We'll also be adding a chunk of new tests to make sure the features work as expected and that everything works as smoothly as it always has.

Our objectives

I've always tried to make LangChainJS as easy for developers to use, and continue using, as possible. You shouldn't have to make sure your parameters match the complex rules that Google enforces - the LangChainJS library should handle that for you.

The changes we are working on for Argon support are no different.

Your help and support for this project are, as always, appreciated.

My thanks, again, to the teams at Google who gave me early access to begin testing and work with Argon. And my thanks to family and friends who have always been there. Working on this project is one way I choose to help the community - and I hope you are contributing to the communities that are important to you.

Top comments (0)