Skip to content

refactor(providers): update google SDK to google-genai and model to gemini-2.5-flash-lite#91

Merged
djcopley merged 1 commit intodjcopley:mainfrom
thaikolja:main
Mar 7, 2026
Merged

refactor(providers): update google SDK to google-genai and model to gemini-2.5-flash-lite#91
djcopley merged 1 commit intodjcopley:mainfrom
thaikolja:main

Conversation

@thaikolja
Copy link
Contributor

Okay, here we have a much cleaner PR focusing only on Google

Description

This PR addresses the outdated Google SDK issue by migrating the Google provider from the deprecated google-generativeai library to the official, supported google-genai SDK. It also updates the default model from the deprecated gemini-2.0 family to gemini-2.5-flash-lite.

Changes Made

  • Dependencies: Replaced google-generativeai~=0.8 with google-genai>=0.3.0 in pyproject.toml. Added SDK updates to uv.lock.
  • Provider Implementation: Refactored src/shelloracle/providers/google.py to use genai.Client and the asynchronous client.aio.models.generate_content_stream method. Updated default model to gemini-2.5-flash-lite.
  • Stream Handling: Updated the async generator to properly validate and yield chunk.text.

Testing

  • Dependency resolution and lockfile synchronization (uv sync)
  • Passed existing automated testing suite (uv run pytest)
  • Passed type boundaries (uv run hatch run types:check)

uv hatch run types:check Output:

Success: no issues found in 20 source files
Success: no issues found in 9 source files

uv run pytest Output:

============================= test session starts ==============================
platform darwin -- Python 3.13.12, pytest-8.4.2, pluggy-1.6.0
rootdir: /Users/kolja/Coding/Python/ShellOracle
configfile: pyproject.toml
plugins: anyio-4.12.1, cov-5.0.0, xdist-3.8.0, httpx-0.35.0, sugar-1.1.1, asyncio-0.26.0
asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collected 36 items

tests/providers/test_deepseek.py ....                                    [ 11%]
tests/providers/test_localai.py ...                                      [ 19%]
tests/providers/test_ollama.py ......                                    [ 36%]
tests/providers/test_openai.py ....                                      [ 47%]
tests/providers/test_xai.py ....                                         [ 58%]
tests/test_config.py ........                                            [ 80%]
tests/test_shelloracle.py .......                                        [100%]

============================== 36 passed in 0.74s ==============================

Related Issues

- Change package dependency from google-generativeai to google-genai
- Update default model name to gemini-2.5-flash-lite
- Refactor API client initialization and content generation logic
Copilot AI review requested due to automatic review settings March 5, 2026 17:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@djcopley djcopley self-requested a review March 7, 2026 03:53
Copy link
Owner

@djcopley djcopley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@djcopley djcopley merged commit 4b33787 into djcopley:main Mar 7, 2026
6 of 7 checks passed
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.

Bug: google.generativeai is no longer operational

3 participants