Patch Changes
-
#11433
bc88b75Thanks @jackjin1997! - Fix Vertex AI endpoint routing for multi-region locations such aseuandus. -
#11606
194a063Thanks @thushanth-bengre-langchain! - fix: allowlist JSON Schema keywords for Gemini function/response schemas instead of denylisting, fixingpropertyNames/exclusiveMinimum/etc. 400s (#8584) -
#11611
c9ae847Thanks @thushanth-bengre-langchain! - fix(google): settoolConfig.includeServerSideToolInvocationswhen mixing built-in and function-declaration tools, which Gemini otherwise rejects with a 400 -
#11616
35368dbThanks @thushanth-bengre-langchain! - fix(google): surfacegroundingMetadata/groundingSupport/citationMetadataon.stream()and.streamEvents(), matching what.invoke()already returns -
#11603
fec9cd8Thanks @thushanth-bengre-langchain! - fix(core): build streamingllmOutput.tokenUsagefrom the fully-accumulated chunk instead of whichever individual chunk'susage_metadataarrived lastAffects both core streaming paths —
.stream()/.streamEvents()(_streamIterator) and.invoke()/.generate()when a streaming-preferring callback is attached (_generateWithCache'shasStreamingHandlerbranch). Previously,llmOutput.tokenUsagewas overwritten by each chunk in turn, so only the last chunk carryingusage_metadatawon — correct for providers that emit one cumulative total on a final chunk, but wrong for providers (e.g.@langchain/google,@langchain/anthropic) that emitusage_metadataas a per-chunk delta across multiple chunks, where the values must be summed.Note for provider authors: this assumes each streamed chunk's
usage_metadatais 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) inllmOutput.tokenUsage, matching the existing behavior of the correctly-workingmessage.usage_metadatafield.Also fixes
@langchain/google'sinvoke({streaming: true})path (no streaming-preferring callback attached), wherellmOutputwas never populated at all. -
#11602
78b2923Thanks @thushanth-bengre-langchain! - fix(google): preserve tool callidandthoughtSignaturein native stream eventsPreserves tool call
idand Gemini'sthoughtSignaturethrough@langchain/google's nativestreamEvents()path.