Skip to content

fix(@langchain/google) Fixes for ID in Vertex function calls#10292

Merged
Hunter Lovell (hntrl) merged 4 commits intolangchain-ai:mainfrom
afirstenberg:vertex-function-id
Mar 17, 2026
Merged

fix(@langchain/google) Fixes for ID in Vertex function calls#10292
Hunter Lovell (hntrl) merged 4 commits intolangchain-ai:mainfrom
afirstenberg:vertex-function-id

Conversation

@afirstenberg
Copy link
Contributor

Vertex does not accept IDs for function responses, considering it an invalid field. LangChain requires an ID to match responses to requests, so a previous fix added a synthetic ID for this purpose.
Changed this synthetic ID to match a known pattern so it could be removed when sending the results back to Gemini.

Added tests.
Integration tests pass with the following exception:

  • gemini-3.1-flash-lite is generating an error about the function results. This appears to be an error on the Google side, and I'm researching further and will coordinate with Google.

Fixes #10266

@changeset-bot
Copy link

changeset-bot bot commented Mar 7, 2026

🦋 Changeset detected

Latest commit: 6407c8f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@langchain/google Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@afirstenberg Allen Firstenberg (afirstenberg) changed the title fix(@langchain/google) Fixes for Vertex function calls fix(@langchain/google) Fixes for ID in Vertex function calls Mar 9, 2026
toolCalls.push({
type: "tool_call",
id: functionCallPart.functionCall.id ?? uuidv4().replace(/-/g, ""),
id: functionCallPart.functionCall.id ?? `lc-tool-call-${uuidv4().replace(/-/g, "")}`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and i'm guessing that second condition will only ever be met by vertex?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second condition should only be met if it uses a generated ID. But it is aimed at when it happens on Vertex, yes.

@hntrl Hunter Lovell (hntrl) merged commit e4193f8 into langchain-ai:main Mar 17, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(@langchain/google) Tests with functions on Vertex fail

2 participants