feat: Migrate Gemini SDK to google-genai (#231) #236

Merged
egullickson merged 8 commits from issue-231-migrate-gemini-sdk-google-genai into main 2026-03-01 04:08:11 +00:00
Owner

Fixes #231
Fixes #232
Fixes #233
Fixes #234
Fixes #235

Summary

Migrate OCR service from deprecated google-cloud-aiplatform / vertexai.generative_models SDK to google-genai package. Enable Google Search grounding for VIN decode to improve accuracy.

Changes

  • M1 (#232): Swap google-cloud-aiplatform>=1.40.0 to google-genai>=1.0.0 in requirements.txt
  • M2 (#233): Migrate GeminiEngine -- _get_model() to _get_client(), client-per-call pattern, Google Search grounding for VIN decode, uppercase schema types
  • M3 (#234): Migrate MaintenanceReceiptExtractor -- same pattern, fix RuntimeError bug to use GeminiUnavailableError
  • M4 (#235): Update test mocks -- engine._client/engine._model_name pattern, clean up dead code
  • M5: Doc-sync on affected CLAUDE.md files and config.py comment

Test Results

  • Docker build: SUCCESS
  • 18/18 gemini engine tests: PASS
  • All VIN decode tests: PASS (unchanged)
  • All manual extractor tests: PASS (unchanged)

Remaining Verification

  • Deploy to staging and decode VIN 1G1YE2D32P5602473 to confirm correct 2023 Corvette data with Google Search grounding
Fixes #231 Fixes #232 Fixes #233 Fixes #234 Fixes #235 ## Summary Migrate OCR service from deprecated `google-cloud-aiplatform` / `vertexai.generative_models` SDK to `google-genai` package. Enable Google Search grounding for VIN decode to improve accuracy. ### Changes - **M1 (#232)**: Swap `google-cloud-aiplatform>=1.40.0` to `google-genai>=1.0.0` in requirements.txt - **M2 (#233)**: Migrate `GeminiEngine` -- `_get_model()` to `_get_client()`, client-per-call pattern, Google Search grounding for VIN decode, uppercase schema types - **M3 (#234)**: Migrate `MaintenanceReceiptExtractor` -- same pattern, fix RuntimeError bug to use GeminiUnavailableError - **M4 (#235)**: Update test mocks -- `engine._client`/`engine._model_name` pattern, clean up dead code - **M5**: Doc-sync on affected CLAUDE.md files and config.py comment ### Test Results - Docker build: SUCCESS - 18/18 gemini engine tests: PASS - All VIN decode tests: PASS (unchanged) - All manual extractor tests: PASS (unchanged) ### Remaining Verification - Deploy to staging and decode VIN `1G1YE2D32P5602473` to confirm correct 2023 Corvette data with Google Search grounding
egullickson added 5 commits 2026-02-28 17:22:59 +00:00
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace vertexai.generative_models with google.genai client pattern.
Add Google Search grounding tool to VIN decode for improved accuracy.
Convert response schema types to uppercase per Vertex AI Schema spec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace vertexai.generative_models with google.genai client pattern.
Fix pre-existing bug: raise GeminiUnavailableError instead of bare
RuntimeError for missing credentials. Add proper try/except blocks
matching GeminiEngine error handling pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace engine._model/engine._generation_config mocks with
engine._client/engine._model_name. Update sys.modules patches
from vertexai to google.genai. Remove dead if-False branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
docs: update CLAUDE.md references from Vertex AI to google-genai (refs #231)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 8m4s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 24s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
96e1dde7b2
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
egullickson added 1 commit 2026-02-28 18:02:34 +00:00
fix: VIN Decoding timeouts and logic errors
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m33s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 52s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
936753fac2
egullickson added 1 commit 2026-02-28 18:59:11 +00:00
fix: remove unsupported AutomaticFunctionCallingConfig parameter (refs #231)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 39s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 53s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
1add6c8240
The installed google-genai version does not support max_remote_calls on
AutomaticFunctionCallingConfig, causing a pydantic validation error that
broke VIN decode on staging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
egullickson added 1 commit 2026-03-01 03:17:00 +00:00
fix: revert unsupported AFC config and add diagnostic logging for VIN decode (refs #231)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 12m33s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 52s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
56df5d48f3
- Remove AutomaticFunctionCallingConfig(max_remote_calls=3) which caused
  pydantic validation error on the installed google-genai version
- Log full Gemini raw JSON response in OCR engine for debugging
- Add engine/transmission to backend raw values log
- Add hasTrim/hasEngine/hasTransmission to decode success log

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
egullickson merged commit 7e2bb9ef36 into main 2026-03-01 04:08:11 +00:00
egullickson deleted branch issue-231-migrate-gemini-sdk-google-genai 2026-03-01 04:08:12 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#236