Add Google Gemini API Support to MEQ-Bench#11
Merged
Conversation
This commit enhances the MEQ-Bench framework by adding support for Google Gemini models in the run_benchmark.py script. **Key Features:** - New `_create_gemini_model()` function with comprehensive error handling - Integration with existing `create_model_function()` factory pattern - Proper API key validation (GOOGLE_API_KEY environment variable) - Retry mechanism with exponential backoff for API calls - Safety filter configuration for medical content - Comprehensive logging and error recovery **Usage:** ```bash # Set API key export GOOGLE_API_KEY="your_api_key_here" # Run evaluation with Gemini Pro python run_benchmark.py --model_name gemini:gemini-pro --max_items 100 # Run with Gemini Pro Vision (for future multimodal support) python run_benchmark.py --model_name gemini:gemini-pro-vision --max_items 50 ``` **Technical Implementation:** - Follows existing code patterns from OpenAI and Anthropic integrations - Uses google-generativeai library with proper import error handling - Implements same retry and logging patterns as other API backends - Maintains consistent function signatures and error handling - Updates all documentation strings and help text **Dependencies:** - Requires `google-generativeai` library: `pip install google-generativeai` - Requires GOOGLE_API_KEY environment variable - API key available from: https://makersuite.google.com/app/apikey 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the MEQ-Bench framework by adding comprehensive support for Google Gemini models in the
run_benchmark.pyscript. The implementation follows the existing patterns used for OpenAI and Anthropic APIs, ensuring consistency and maintainability.✨ Key Features
_create_gemini_model()function with robust error handlingcreate_model_function()factoryGOOGLE_API_KEYenvironment variable🚀 Usage Examples
📋 Supported Gemini Models
gemini-pro- Standard text generation modelgemini-pro-vision- Multimodal model (text + images)🔧 Technical Implementation Details
Follows Established Patterns:
Robust Error Handling:
google-generativeailibrarySafety & Medical Content:
📚 Documentation Updates
create_model_function()documentation📦 Dependencies
Required:
google-generativeailibrary:pip install google-generativeaiGOOGLE_API_KEYenvironment variableAPI Key Setup:
🧪 Testing
The implementation has been tested for:
🔄 Backward Compatibility
📝 Code Quality
🎯 Benefits for MEQ-Bench Users
This enhancement significantly expands MEQ-Bench's capabilities while maintaining the high standards of reliability and usability established by the existing codebase.
🤖 Generated with Claude Code