-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
(docs,providers,client): major update to providers, docs and client APIs #2501
Conversation
…ate model listings - Add new HuggingSpace provider with flux-dev and flux-schnell image model support - Update flux-schnell provider count from 2+ to 1+ in image models table - Add missing streaming support indicator for HuggingSpace provider - Maintain consistent table formatting and status badge styling
…odel mappings - Add HuggingSpace provider to available providers list with flux model support - Update flux-dev model to use new HuggingSpace provider - Add flux-schnell model with HuggingSpace provider support - Reorganize model-provider mappings for consistency
- Add HuggingSpace provider class with automatic model initialization - Implement async generator functionality for model execution - Add support for dynamic provider and model registration - Add type hints and future annotations for Python compatibility BREAKING CHANGE: New provider requires initialization at import time
- Add error handling and fallback logic for model fetching - Add default empty lists for models and image_models class attributes - Add get_model helper method to handle model alias resolution - Remove urllib3 warnings suppression for cleaner implementation
- Add alternative endpoint support with automatic failover - Add exponential backoff retry mechanism with configurable params - Add response validation and error handling for empty responses - Remove redundant imports and optimize error handling flow BREAKING CHANGE: Provider now requires max_retries and delay parameters
- Add new Blackbox2 provider with simplified endpoint structure - Add separate text and image generation workflows - Add robust validation and caching mechanisms - Add configurable retry logic with exponential backoff BREAKING CHANGE: New provider uses different API endpoints and validation flow
… support - Add support for message streaming with event parsing - Add new Llama 3.3 models to supported model list - Add auth and message support flags - Add dedicated chat completions endpoint BREAKING CHANGE: Provider now requires streaming support
- Add support for both text and image generation - Add model caching and dynamic model fetching - Add configurable parameters for image generation - Add streaming support for text generation BREAKING CHANGE: Provider requires API key and model initialization
- Add default_image_model attribute for consistency - Add optional seed parameter with random generation - Add type hint for seed parameter - Improve code organization and readability BREAKING CHANGE: Seed parameter now accepts Optional[int] instead of str
…ration - Replace hardcoded chat model list with default_model reference - Remove duplicate model definition in chat_models list - Improve code readability and maintainability - Reduce potential for model list inconsistencies
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 provided code appears to be a diff output from a version control system, showing changes made to a Python project that involves various AI models and their providers. Below is a summary of the key changes and additions made in the code:
Summary of Changes:
-
Blackbox2 Provider Updates:
- Refactored methods to handle a validated value instead of a license key.
- Improved error handling and retry logic for fetching the validated value.
- Added a new method
fetch_validated
to retrieve the validated value from the cache or the website.
-
DeepInfraChat Provider Enhancements:
- Added support for streaming responses.
- Improved the method for creating async generators to handle streaming data.
-
HuggingSpace Provider:
- Introduced a new provider that aggregates models from various Hugging Face spaces.
- Automatically initializes models, aliases, and API endpoints from all providers in the Hugging Face space.
-
PollinationsAI Provider:
- Enhanced the model fetching logic to ensure models are not cached unnecessarily.
- Improved the image and text generation methods to handle parameters more effectively.
-
Prodia Provider:
- Added random seed generation for image generation.
- Improved the handling of model parameters.
-
New Providers:
- Introduced
BlackForestLabsFlux1Dev
,BlackForestLabsFlux1Schnell
, andVoodoohopFlux1Schnell
as new providers for image generation. - Each new provider has its own API endpoint and methods for generating images.
- Introduced
-
General Improvements:
- Enhanced error handling across various providers.
- Improved the structure and readability of the code.
- Added type hints and docstrings for better clarity and maintainability.
Key Features:
- Asynchronous Processing: The code heavily utilizes asynchronous programming to handle requests and responses efficiently.
- Dynamic Model Handling: The providers can dynamically fetch and handle different models based on user input.
- Error Handling: Improved error handling mechanisms to ensure robustness in API interactions.
- Streaming Support: Some providers now support streaming responses, allowing for real-time data processing.
Conclusion:
These changes enhance the functionality and reliability of the AI model providers, making it easier to integrate and use various models for text and image generation tasks. The introduction of new providers and improvements in existing ones reflect a focus on expanding capabilities and improving user experience.
docs/providers-and-models.md
Outdated
@@ -35,6 +35,7 @@ This document provides an overview of various AI providers and models, including | |||
|[chat10.free2gpt.xyz](https://chat10.free2gpt.xyz)|`g4f.Provider.Free2GPT`|`mistral-7b`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌| | |||
|[freegptsnav.aifree.site](https://freegptsnav.aifree.site)|`g4f.Provider.FreeGpt`|`gemini-pro`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌| | |||
|[app.giz.ai/assistant](https://app.giz.ai/assistant)|`g4f.Provider.GizAI`|`gemini-flash`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌| | |||
|[hf.space](https://hf.space)|`g4f.Provider.HuggingSpace`|❌|`flux-dev, flux-schnell`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌| |
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 entry for g4f.Provider.HuggingSpace
is missing a description for the providers. Consider adding a brief explanation of what flux-dev
and flux-schnell
are, as this would enhance clarity for users.
@@ -4,16 +4,13 @@ | |||
import requests | |||
from aiohttp import ClientSession | |||
from typing import List |
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.
Consider removing the unused import of InsecureRequestWarning
from requests.packages.urllib3.exceptions
. It is not being utilized in the code.
|
||
from ..typing import AsyncResult, Messages | ||
from ..image import ImageResponse | ||
from ..requests.raise_for_status import raise_for_status | ||
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin | ||
|
||
from .. import debug | ||
|
||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning) | ||
|
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 line disabling warnings for InsecureRequestWarning
has been removed. If you are making requests to an insecure endpoint, consider handling SSL verification properly instead of suppressing warnings.
@@ -41,6 +38,9 @@ | |||
default_model = "gpt-4o-mini" | |||
default_image_model = "flux" | |||
|
|||
models = [] |
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 models
and image_models
lists are initialized as empty. If they are intended to be populated later, ensure that this is handled correctly to avoid potential issues.
import random | ||
from typing import Optional | ||
|
||
from ...typing import AsyncResult, Messages |
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.
from ...typing import AsyncResult, Messages
- Importing from a relative path three levels up can make it harder to understand module dependencies. Consider using absolute imports for better code readability and maintainability.
|
||
from ...typing import AsyncResult, Messages | ||
from ...image import ImageResponse | ||
from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin |
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.
from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
- Similar to the previous suggestion, using relative imports for important classes can make the codebase harder to navigate. Absolute imports might be more beneficial here.
@@ -0,0 +1,3 @@ | |||
from .BlackForestLabsFlux1Dev import BlackForestLabsFlux1Dev |
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.
Consider using a more descriptive import statement to clarify the purpose of BlackForestLabsFlux1Dev
. It may not be immediately clear what this module does.
@@ -0,0 +1,3 @@ | |||
from .BlackForestLabsFlux1Dev import BlackForestLabsFlux1Dev | |||
from .BlackForestLabsFlux1Schnell import BlackForestLabsFlux1Schnell |
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 naming of BlackForestLabsFlux1Schnell
could be improved for clarity. Ensure that the name reflects its functionality.
@@ -0,0 +1,3 @@ | |||
from .BlackForestLabsFlux1Dev import BlackForestLabsFlux1Dev | |||
from .BlackForestLabsFlux1Schnell import BlackForestLabsFlux1Schnell | |||
from .VoodoohopFlux1Schnell import VoodoohopFlux1Schnell |
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.
Similar to the previous imports, VoodoohopFlux1Schnell
should have a name that clearly indicates its purpose or functionality.
Pull Request ReviewTitle: Add HuggingSpace integration and improve provider stabilityReviewHello! 👋 First of all, I want to thank you for contributing to this project! Your efforts in adding the HuggingSpace integration and improving provider stability are greatly appreciated. Summary of Changes
Code Quality
Suggestions
ConclusionOverall, this is a solid addition to the project. Thank you once again for your hard work and dedication! If you have any questions or need further assistance, feel free to reach out. Looking forward to seeing more contributions from you! Best regards, |
- refactor: Replace DDGS with direct DuckDuckGo HTML scraping - feat: Add custom User-Agent and redirect handling in fetch_html - feat: Implement URL encoding for search queries - refactor: Extract search result parsing into separate function - feat: Add error handling and logging throughout search flow - style: Improve code organization and class definitions - perf: Optimize text cleaning with regex - fix: Handle empty search results gracefully - docs: Add function documentation and type hints - test: Improve error handling and edge cases BREAKING CHANGES: - Remove direct DDGS dependency - Change search results structure and parsing logic
Pull Request ReviewTitle: Add HuggingSpace integration and improve provider stabilityReviewHello! 👋 First of all, I want to thank you for contributing to the project! Your efforts in adding the HuggingSpace integration and improving provider stability are greatly appreciated. Summary of Changes
Code Review
Suggestions
ConclusionOverall, this is a great addition to the project! Thank you once again for your hard work and dedication. If you have any questions or need further assistance, feel free to reach out! Looking forward to seeing more contributions from you! 😊 Best, |
Pull Request ReviewTitle: Add HuggingSpace integration and improve provider stabilityReviewThank you for contributing to the project! Your work on integrating HuggingSpace and enhancing provider stability is greatly appreciated. Here are my thoughts on the changes:
Suggestions
Overall, this is a solid contribution that enhances the project significantly. Thank you once again for your hard work and dedication! Best regards, |
Pull Request ReviewTitle: Add HuggingSpace integration and improve provider stabilityReviewThank you for contributing to the project! Your work on adding the HuggingSpace integration and improving provider stability is greatly appreciated. Summary of Changes
Code Review
Documentation
Suggestions
ConclusionOverall, this is a well-executed pull request that enhances the functionality of the project. Thank you once again for your valuable contribution! Looking forward to seeing more of your work! |
Pull Request ReviewTitle: Add HuggingSpace integration and improve provider stabilityReviewThank you for contributing to the project! Your addition of the HuggingSpace integration is a valuable enhancement that will benefit users looking for more options in AI providers. Changes Overview
Code Quality
Suggestions
ConclusionOverall, this is a great addition to the project. I appreciate your effort in improving the provider stability and expanding the capabilities of our application. Looking forward to seeing more contributions from you! Best regards, |
The provided code appears to be a diff output from a version control system, showing changes made to a codebase related to various AI providers and their functionalities. Below is a summary of the key changes and additions made in the code: Summary of Changes:
Conclusion:These changes reflect a significant update to the AI provider framework, enhancing functionality, improving error handling, and adding new features for better integration with various AI models and services. The introduction of asynchronous capabilities and improved model management will likely lead to better performance and user experience. |
Pull Request ReviewTitle: Add HuggingSpace integration and improve provider stabilityReviewThank you for contributing to the project! Your work on integrating HuggingSpace and enhancing provider stability is greatly appreciated. Summary of Changes
Code Review
Documentation
Suggestions
ConclusionOverall, this is a well-executed pull request that enhances the functionality of the project. Thank you once again for your contribution! Looking forward to seeing more from you in the future. Best regards, |
Pull Request ReviewTitle: (docs,providers,client): major update to providers, docs and client APIsReview SummaryThank you for your contribution to the project! This pull request introduces significant enhancements, including a universal web search capability and comprehensive documentation updates. The changes appear well-structured and beneficial for users. Key Features
Suggestions
ConclusionOverall, this pull request is a significant improvement to the project. The changes are well-documented, and the new features will greatly enhance user experience. Thank you once again for your hard work and dedication! |
Pull Request ReviewPull Request Title: (docs,providers,client): major update to providers, docs, and client APIs SummaryThis pull request introduces significant enhancements and updates across various components of the project, including providers, documentation, and client APIs. Here's a detailed review: Key Updates & Enhancements
Diff AnalysisThe diff shows changes in several files, including code modifications, documentation updates, and the addition of new features:
Suggestions
Thanks for your substantial contribution to improving this project! If you have any questions or need further assistance, feel free to ask. Best regards, |
Pull Request ReviewOverviewThis pull request introduces significant updates to the providers, documentation, and client APIs. It includes the implementation of a new universal web search feature, extensive documentation improvements, enhancements to existing providers, and code improvements focusing on maintainability, error handling, and test coverage. Changes and AdditionsKey Features
Bug Fixes and Code Cleanup
Related IssuesRecommendations
Thank you for contributing such a valuable update to the project. The enhancements made to the search capabilities and documentation significantly improve the usability and reliability of the system. Reviewed by: g4f copilot If you have any questions or need further discussion on these points, feel free to reach out. |
Pull Request Review by g4f copilotSummaryThe current pull request introduces a comprehensive set of updates, including a new universal web search capability, notable documentation enhancements, and several enhancements to various features and providers. It also addresses several issues related to error handling, code organization, provider structure, and testing. Key Features and UpdatesUniversal Web Search
Documentation
Feature Enhancements
Code Improvement and Maintenance
Code Review and Suggestions
Suggestions for Testing
ConclusionThis is a solid and meaningful contribution to the project. Thank you for your hard work and dedication to improving the quality of this repository. These updates ensure better functionality, documentation, and maintainability and are successfully aligned with the project's growth trajectory. Thank you once again for your valuable contribution to this project! |
Pull Request ReviewTitle: (docs,providers,client): major update to providers, docs and client APIsSummaryThank you for your contribution to the project! This pull request introduces a significant update that enhances the functionality of the providers, improves documentation, and refines the client APIs. Key Features
Related IssuesNotes
ConclusionOverall, this is a well-structured and comprehensive update that significantly enhances the project. Thank you once again for your hard work and dedication to improving this project! |
Pull Request ReviewTitle: (docs,providers,client): major update to providers, docs and client APIsSummaryThis pull request introduces a universal web search capability along with comprehensive updates to the documentation and client APIs. The changes enhance the functionality and usability of the project significantly. Key Features
Related IssuesReview Comments
ConclusionOverall, this pull request significantly enhances the functionality and usability of the project. Thank you for your hard work and contribution to the project! Your efforts are greatly appreciated. Reviewed by: g4f copilot |
Review for Pull Request: (docs,providers,client): major update to providers, docs and client APIsSummaryThank you for your contribution to the project! This pull request introduces significant enhancements, including a universal web search capability and comprehensive updates to the documentation. The changes are well-structured and improve both functionality and usability. Key FeaturesUniversal Web Search
Documentation Updates
Feature Enhancements
Code Improvements
Related IssuesNotes
Overall, this is an excellent contribution that enhances the functionality and documentation of the project. I appreciate the effort put into this update and look forward to seeing it merged! Thank you once again for your valuable contribution! |
Review: (docs, providers, client): major update to providers, docs and client APIsSummaryThis pull request introduces several enhancements and new capabilities across the project, including a new universal web search feature, updates to providers, improvements in documentation, and expanded client API functionalities. Key Features and Changes:
Code Review Observations:
Suggestions:
ConclusionThis pull request represents a significant enhancement to the project, introducing new features and improving both performance and documentation. It aligns well with the project's goals of robust, streamlined provider management and user-friendly documentation. The modular approach to provider additions and the universal search functionality are excellent steps forward. Thank you, @None, for contributing these valuable updates to the project. Your efforts in enhancing both capabilities and documentation are greatly appreciated! 🚀🎉 |
…ion (g4f/Provider/BlackboxAgent.py)
Pull Request ReviewTitle: (docs,providers,client): major update to providers, docs and client APIsSummaryThank you for your contribution to the project! This pull request introduces a significant update that enhances the functionality of the providers, improves documentation, and refines the client APIs. Key Features
Related IssuesNotes
ConclusionOverall, this is a well-structured and impactful update. The enhancements to the search functionality and documentation will greatly benefit users and developers alike. Thank you once again for your hard work and dedication to improving this project! |
…oxAgent.py g4f/Provider/BlackboxCreateAgent.py
Pull Request Review for (docs,providers,client): Major Update to Providers, Docs, and Client APIsFeedbackHello! Thank you for your significant contribution to the project. This pull request introduces various enhancements and updates, and it seems like there's a lot of exciting new functionality included. Here's an overview of what you've added, along with some feedback: Key Feature - Universal Web Search
Documentation Updates
Feature Enhancements
Code Improvements
Suggestions
Again, thank you for your significant efforts and contributions to enhancing this project. These changes will likely improve both the user and developer experience substantially. Let me know if you need further assistance or clarification on this feedback. If you have any questions about these suggestions, feel free to reach out. Looking forward to seeing this pull request merged soon! Warm regards, |
Pull Request Review: Major Update to Providers, Docs, and Client APIsThank you for your comprehensive contribution to the project! This pull request brings significant enhancements across the board, including new features, improved documentation, and updates to various providers. OverviewKey Features
Documentation & Code Improvements
Detailed ReviewCode
Documentation
Suggestions
Again, thank you for your substantial work on this update. It marks a significant stride forward for our project. Best regards, |
Pull Request ReviewTitle: (docs,providers,client): major update to providers, docs and client APIsSummaryThank you for your contribution to the project! This pull request introduces a significant update that enhances the functionality and documentation of the providers, client APIs, and adds a universal web search capability. Key Features
Related IssuesNotes
ConclusionOverall, this is a well-structured and comprehensive update that significantly enhances the functionality and usability of the project. Great job on the documentation and ensuring backward compatibility! Thank you once again for your valuable contribution! Looking forward to seeing more from you in the future. |
Pull Request ReviewReviewer: g4f copilotThank you for your substantial contribution to the project! Let’s discuss your pull request titled "Major update to providers, docs, and client APIs." OverviewTitle: Major update to providers, docs, and client APIs Key Features and ChangesUniversal Web Search:
Documentation Enhancements:
Feature Enhancements:
Code Improvements:
Feedback and Suggestions
ConclusionThis is a well-thought-out and thorough enhancement, bringing key updates to the functionality and documentation. Ensure any test cases related to these features are well-documented and covered. Once again, thank you for your valuable contribution to the project. If any discussions are needed or issues arise, feel free to reach out. |
This PR introduces a universal web search capability and comprehensive documentation updates:
Key Feature - Universal Web Search:
Documentation Updates:
Feature Enhancements:
Code Improvements: