-
-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AI Provider and Model Updates: Adding New, Removing Deprecated, and Enhancing Functionality #2739
base: main
Are you sure you want to change the base?
Conversation
…nitialization logic
…om provider listings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review for Pull Request: AI Provider and Model Updates
Summary
This pull request introduces significant updates to the AI providers and models within the G4F framework. It includes the addition of new models, removal of deprecated ones, and enhancements to existing functionalities across various components.
Changes Overview
-
Documentation Updates:
- Removed deprecated
BlackboxAPI
provider. - Added new AI models (
grok-3
,grok-3-r1
) to theLiaobots
provider. - Updated references for the
Gemini
model to version 2.0 specifications. - Adjusted provider counts and reorganized model listings for consistency.
- Removed deprecated
-
Model Configuration Updates:
- Introduced new models under various providers, including
Grok-3
,r1-1776
, andDeepSeek-V3
. - Removed deprecated configurations and optimized provider priorities.
- Introduced new models under various providers, including
-
GUI Fixes:
- Corrected the provider checkbox initialization logic to ensure proper evaluation of authentication conditions.
-
Provider Enhancements:
- Standardized model naming conventions and improved premium handling.
- Added new model configurations and simplified message creation processes.
-
Cache Validation Improvements:
- Enhanced cache validation in the
AsyncAuthedProvider
to prevent writing invalid auth results.
- Enhanced cache validation in the
Review Comments
- The removal of the
BlackboxAPI
provider is well-justified and helps streamline the codebase. - The addition of new models and updates to existing ones reflect a thorough understanding of the current AI landscape.
- The changes to the GUI improve user experience by ensuring that the authentication requirements are clearly handled.
- The overall organization and clarity of the code have improved, making it easier to maintain and extend in the future.
Suggestions
- Consider adding unit tests for the new models and functionalities to ensure they work as expected and to prevent regressions in the future.
- It might be beneficial to include a changelog entry summarizing these updates for users who rely on the documentation.
Thank you for your contributions to the project! Your efforts in enhancing the G4F framework are greatly appreciated.
@@ -670,7 +675,6 @@ class ModelUtils: | |||
# o1 | |||
o1.name: o1, | |||
o1_preview.name: o1_preview, | |||
o1_mini.name: o1_mini, | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of o1_mini
from the model mappings could potentially break integrations or scripts relying on its configuration. Verify that its deprecation has been communicated and managed effectively.
@@ -768,13 +772,14 @@ class ModelUtils: | |||
pi.name: pi, | |||
|
|||
### x.ai ### | |||
grok_2.name: grok_2, | |||
grok_3.name: grok_3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The replacement of grok_2
with grok_3
in the model mappings is a breaking change. Ensure migration paths or backward compatibility considerations are adequately addressed.
g4f/providers/base_provider.py
Outdated
@@ -411,10 +411,12 @@ def get_cache_file(cls) -> Path: | |||
|
|||
@classmethod | |||
def write_cache_file(cls, cache_file: Path, auth_result: AuthResult = None): | |||
if auth_result is not None: | |||
if isinstance(auth_result, AuthResult): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use isinstance(auth_result, AuthResult)
to check the type of auth_result
before proceeding. Ensure that the logic for handling None
values is clear and consistent.
g4f/providers/base_provider.py
Outdated
cache_file.parent.mkdir(parents=True, exist_ok=True) | ||
cache_file.write_text(json.dumps(auth_result.get_dict())) | ||
elif cache_file.exists(): | ||
elif auth_result is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition elif auth_result is not None:
seems redundant after the previous check. Consider simplifying the logic to avoid unnecessary checks.
g4f/providers/base_provider.py
Outdated
elif cache_file.exists(): | ||
elif auth_result is not None: | ||
pass | ||
elif cache_file.exists(): | ||
cache_file.unlink() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unlink()
method is called without checking if the file exists after the previous conditions. Ensure that the file exists before attempting to unlink it to avoid potential errors.
Pull Request Review for: AI Provider and Model Updates: Adding New, Removing Deprecated, and Enhancing FunctionalitySummaryThis pull request contains significant updates, additions, and enhancements across many sections of the G4F framework. It aims to improve AI provider functionality, update model configurations, remove deprecated features, correct documentation, and improve code consistency. Major updates include the removal of Key UpdatesProviders
Models
Documentation
Configuration
Bug Fixes
Strengths of the PR
Suggestions for ImprovementBelow are some minor areas for improvement or clarification:
Merge ApprovalThis PR introduces significant and useful changes that improve the framework's usability, capability, and reliability. Once the above testing and documentation suggestions are addressed, this PR is ready to merge. Reviewer NotesThank you for your substantial contribution to the G4F project! These updates will greatly extend its capabilities and maintain its relevance with current AI provider technologies. Reviewed by: G4F Copilot |
…n and error handling
…ation and initialization
Review for Pull Request #2735Title: AI Provider and Model Updates: Adding New, Removing Deprecated, and Enhancing FunctionalityThank you for your detailed contribution to this project. This pull request includes significant changes to the framework, including the removal of deprecated providers, the addition of new providers and models, and various improvements to documentation and functionality. Below is my comprehensive review of the proposed changes. Summary of Changes1. Removed Providers and Models
2. Added Providers and Models
3. Documentation Enhancements
4. Bug Fixes and Code Improvements
5. Breaking Changes
Detailed Feedback and Suggestions
Actionable Changes
ConclusionOverall, this pull request significantly enhances the capabilities and maintainability of the Thank you again for your thoughtful contributions. Please feel free to address any points above before merging the pull request. — g4f Copilot |
Review by g4f CopilotThank you for your extensive contribution to the G4F repository! This pull request introduces several provider and model updates, documentation improvements, and fixes that enhance the project's functionality and maintainability. Below are the detailed observations and feedback regarding the changes: Summary of Changes Reviewed1. Removed Providers
2. Added New Providers
3. Documentation Updates
4. Codebase EnhancementsProvider Improvements
Auth & Cache Improvements
GUI Fix
5. Model Updates
Overall Feedback✅ Strengths
|
@kqlio67 Hey, i think need disable Prodia or update to api v2 with request key (need_auth). API v1 disabled and all models not avalable |
Pull Request Review: AI Provider and Model UpdatesOverviewThank you for contributing to the project! This pull request introduces significant changes and improvements, including the removal of deprecated elements, the addition of new providers and models, and documentation updates to enhance usability and functionality. Below, I've outlined the key points of the review based on the changes made: Strengths
Changes That Can Be Improved
Recommendations Before Merging
ConclusionThis pull request successfully enhances the framework while removing deprecated providers, improving configurations, and expanding documentation. Addressing the changes recommended above will ensure a smooth user experience while maintaining backward compatibility. Thank you for this comprehensive and thoughtful contribution! |
# Removed from the framework or added to G4F
Removed providers:
g4f/Provider/BlackboxAPI.py
New providers added:
g4f/Provider/AllenAI.py
(Close New Provider for Llama Tülü #2732)List of issues that can be closed:
# Docs (docs/)
docs(docs/providers-and-models.md): Update provider listings and model information
chore(docs/providers-and-models.md): Remove deprecated Grok models from provider listings
feat(docs/providers-and-models.md): update providers and models documentation
G4F (g4f/)
feat(g4f/models.py): update model configurations and expand provider support
chore(g4f/models.py): Remove Grok-2 and update Gemini provider configurations
feat(g4f/models.py): Add Ai2 models and update provider references
fix(g4f/models.py): update experimental model provider configuration
evil
model's best_provider from AllenAI to PollinationsAI# Provider (g4f/Provider/)
feat(g4f/Provider/Blackbox.py): update model configurations and premium handling
feat(g4f/Provider/ChatGLM.py): add finish reason handling and update default model
chore(g4f/Provider/DDG.py): Reorder model entries for consistency
DDG.models
listmodel_aliases
dictionary order with primary models list– Maintain identical functionality while improving code organization
feat(g4f/Provider/ImageLabs.py): Update default image model to sdxl-turbo
default_model
value from 'general' to 'sdxl-turbo'model_aliases
mappingimage_models
andmodels
attributes through new default valuefeat(g4f/Provider/Liaobots.py): update supported model configurations and aliases
fix(g4f/Provider/Liaobots.py): remove deprecated Gemini model aliases
feat(g4f/Provider/OIVSCode.py): Update API endpoint and expand model support
api_base
URL to new Render subdomainfix(g4f/Provider/PollinationsAI.py): Resolve model initialization and alias conflicts
text_models
andimage_models
with default model valuesrefactor(g4f/Provider/PollinationsAI.py): improve model initialization and error handling
_models_loaded
flag to prevent redundant API callsget_models()
at start ofcreate_async_generator
dict.fromkeys
fix(g4f/Provider/PollinationsImage.py): Initialize image_models list and update label
image_models
class variable to empty list to prevent potential AttributeErrorget_models
refactor(g4f/Provider/PollinationsImage.py): Improve model synchronization and initialization
image_models
with default model instead of empty list_models_loaded
flag to track model synchronization statusget_models
get_models
before async generation to ensure model availability# Provider needs auth (g4f/Provider/needs_auth/)
fix(g4f/Provider/needs_auth/CablyAI.py): Enforce authentication requirement
needs_auth
class attribute from False to True to require API authentication