feat(llm): extract BaseGeminiLLM, export extension point#571
Draft
matteomedioli wants to merge 2 commits into
Draft
feat(llm): extract BaseGeminiLLM, export extension point#571matteomedioli wants to merge 2 commits into
matteomedioli wants to merge 2 commits into
Conversation
matteomedioli
marked this pull request as draft
July 17, 2026 11:39
This was referenced Jul 17, 2026
matteomedioli
force-pushed
the
matteo/split-http-client-helper
branch
from
July 17, 2026 15:02
0b4426b to
4baa924
Compare
matteomedioli
force-pushed
the
matteo/base-gemini-llm
branch
from
July 17, 2026 15:03
4183734 to
1622fed
Compare
matteomedioli
force-pushed
the
matteo/split-http-client-helper
branch
from
July 17, 2026 15:07
4baa924 to
2b6a1f6
Compare
matteomedioli
force-pushed
the
matteo/base-gemini-llm
branch
from
July 17, 2026 15:07
1622fed to
6510347
Compare
…sponse-parsing logic GeminiLLM now subclasses BaseGeminiLLM and is responsible only for constructing the genai.Client; everything else (get_messages, get_messages_v2, config/schema building, tool handling, response parsing) moves to the base class unchanged. BaseGeminiLLM is exported from neo4j_graphrag.llm as a documented extension point, mirroring BaseAnthropicLLM/BaseOpenAILLM. Also sets supports_structured_output = True on the base class: GeminiLLM already implements structured output via response_schema/response_mime_type but never declared the capability flag, so callers had to patch it in manually.
Review follow-ups: - Drop the supports_structured_output=True flag flip: it changes SimpleKGPipeline/extractor default behavior for existing GeminiLLM users and belongs in its own PR with a (breaking)-labeled changelog entry, mirroring how the AnthropicLLM flag change was documented. - Replace method-identity assertions (implementation-shape tests) with a minimal BaseGeminiLLM subclass test that exercises invoke() end to end — the actual exported extension contract.
matteomedioli
force-pushed
the
matteo/split-http-client-helper
branch
from
July 17, 2026 15:21
2b6a1f6 to
5a6541c
Compare
matteomedioli
force-pushed
the
matteo/base-gemini-llm
branch
from
July 17, 2026 15:21
6510347 to
44e0906
Compare
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.
Stack
Merge order: #565 → #567 → #566 → #571 / #572 (last two in either order). Each PR builds on the previous one. Until its base merges, GitHub may show parent commits in the diff — review only the commits unique to this branch.
Description
Same split as #566, applied to Gemini.
BaseGeminiLLMholds all the shared logic: message building, config and schema building, response parsing, tool handling.GeminiLLMbecomes a thin subclass whose only job is creating thegenai.Client.BaseGeminiLLMis exported fromneo4j_graphrag.llmas a supported extension point. A subclass reaching a custom endpoint just builds its own client — everything else is inherited. A test proves the contract: a minimal subclass that only assigns a client runsinvoke()end to end.Strictly no behavior change:
supports_structured_outputflag for Gemini. That silently changes pipeline defaults for existing users, so it moved to its own PR (feat(llm): GeminiLLM declares supports_structured_output = True #573) with a proper breaking-change note. This PR stays a pure refactor.GeminiLLM's parent class changes from the two interface classes toLLMBase, which extends both — every existingisinstancecheck still passes, no deprecation warning fires, and the class gains context-manager support (with GeminiLLM(...) as llm:) like the other providers.Type of Change
Complexity
Complexity: Low
How Has This Been Tested?
Checklist