Repository navigation
feat(model): add native Gemini chat integration - #54
Draft
nanami7777777 wants to merge 1 commit into
Draft
nanami7777777 wants to merge 1 commit into
nanami7777777 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.
Linked Issues
Closes #7. Related to the provider portion of #49.
PR #42 references #7 but implements Grok, not Gemini. This PR implements the Gemini scope requested in #7 against current upstream main.
Description
Add
GeminiChatModelandGeminiChatFormatterusing the native Gemini Developer API REST endpoints, following the existing fetch-based provider architecture.auto,none,requiredand named tool choice; function declarations retain their JSON Schema usingparametersJsonSchema.thought_signature; unsigned existing blocks are unchanged.The tests include an actual
Agent+Toolkitlifecycle with mocked Gemini HTTP responses: the agent executes a returned function, then sends its result and the original signature in the next model request. Additional tests cover serialized history, parallel results, structured output, fragmented UTF-8/CRLF SSE, late signatures, terminal usage, cancellation and errors.Verification
pnpm --filter @agentscope-ai/agentscope exec jest --runInBand --silent: 21 suites, 145 tests passed.pnpm --filter @agentscope-ai/agentscope build: CJS, ESM and declarations passed.pnpm build:desktop: type checks and build passed.git diff --check: passed.Build emits the repository's existing message-barrel declaration-cycle warnings; no unrelated package-boundary refactor is included.
Scope and limitations
This implements the Gemini Developer API, not Vertex AI or the Interactions API. It uses the first response candidate. Function arguments are received as complete objects; experimental partial function-argument streaming is outside this PR. File URLs are passed as Gemini file URIs, not fetched automatically. Unit and integration tests use mocked HTTP responses; no credentialed live Gemini call was performed.
Prepared with Codex assistance. Submitted as a draft for contribution-author review and maintainer feedback, including coordination with #49.
Checklist