Skip to content

fix(gemini): honor generation settings and add Jsonnet API coverage - #667

Open
QIU-Guanzong wants to merge 1 commit into
arakoodev:tsfrom
QIU-Guanzong:fix/gemini-http-jsonnet
Open

QIU-Guanzong wants to merge 1 commit into
arakoodev:tsfrom
QIU-Guanzong:fix/gemini-http-jsonnet

Conversation

@QIU-Guanzong

Copy link
Copy Markdown

/claim #279

The existing Gemini client ignores the selected model and sends generation settings as Axios options, so Google never receives them. This fixes the direct HTTP client and completes the Jsonnet example and API tests requested in #279, following the maintainer's clarification to use Gemini without wrapping the Google SDK.

  • Send the selected model and a typed generationConfig, preserving values such as temperature: 0.
  • Export the request/response types, validate request options, bound transient retries and avoid retrying permanent failures. Safety feedback is preserved when the response has no candidates.
  • Add tests under testcases/palm2 and a runnable gemini-chat example. Prompts and generation settings are evaluated from Jsonnet.
  • Exercise the example through an actual local HTTP endpoint and a second HTTP server that records the Gemini request. The tests cover generation settings, retry/error behavior and split UTF-8 request bodies.

Validation

Node 22.23.3: all 21 focused tests pass. The SDK build, strict TypeScript check of the test file, formatting and git diff --check also pass. The rest of the suite was not run because it depends on external services.

cd JS/edgechains/arakoodev
npm run build
npm run test:palm2

Demo

20-second test-output replay and transcript. The published asset hashes match the locally verified files.

This records the real local integration test. The second server supplies deterministic fixture responses; no Google API request was made. The example also supports an account-provided model and API key for live use, but Google authentication, current model availability and live generation remain unverified.

PALM2_DEMO=1 npm run test:palm2 -- -t 'runs the Jsonnet HTTP example'

The sample API binds to localhost and has no public-deployment authentication. A model must be supplied by the caller or GEMINI_MODEL; it no longer silently targets the hardcoded gemini-pro endpoint.

AI assistance: implementation, tests and an additional source review were prepared with OpenAI Codex.

@github-actions

Copy link
Copy Markdown

CLA Assistant Lite bot: Thank you for your submission, we really appreciate it. Before we can accept your contribution, we ask that you sign the Arakoo Contributor License Agreement. You can sign the CLA by adding a new comment to this pull request and pasting exactly the following text.


I have read the Arakoo CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@QIU-Guanzong

Copy link
Copy Markdown
Author

I have read the Arakoo CLA Document and I hereby sign the CLA

@QIU-Guanzong

Copy link
Copy Markdown
Author

recheck

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.

2 participants