Skip to content

Gemini warning and version bump#2047

Draft
jxnl wants to merge 2 commits intomainfrom
cursor/gemini-warning-and-version-bump-af41
Draft

Gemini warning and version bump#2047
jxnl wants to merge 2 commits intomainfrom
cursor/gemini-warning-and-version-bump-af41

Conversation

@jxnl
Copy link
Collaborator

@jxnl jxnl commented Jan 31, 2026

fix: Lazy load google.generativeai and bump version to 1.14.6

Describe your changes

This PR addresses an issue where google.generativeai was eagerly imported during import instructor, causing a FutureWarning even when the Gemini client was not actively used.

Changes include:

  • Made the import of google.generativeai lazy within instructor/providers/gemini/client.py so it's only imported when from_gemini is called.
  • Added a regression test (tests/test_gemini_imports.py) to ensure google.generativeai is not imported at instructor module import time.
  • Bumped the package version from 1.14.5 to 1.14.6 in instructor/__init__.py and pyproject.toml.
  • Updated CHANGELOG.md to reflect the fix.
  • Updated uv.lock with dependency changes (e.g., anthropic update).

Issue ticket number and link

N/A

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests.
  • If it is a core feature, I have added documentation.

Open in Cursor Open in Web

Avoid importing google.generativeai at module import time so projects that don't use the legacy Gemini client won't see upstream FutureWarning noise.

Adds a regression test that guards against importing google.generativeai during import instructor and bumps version to 1.14.6.

Co-authored-by: jason <jason@jxnl.co>
@cursor
Copy link

cursor bot commented Jan 31, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions github-actions bot added bug Something isn't working dependencies Pull requests that update a dependency file python Pull requests that update python code size:M This PR changes 30-99 lines, ignoring generated files. labels Jan 31, 2026
Run ruff format and update uv.lock after bumping version and adding the regression test.

Co-authored-by: jason <jason@jxnl.co>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 31, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
instructor e1f3c7d Commit Preview URL

Branch Preview URL
Jan 31 2026, 02:32 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Pull requests that update a dependency file python Pull requests that update python code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants