feat(llmhubs): support tool calling and structured output in the Gemi…#45
Open
xinkuleee wants to merge 1 commit into
Open
feat(llmhubs): support tool calling and structured output in the Gemi…#45xinkuleee wants to merge 1 commit into
xinkuleee wants to merge 1 commit into
Conversation
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.
Summary
Adds Google Gemini function/tool calling and JSON-schema structured output to the
LLMHub Gemini adapter, so Gemini models can drive the chat agent (tools) and
structured routing (intent check).
tools/function_call/function_resultto GeminifunctionDeclarations/functionCall/functionResponse(role mappingassistant→model/tool→user, andcall_id↔function-name correlation since Gemini responses carry no call id);parse Gemini
functionCallback intofunction_calloutputs.OpenAPI-subset — inline
$ref/$defs, dropadditionalProperties/$schema,flatten single-element
allOf, and convert OptionalanyOf+{"type":"null"}to
nullable.response_format.type=json_schemato GeminiresponseMimeType+responseSchema(fixes chat intent-check routing on Gemini).supports_tools/supports_structured_outputfor the Gemini provider (core
io_profilederivation + backend equivalent).sanitizer (refs/defs/additionalProperties/allOf/anyOf-null/recursion), and
structured output.
Validation
make precommit-runcd backend && go test ./...cd core && uv run pytestFrontend is untouched, so its build/lint does not apply.
Checklist
CHANGELOG.mdunder## [Unreleased]for user-facing changes.Notes for reviewers
non-streaming path (
generate_streamyields a single chunk). Tool calling works,but without incremental token streaming; a follow-up can add
streamGenerateContent?alt=sse.against the full builtin tool set and the structured intent-check schema.
local default-model switch are gitignored and intentionally excluded from this PR.