github langchain-ai/langchainjs @langchain/google@0.2.6

latest releases: @langchain/neo4j@0.1.20, @langchain/google-vertexai-web@2.3.2, @langchain/google-vertexai@2.3.2...
4 hours ago

Patch Changes

  • #11433 bc88b75 Thanks @jackjin1997! - Fix Vertex AI endpoint routing for multi-region locations such as eu and us.

  • #11606 194a063 Thanks @thushanth-bengre-langchain! - fix: allowlist JSON Schema keywords for Gemini function/response schemas instead of denylisting, fixing propertyNames/exclusiveMinimum/etc. 400s (#8584)

  • #11611 c9ae847 Thanks @thushanth-bengre-langchain! - fix(google): set toolConfig.includeServerSideToolInvocations when mixing built-in and function-declaration tools, which Gemini otherwise rejects with a 400

  • #11616 35368db Thanks @thushanth-bengre-langchain! - fix(google): surface groundingMetadata/groundingSupport/citationMetadata on .stream() and .streamEvents(), matching what .invoke() already returns

  • #11603 fec9cd8 Thanks @thushanth-bengre-langchain! - fix(core): build streaming llmOutput.tokenUsage from the fully-accumulated chunk instead of whichever individual chunk's usage_metadata arrived last

    Affects both core streaming paths — .stream()/.streamEvents() (_streamIterator) and .invoke()/.generate() when a streaming-preferring callback is attached (_generateWithCache's hasStreamingHandler branch). Previously, llmOutput.tokenUsage was overwritten by each chunk in turn, so only the last chunk carrying usage_metadata won — correct for providers that emit one cumulative total on a final chunk, but wrong for providers (e.g. @langchain/google, @langchain/anthropic) that emit usage_metadata as a per-chunk delta across multiple chunks, where the values must be summed.

    Note for provider authors: this assumes each streamed chunk's usage_metadata is either a per-chunk delta or appears only on a single final chunk. A provider that instead repeats a cumulative total on every chunk will now see it summed (and inflated) in llmOutput.tokenUsage, matching the existing behavior of the correctly-working message.usage_metadata field.

    Also fixes @langchain/google's invoke({streaming: true}) path (no streaming-preferring callback attached), where llmOutput was never populated at all.

  • #11602 78b2923 Thanks @thushanth-bengre-langchain! - fix(google): preserve tool call id and thoughtSignature in native stream events

    Preserves tool call id and Gemini's thoughtSignature through @langchain/google's native streamEvents() path.

Don't miss a new langchainjs release

NewReleases is sending notifications on new releases.