Skip to content
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

Update providers, documentation improvements and bug fixes #2562

Merged
merged 2 commits into from
Jan 12, 2025

Conversation

kqlio67
Copy link
Contributor

@kqlio67 kqlio67 commented Jan 12, 2025

No description provided.

Copy link

@github-actions github-actions bot left a 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: Update providers, documentation improvements and bug fixes

Thank you for contributing to the project! Your efforts in updating the providers, improving documentation, and fixing bugs are greatly appreciated.

Summary of Changes

  • New Providers Added:

    • AutonomousAI
    • CablyAI
    • ChatGLM
    • ImageLabs
  • Documentation Improvements:

    • Added new sections and updated existing ones in providers-and-models.md to include new providers and models.
  • Bug Fixes:

    • Adjusted the Airforce provider to set working to False.
    • Various improvements in the handling of API keys and response parsing across multiple providers.

Detailed Feedback

  1. New Providers:

    • The addition of new providers like AutonomousAI, CablyAI, and ChatGLM enhances the functionality of the project. Ensure that the documentation for these providers is clear and comprehensive.
  2. Documentation:

    • The updates to providers-and-models.md are well-structured. The inclusion of new models under the respective providers is helpful for users to understand the capabilities of each provider.
  3. Code Quality:

    • The code changes are clean and follow the existing coding standards. The use of async functions and proper error handling is commendable.
  4. Testing:

    • Ensure that there are adequate tests for the new providers and any changes made to existing ones. This will help maintain the stability of the project.
  5. Deprecation of API Key Check:

    • The removal of the API key check in the Airforce provider is a significant change. Make sure to document this change clearly, as it may affect users relying on this functionality.

Suggestions

  • Consider adding examples in the documentation for how to use the new providers effectively.
  • It might be beneficial to include a changelog to track changes made in each version for better transparency.

Overall, this pull request is a great step forward for the project. Thank you once again for your hard work and dedication!

@@ -8,6 +8,7 @@ This document provides an overview of various AI providers and models, including
## Table of Contents
- [Providers](#providers)
- [Free](#providers-free)
- [HuggingSpace](#providers-huggingspace)

Choose a reason for hiding this comment

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

  • The entry for HuggingSpace should be consistent with the naming convention used for other providers. Consider using the same case style as other entries.

@@ -22,10 +23,14 @@
|----------|-------------|--------------|---------------|--------|--------|------|------|
|[api.airforce](https://api.airforce)|`g4f.Provider.Airforce`|`phi-2, openchat-3.5, deepseek-coder, hermes-2-dpo, hermes-2-pro, openhermes-2.5, lfm-40b, german-7b, llama-2-7b, llama-3.1-8b, llama-3.1-70b, neural-7b, zephyr-7b, evil,`|`sdxl, flux-pro, flux, flux-realism, flux-anime, flux-3d, flux-disney, flux-pixel, flux-4o, any-dark, midjourney, dall-e-3`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌+✔|
|[amigochat.io](https://amigochat.io/chat/)|`g4f.Provider.AmigoChat`|✔|✔|❌|✔|![Error](https://img.shields.io/badge/RateLimit-f48d37)|❌|
|[blackbox.ai](https://www.blackbox.ai)|`g4f.Provider.Blackbox`|`blackboxai, gpt-4, gpt-4o, gemini-1.5-pro, claude-3.5-sonnet, blackboxai-pro, llama-3.1-8b, llama-3.1-70b, llama-3.3-70b, mixtral-7b, deepseek-chat, dbrx-instruct, qwq-32b, hermes-2-dpo`|`flux`|`blackboxai, gpt-4o, gemini-1.5-pro, gemini-1.5-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b`|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
|[autonomous.ai](https://www.autonomous.ai/anon/)|`g4f.Provider.AutonomousAI`|`llama-3.3-70b, qwen-2.5-coder-32b, hermes-3, llama-3.2-90b, llama-3.3-70b`|✔|❌|✔|![Error](https://img.shields.io/badge/RateLimit-f48d37)|❌|

Choose a reason for hiding this comment

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

  • The entry for blackbox.ai appears twice with different details. Ensure that there is no duplication and that the information is accurate.

@@ -36,37 +41,47 @@
|[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-1.5-pro`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
|[app.giz.ai/assistant](https://app.giz.ai/assistant)|`g4f.Provider.GizAI`|`gemini-1.5-flash`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
|[editor.imagelabs.net](editor.imagelabs.net)|`g4f.Provider.ImageLabs`|❌|✔|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|

Choose a reason for hiding this comment

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

  • The entry for editor.imagelabs.net is missing a URL format. Ensure that the URL is complete and correctly formatted.

@@ -36,37 +41,47 @@
|[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-1.5-pro`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
|[app.giz.ai/assistant](https://app.giz.ai/assistant)|`g4f.Provider.GizAI`|`gemini-1.5-flash`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
|[editor.imagelabs.net](editor.imagelabs.net)|`g4f.Provider.ImageLabs`|❌|✔|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
|[huggingface.co/spaces](https://huggingface.co/spaces)|`g4f.Provider.HuggingSpace`|`qwen-2.5-72b, qwen-2.5-72b`|`flux-dev, flux-schnell, sd-3.5`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|

Choose a reason for hiding this comment

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

  • The entry for huggingface.co/spaces has a duplicate model listed. Ensure that each model is unique and not repeated.

|[liaobots.work](https://liaobots.work)|`g4f.Provider.Liaobots`|`grok-2, gpt-4o-mini, gpt-4o, gpt-4, o1-preview, o1-mini, claude-3-opus, claude-3.5-sonnet, claude-3-sonnet, gemini-1.5-flash, gemini-1.5-pro, gemini-2.0-flash, gemini-2.0-flash-thinking`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
|[mhystical.cc](https://mhystical.cc)|`g4f.Provider.Mhystical`|`gpt-4`|❌|❌|✔|![Error](https://img.shields.io/badge/Active-brightgreen)|❌|
|[labs.perplexity.ai](https://labs.perplexity.ai)|`g4f.Provider.PerplexityLabs`|`sonar-online, sonar-chat, llama-3.3-70b, llama-3.1-8b, llama-3.1-70b, lfm-40b`|❌|❌|✔|![Error](https://img.shields.io/badge/Active-brightgreen)|❌|
|[pi.ai/talk](https://pi.ai/talk)|`g4f.Provider.Pi`|`pi`|❌|❌|✔|![Error](https://img.shields.io/badge/Active-brightgreen)|❌|
|[pizzagpt.it](https://www.pizzagpt.it)|`g4f.Provider.Pizzagpt`|`gpt-4o-mini`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
|[pollinations.ai](https://pollinations.ai)|`g4f.Provider.PollinationsAI`|`gpt-4o, mistral-large, mistral-nemo, llama-3.1-70b, gpt-4, qwen-2.5-coder-32b, claude-3.5-sonnet, command-r, evil, p1,turbo, unity, midijourney, rtist`|`flux, flux-realism, flux-cablyai, flux-anime, flux-3d, any-dark, flux-pro, midjourney, dall-e-3`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
|[pollinations.ai](https://pollinations.ai)|`g4f.Provider.PollinationsAI`|`gpt-4o, mistral-large, mistral-nemo, llama-3.3-70b, gpt-4, qwen-2-72b, qwen-2.5-coder-32b, claude-3.5-sonnet, command-r, deepseek-chat, llama-3.2-3b, evil, p1, turbo, unity, midijourney, rtist`|`flux, flux-realism, flux-cablyai, flux-anime, flux-3d, any-dark, flux-pro, midjourney, dall-e-3`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|

Choose a reason for hiding this comment

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

  • The entry for pollinations.ai has a duplicate model listed. Ensure that each model is unique and not repeated.

@@ -12,13 +12,14 @@
class VoodoohopFlux1Schnell(AsyncGeneratorProvider, ProviderModelMixin):
url = "https://voodoohop-flux-1-schnell.hf.space"
api_endpoint = "https://voodoohop-flux-1-schnell.hf.space/call/infer"

working = True

Choose a reason for hiding this comment

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

The working attribute is added but not explained in the code's context. Verify if it is being utilized effectively elsewhere in the class or if additional handling is required.

working = True

default_model = "flux-schnell"
default_model = "voodoohop-flux-1-schnell"

Choose a reason for hiding this comment

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

The default_model value has been changed to voodoohop-flux-1-schnell. Ensure that this change is intentional and consistent with any external dependencies or references that expect the previous value, flux-schnell.

models = [*image_models]
model_aliases = {"flux-schnell-voodoohop": default_model}
models = image_models
model_aliases = {"flux-schnell": default_model}

Choose a reason for hiding this comment

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

The key flux-schnell in model_aliases has been updated to replace flux-schnell-voodoohop. Validate whether this change aligns with the expected behavior of the alias mapping and verify downstream impacts, if any.

@@ -72,4 +73,4 @@
json_data = json.loads(data)
image_url = json_data[0]['url']
yield ImageResponse(images=[image_url], alt=prompt)

Choose a reason for hiding this comment

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

The return statement has been removed. Ensure that its removal does not impact the function's behavior, especially if the return was crucial for terminating execution or compatibility with consumers of this output.

@@ -46,11 +46,10 @@ class HuggingChat(AbstractProvider, ProviderModelMixin):
'NousResearch/Hermes-3-Llama-3.1-8B',
'mistralai/Mistral-Nemo-Instruct-2407',
'microsoft/Phi-3.5-mini-instruct',
*image_models
]
] + image_models
model_aliases = {
### Chat ###

Choose a reason for hiding this comment

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

Ensure the alias 'qwen-2.5-72b' for 'Qwen/Qwen2.5-72B-Instruct' is either retained or necessary documentation updates reflect this change in the model alias mapping.

@hlohaus hlohaus merged commit 214567f into xtekky:main Jan 12, 2025
1 check passed
Copy link

Pull Request Review

Thank you for your contribution to the project, None! Below is my review of your pull request titled "Update providers, documentation improvements and bug fixes".


Summary of Changes

This pull request introduces the following significant updates:

  1. Providers Documentation:

    • New providers like HuggingSpace, AutonomousAI, CablyAI, ChatGLM, ImageLabs, and more have been added to the documentation for reference.
    • Numerous improvements to the existing provider listings (e.g., added model details and status).
  2. New Providers and Features:

    • Introduced new provider classes ChatGLM, CablyAI, ImageLabs, Jmuz, and more.
    • Enhanced support for models like llama-3.1-405b, qwen-2.5-72b, gemini-1.5-flash, etc.
  3. Bug Fixes:

    • Resolved API Key and authorization requirements (e.g., in Airforce.py and PollinationsAI.py).
    • Fixed regular expression and parsing issues in BlackboxCreateAgent.py.
    • Refactored stream handling in several providers for efficiency.
  4. Enhancements:

    • Enhanced compatibility for additional HuggingFace space models.
    • Improved image generation handling, such as in ImageLabs.py and PollinationsAI.py.
    • Added more robust error handling for providers like DDG, DarkAI, and ChatGptEs.
  5. Miscellaneous Changes:

    • Added consistency in user-agent formats across many providers.
    • Added new system_prompt configuration in some providers.

Suggestions & Feedback

1. Documentation

  • Improvement: The documentation for the main Table of Contents (section #Providers) needs better organization. Consider grouping providers into subsections by type (e.g., "Text Providers," "Image Providers").
  • Missing Details: Document the aliases for newly introduced models (e.g., llama-3.2-3b in Providers and Models.md).

2. Code Quality

  • Use of Duplicated Code:

    • Multiple classes like BlackForestLabsFlux1Dev, Qwen_QVQ_72B, and StableDiffusion35Large have repetitive code for tasks like generating headers or handling streams. Suggest abstracting these patterns into reusable helper methods.
  • Error Logging:

    • Some methods silently catch exceptions (e.g., except Exception as e without logging).
      • Suggestion: Add meaningful error messages and use a logging framework for better traceability.

3. Testing

  • Ensure comprehensive testing coverage:
    • Are all the new providers tested?
    • Do boundary cases (e.g., empty inputs, invalid keys) behave as expected?
    • Validate the new providers' behavior for both synchronous and asynchronous communication.

Review Outcome

Overall, the contribution:

  • Adds multiple new features enriching the project's functionality.
  • Fixes important issues related to providers.
  • Improves robustness and usability for users.

However, a few minor documentation updates and code refactorings can make this PR even better.

Thank you again for making these significant updates to the project! Let me know if you have any questions or need clarification on any of the issues mentioned.


Review Approval

I recommend APPROVING the pull request after incorporating the above suggestions.

With appreciation,
g4f copilot

@hlohaus
Copy link
Collaborator

hlohaus commented Jan 12, 2025

Thank you

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