Skip to content

Conversation

@wilsonccccc
Copy link
Contributor

@wilsonccccc wilsonccccc commented Jul 23, 2025

Summary

Google recently announced that Gemini models are now accessible via an OpenAI-compatible REST API endpoint. This PR refactors our Google adapter to leverage this standardized interface, significantly simplifying the codebase by removing hundreds of lines of custom payload conversion and streaming logic.

Changes

Added

  • GeminiOpenAIAdapter - New adapter that subclasses OpenAIAdapter and automatically handles the /openai endpoint suffix
  • Auto-normalization of base URLs to ensure compatibility with Google's OpenAI endpoint

Modified

  • adapter_factory.py - Updated to use GeminiOpenAIAdapter for the "gemini" provider instead of the legacy GoogleAdapter
  • google_adapter.py - Added deprecation notice indicating this is legacy code

Removed

  • Unused GoogleAdapter import from adapter factory

@MengshiZhang MengshiZhang merged commit 1c9f395 into TensorBlock:main Jul 23, 2025
3 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.

2 participants