feat: Upgrade Gemini Provider to v3.0 (Official SDK, Rate Limits, Deep Normalization)#60
Open
Foadsf wants to merge 11 commits into
Open
feat: Upgrade Gemini Provider to v3.0 (Official SDK, Rate Limits, Deep Normalization)#60Foadsf wants to merge 11 commits into
Foadsf wants to merge 11 commits into
Conversation
….0 models - Replaced raw HTTP calls with `@google/generative-ai` SDK in `GeminiProvider`. - Removed axios dependency from `GeminiProvider`. - Updated `GeminiProvider` to support `sendMessage` and `analyzeImage` using the new SDK. - Updated `src/setup-wizard.ts` to replace Gemini 1.5 options with Gemini 3.0 Pro and Flash. - Set `gemini-3.0-pro` as the default Gemini model. - Added `@google/generative-ai` dependency to `package.json`.
- Upgraded `GeminiProvider` to use `@google/generative-ai` SDK. - Removed `axios` usage from `GeminiProvider`. - Updated `setup-wizard` to support Gemini 3.0 Pro/Flash and custom model entry. - Added `scripts/list-gemini-models.js` to debug available models. - Added `npm run list-models` script. - Improved error handling to suggest checking available models on 404 errors.
- Upgraded `GeminiProvider` to use `@google/generative-ai` SDK. - Implemented content truncation (800k chars) in `GeminiProvider` to prevent 429 quota errors. - Added dynamic model fetching in `setup-wizard` using `getGeminiModels`. - Refactored `scripts/list-gemini-models.js` to be reusable and added `npm run list-models` script. - Added support for custom Gemini model IDs in setup wizard. - Removed `axios` usage from `GeminiProvider`.
- Migrated `GeminiProvider` to use `@google/generative-ai` SDK (removing axios). - Implemented robust retry logic with smart backoff for 429 errors (parsing retry duration). - Added `MAX_FREE_TIER_CHARS` (400k) truncation to prevent quota limits on large files. - Updated `setup-wizard` to dynamically fetch models using `getGeminiModels` shared from scripts. - Added `scripts/list-gemini-models.js` and `npm run list-models` for diagnostics. - Added support for custom Gemini model IDs.
- Migrated `GeminiProvider` to `@google/generative-ai` SDK. - Implemented `MAX_FREE_TIER_CHARS` (400k) truncation to prevent quota errors. - Added smart retry logic with backoff (parsing API wait times) for 429 errors. - Enforced JSON output via `responseMimeType` and added a Markdown stripper. - Updated `setup-wizard` to dynamically fetch models and support custom IDs. - Added `scripts/list-gemini-models.js` and `npm run list-models` diagnostic.
…tion - Migrated `GeminiProvider` to `@google/generative-ai` SDK (removed axios). - Implemented `MAX_FREE_TIER_CHARS` (400k) truncation to prevent quota errors. - Added smart retry logic with backoff (parsing API wait times) for 429 errors. - Enforced strict JSON output with `responseMimeType`, system instructions, and a response normalizer (unwrapping nested objects/mapping keys). - Updated `setup-wizard` to dynamically fetch models and support custom IDs. - Added `scripts/list-gemini-models.js` and `npm run list-models` diagnostic.
…alization - Migrated `GeminiProvider` to `@google/generative-ai` SDK (removed axios). - Implemented `MAX_FREE_TIER_CHARS` (400k) truncation to prevent quota errors. - Added smart retry logic with backoff (parsing API wait times) for 429 errors. - Enforced strict JSON output with `responseMimeType`, system instructions, and deep recursive normalization (unwrapping nested objects/mapping keys). - Updated `setup-wizard` to dynamically fetch models and support custom IDs. - Added `scripts/list-gemini-models.js` and `npm run list-models` diagnostic.
- Migrated `GeminiProvider` to `@google/generative-ai` SDK (removed axios). - Implemented `MAX_FREE_TIER_CHARS` (400k) truncation to prevent quota errors. - Added smart retry logic with backoff (parsing API wait times) for 429 errors. - Enforced strict JSON output with `responseMimeType`, system instructions, and deep normalization. - Updated `setup-wizard` to dynamically fetch models and support custom IDs. - Fixed JSON validation failures by updating `multi-call-analyzer` to accept standardized keys (`file_title`) produced by the normalized Gemini provider. - Added `scripts/list-gemini-models.js` and `npm run list-models` diagnostic.
- Migrated `GeminiProvider` to `@google/generative-ai` SDK (removed axios). - Implemented `MAX_FREE_TIER_CHARS` (400k) truncation to prevent quota errors. - Added smart retry logic with backoff (parsing API wait times) for 429 errors. - Enforced strict JSON output with `responseMimeType`, system instructions, and deep normalization. - Added synthesis of `suggestedPath` and `suggestedFilename` if missing from LLM response. - Updated `setup-wizard` to dynamically fetch models and support custom IDs. - Fixed JSON validation compatibility in `multi-call-analyzer` for Gemini's normalized keys. - Added `scripts/list-gemini-models.js` and `npm run list-models` diagnostic.
Author
|
FYI this tweet. |
- Migrated `GeminiProvider` to `@google/generative-ai` SDK (removed axios). - Implemented `MAX_FREE_TIER_CHARS` (400k) truncation to prevent quota errors. - Added smart retry logic with backoff (parsing API wait times) for 429 errors. - Enforced strict JSON output with `responseMimeType`, system instructions, and deep normalization. - Aligned output schema exactly with `multi-call-analyzer` requirements (`title` vs `file_title`). - Added synthesis of `suggestedPath` and `suggestedFilename` if missing. - Updated `setup-wizard` to dynamically fetch models and support custom IDs. - Fixed JSON validation compatibility in `multi-call-analyzer`. - Added `scripts/list-gemini-models.js` and `npm run list-models` diagnostic.
- Migrated `GeminiProvider` to `@google/generative-ai` SDK (removed axios). - Implemented `MAX_FREE_TIER_CHARS` (400k) truncation and `maxOutputTokens` (8192) to prevent errors. - Added smart retry logic with backoff (parsing API wait times) for 429 errors. - Enforced strict JSON output with `responseMimeType`, system instructions, deep normalization, and repair logic for malformed JSON. - Fixed image processing regression by correctly routing image files to `analyzeImage` instead of text processing. - Added `FileLogger` for persistent per-file debugging logs. - Updated `setup-wizard` to dynamically fetch models. - Fixed JSON validation schema mismatch in `multi-call-analyzer`. - Added `scripts/list-gemini-models.js` diagnostic.
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.
This PR represents a comprehensive upgrade of the Google Gemini provider to support the Gemini 3.0 family (Pro/Flash) and address critical stability issues found in the
v1betaHTTP implementation.🚀 Key Changes
1. Official SDK Migration
axioscalls with the official@google/generative-aiSDK.2. Stability & Rate Limiting
retry-afterheader. This fixes the infinite loop of429 Too Many Requestserrors.3. Output Reliability (The "Deep Normalization" Fix)
application/jsonmode.title,filename) to the application's required schema (file_title).suggestedPathif the LLM omits it, preventing validation failures.4. User Experience
npm run list-modelsto help users debug API key access levels.Verification
Tested locally with large technical PDF manuals (85MB+) that previously failed with Quota/Parsing errors. The new provider successfully truncates, waits for rate limits, normalizes the nested JSON, and organizes the files.