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

Enhance G4F Documentation, Provider Templates, and Error Handling #2285

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

kqlio67
Copy link
Contributor

@kqlio67 kqlio67 commented Oct 19, 2024

# Update the documentation G4F

Updated (docs/providers-and-models.md) documentation added/updated new providers and models


Updated almost all documentation and added new documentation for the local interface


# Updated script for creating providers for G4F

refactor(etc/tool/create_provider.py): enhance provider template and functionality

  • Update the provider template to include additional capabilities:
    • Introduce ProviderModelMixin for model handling
    • Add support for model aliases and default models
    • Implement get_model method for model resolution
    • Enhance provider class with new attributes like label, api_endpoint, needs_auth, supports_stream, supports_system_message, and supports_message_history

# Updating the G4F

Fixing (g4f/gui/client/static/css/style.css) errors with the size of internals in gui


refactor(g4f/gui/server/api.py): streamline model retrieval logic

  • Simplify the logic for retrieving provider models:
    • Remove redundant checks for supports_gpt_35_turbo and supports_gpt_4
    • Ensure model retrieval is consistent and concise

refactor(g4f/providers/types.py): remove redundant attributes

  • Streamline the BaseProvider class by removing unused attributes:
    • Removed supports_gpt_35_turbo and supports_gpt_4 attributes

# Update providers

fix(g4f/Provider/AmigoChat.py): correct image generation prompt index (#2283 (comment))

  • Update the prompt selection logic for image generation in the create_async_generator method. The previous implementation used the first message for the prompt, which has been changed to use the last message instead. This ensures the correct prompt is passed for generating images.

feat(g4f/Provider/Blackbox.py): enhance async generator with image processing

  • Add support for processing images in the Blackbox AI async generator:
    • Introduce image and image_name parameters to handle image data
    • Use to_data_uri to convert images for API requests
    • Modify message formatting to include image data when provided
    • Adding 'RepoMap' to the models list and trendingAgentMode dictionary with its mode and identifier.

Remove providers in the providers supports_gpt_35_turbo, supports_gpt_4


fix(g4f/Provider/HuggingChat.py): handle JSON decode errors and response status

  • Enhance error handling in HuggingChat's create_completion method
    • Add check for HTTP status code after POST request
    • Handle JSONDecodeError during response line processing
    • Remove unnecessary print statement for model
    • Concatenate tokens into full response, cleaning up unwanted chars (HuggingChat #2284 (comment))

refactor(g4f/Provider/Airforce.py): update image generation prompt and models

  • Modified the prompt selection logic in _generate_image method from messages[0]['content'] to messages[-1]['content'].

kqlio67 and others added 24 commits October 19, 2024 12:22
@kqlio67 kqlio67 closed this Oct 20, 2024
@kqlio67 kqlio67 reopened this Oct 20, 2024
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.

1 participant