fix: forward tools parameter to Gemini API in GoogleLLM (#4380)#4386
Merged
whysosaket merged 1 commit intomem0ai:mainfrom Mar 18, 2026
Merged
fix: forward tools parameter to Gemini API in GoogleLLM (#4380)#4386whysosaket merged 1 commit intomem0ai:mainfrom
whysosaket merged 1 commit intomem0ai:mainfrom
Conversation
GoogleLLM.generateResponse() received the tools parameter but never passed it to the Gemini API, causing graph memory operations to silently fail — zero entities extracted, no error thrown. Convert OpenAI-style tools to Gemini functionDeclarations format and parse functionCall responses into the standard toolCalls format. Fixes mem0ai#4380
kartik-mem0
approved these changes
Mar 18, 2026
Contributor
kartik-mem0
left a comment
There was a problem hiding this comment.
thank you for your contribution @DhilipBinny
the pr lgtm!
whysosaket
approved these changes
Mar 18, 2026
This was referenced Mar 21, 2026
jamebobob
pushed a commit
to jamebobob/mem0-vigil-recall
that referenced
this pull request
Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
GoogleLLM.generateResponse()received thetoolsparameter but never passed it to the Gemini API. This caused graph memory operations to silently fail — zero entitiesextracted, Neo4j stays empty, no error thrown. Users think everything is working because vector store writes succeed.
Root cause
The
generateContentcall ingoogle.tsignored thetoolsparameter entirely. When Gemini doesn't receive function declarations, it returns plain text instead of function callresponses, so
toolCallsis always undefined.Fix
{type: "function", function: {name, description, parameters}}) to Gemini'sfunctionDeclarationsformatconfig.toolstogenerateContentcompletion.functionCallsinto the standardtoolCallsresponse format ({name, arguments})Changes
mem0-ts/src/oss/src/llms/google.ts— tool conversion + response parsingmem0-ts/src/oss/tests/google-llm.test.ts— 5 new testsFixes #4380
Type of change
How Has This Been Tested?
5 tests covering:
functionDeclarationsto GeminiRun with:
cd mem0-ts && npx jest src/oss/tests/google-llm.test.tsChecklist:
Maintainer Checklist