Skip to content

Conversation

@Jeyaramjj
Copy link

@Jeyaramjj Jeyaramjj commented Nov 5, 2025

Description

Why is this change required?

This change adds Google AI (Gemini API) connector support to Agent Framework, enabling developers to use Google's Gemini models alongside existing providers (OpenAI, Azure OpenAI, Anthropic). This is the first PR in a simplified incremental delivery strategy focused on Google AI.

What problem does it solve?

Enables Agent Framework users to leverage Google's Gemini models through the Google AI API with simple API key authentication, expanding the framework's model provider support and providing access to Gemini 2.0's advanced capabilities.

What scenario does it contribute to?

  • Developers can use Google's Gemini models in Agent Framework applications
  • Multi-model applications can standardize on Agent Framework's unified interface across providers
  • Access to Gemini-specific features (thinking mode, multimodal, long context)

Simplified Delivery Strategy

Based on review feedback, this PR now focuses exclusively on Google AI (Gemini API) support. Vertex AI support is deferred to future work.

Phase 1 (This PR): Package scaffolding - Settings class, package structure, tests
Phase 2 (Future PR): GoogleAIChatClient implementation with streaming and function calling
Phase 3 (Future PR): Integration tests and usage samples
Phase 4 (Future PR): Advanced features (context caching, safety settings, structured output, thinking mode)

Implementation Details

This PR establishes the foundation for Google AI connector support:

Package Structure:

  • packages/google/ following the Anthropic connector pattern
  • Uses the new google-genai SDK (>=0.2,<1) as recommended by Google (migration guide)
  • Python 3.10-3.14 support

Settings Class:

  • GoogleAISettings: API key-based authentication with GOOGLE_AI_ environment prefix
  • Inherits from AFBaseSettings with pydantic validation
  • Environment variable support: GOOGLE_AI_API_KEY, GOOGLE_AI_CHAT_MODEL_ID

Test Coverage:

  • 5 comprehensive unit tests covering all settings scenarios
  • 100% test pass rate
  • Tests for env vars, parameters, missing values, and overrides

Documentation:

  • README with clear "coming soon" status for client implementation
  • References to official Google GenAI SDK documentation
  • Type checking support with py.typed marker file

Design Decisions

  • Simplified scope: Single GoogleAISettings class (no Vertex AI in first iteration per review feedback)
  • Modern SDK: Using google-genai (GA release) instead of legacy google-generativeai
  • Pydantic-based: Type-safe configuration with helpful validation error messages
  • Agent Framework patterns: Consistent with Anthropic/Azure AI connector architecture

Changes Addressing Review Feedback

Added Python 3.14 support (classifier in pyproject.toml)
Migrated to google-genai>=0.2,<1 (GA release, Google-recommended)
Simplified to Google AI only (removed VertexAI settings to reduce complexity)
Updated package description to "Google AI (Gemini API) integration"

Future PRs Will Add

  • GoogleAIChatClient class implementing BaseChatClient
  • Message/tool conversion methods
  • Streaming support with async
  • Function calling integration
  • Integration tests with live API calls
  • Usage samples demonstrating common scenarios
  • Advanced Gemini features (context caching, safety settings, structured output, thinking mode)

Contribution Checklist

✅ The code builds clean without any errors or warnings
✅ The PR follows the Contribution Guidelines
✅ All unit tests pass, and I have added new tests where possible (5 new tests, 100% pass rate)
✅ Is this a breaking change? No

Note

This PR intentionally does NOT include the chat client implementation - that will come in a future PR. This allows for early feedback on the package structure, SDK choice, and settings design before implementing the full client.

Jeyaram Jeyaraj and others added 3 commits November 5, 2025 09:32
This is the first PR in a series to port Google service connectors
from Semantic Kernel to Agent Framework.

Changes:
- Created agent_framework_google package structure
- Added GoogleAISettings class for Gemini API
- Added VertexAISettings class for Vertex AI
- Comprehensive test coverage (17 test cases)
- Documentation with usage examples and roadmap
- Updated .gitignore for internal dev docs

Following azure-ai connector pattern as reference (with py.typed).
Future PRs will add:
- PR microsoft#2: GoogleAIChatClient implementation
- PR microsoft#3: GoogleAI integration tests & samples
- PR microsoft#4: VertexAIChatClient implementation
- PR microsoft#5: VertexAI integration tests & samples
- PR microsoft#6: Advanced features & polish

Dependencies verified against Semantic Kernel:
- google-generativeai>=0.8,<1 (SK uses ~=0.8)
- google-cloud-aiplatform>=1.60,<2 (SK uses ~=1.114.0)
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Nov 5, 2025
@Jeyaramjj
Copy link
Author

@eavanvalkenburg FYI

…K, add Python 3.14, simplify to Google AI only

- Migrate from google-generativeai to google-genai SDK (>=0.2,<1)
- Add Python 3.14 classifier support
- Simplify to Google AI only (remove VertexAI settings and tests)
- Remove google-cloud-aiplatform dependency
- Update README to reflect Google AI focus and google-genai SDK
- Add comprehensive GAP_ANALYSIS.md with 4-phase implementation plan
- Add PR1938_CHECKLIST.md tracking review feedback and next steps
- Verify implementation against official Google migration guide
- All tests passing (5 tests, 100% coverage)

Addresses feedback from @eavanvalkenburg:
1. Added Python 3.14 support
2. Switched to google-genai (GA release, Google-recommended)
3. Removed VertexAI to simplify first iteration
Copy link
Member

@eavanvalkenburg eavanvalkenburg left a comment

Choose a reason for hiding this comment

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

I'm going to create a feature branch for this and target that

@eavanvalkenburg eavanvalkenburg changed the title Python: Add Google Vertex AI and Google AI package scaffolding Python: Add Google AI package scaffolding Nov 7, 2025
@eavanvalkenburg eavanvalkenburg changed the base branch from main to python-google November 7, 2025 08:04
@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL12822191185% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python Unit Test Overview

Tests Skipped Failures Errors Time
1703 107 💤 0 ❌ 0 🔥 32.615s ⏱️

- Export GoogleAISettings in __init__.py for public API
- Update README.md example to use SecretStr for type safety
- Comment out future code example to avoid pyright validation errors
- Auto-format code with ruff

Addresses CI feedback from PR reviewer.
@eavanvalkenburg eavanvalkenburg merged commit 851534c into microsoft:python-google Nov 7, 2025
2 checks passed
Jeyaramjj added a commit to Jeyaramjj/agent-framework that referenced this pull request Dec 12, 2025
* feat(python): Add Google AI/Vertex AI package scaffolding (1/6)

This is the first PR in a series to port Google service connectors
from Semantic Kernel to Agent Framework.

Changes:
- Created agent_framework_google package structure
- Added GoogleAISettings class for Gemini API
- Added VertexAISettings class for Vertex AI
- Comprehensive test coverage (17 test cases)
- Documentation with usage examples and roadmap
- Updated .gitignore for internal dev docs

Following azure-ai connector pattern as reference (with py.typed).
Future PRs will add:
- PR microsoft#2: GoogleAIChatClient implementation
- PR microsoft#3: GoogleAI integration tests & samples
- PR microsoft#4: VertexAIChatClient implementation
- PR microsoft#5: VertexAI integration tests & samples
- PR microsoft#6: Advanced features & polish

Dependencies verified against Semantic Kernel:
- google-generativeai>=0.8,<1 (SK uses ~=0.8)
- google-cloud-aiplatform>=1.60,<2 (SK uses ~=1.114.0)

* refactor: align with Anthropic pattern - use location, chat_model_id, and version fields for Google settings

* Address PR microsoft#1938 review comments: migrate to google-genai SDK, add Python 3.14, simplify to Google AI only

- Migrate from google-generativeai to google-genai SDK (>=0.2,<1)
- Add Python 3.14 classifier support
- Simplify to Google AI only (remove VertexAI settings and tests)
- Remove google-cloud-aiplatform dependency
- Update README to reflect Google AI focus and google-genai SDK
- Add comprehensive GAP_ANALYSIS.md with 4-phase implementation plan
- Add PR1938_CHECKLIST.md tracking review feedback and next steps
- Verify implementation against official Google migration guide
- All tests passing (5 tests, 100% coverage)

Addresses feedback from @eavanvalkenburg:
1. Added Python 3.14 support
2. Switched to google-genai (GA release, Google-recommended)
3. Removed VertexAI to simplify first iteration

* fix: Address pre-commit hooks failures

- Export GoogleAISettings in __init__.py for public API
- Update README.md example to use SecretStr for type safety
- Comment out future code example to avoid pyright validation errors
- Auto-format code with ruff

Addresses CI feedback from PR reviewer.

---------

Co-authored-by: Jeyaram Jeyaraj <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants