Flowise
Flowise copied to clipboard
fix: Upgrade Hugging Face Inference API to support Inference Providers
- Upgrade @huggingface/inference from v2.6.1 to v4.13.2
- Update ChatHuggingFace to use InferenceClient with chatCompletion API
- Update HuggingFaceInference (LLM) to use v4 HfInference with Inference Providers
- Update HuggingFaceInferenceEmbedding to use v4 HfInference
- Add endpoint handling logic to ignore custom endpoints for provider-based models
- Add improved error handling and validation for API keys
- Update UI descriptions to guide users on proper configuration
Fixes #5161
Summary of Changes
Hello @aibysid, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the integration with Hugging Face by upgrading the underlying inference library to its latest major version. This upgrade enables the use of Hugging Face's Inference Providers, streamlines the interaction with chat models through a new client, and introduces more intelligent endpoint management. Additionally, it improves the overall user experience by providing clearer UI instructions and more robust error handling for API key and connection issues.
Highlights
- Hugging Face Inference API Upgrade: The
@huggingface/inferencelibrary has been upgraded from version2.6.1to4.13.2, bringing significant changes and new capabilities. - ChatHuggingFace Modernization: The
ChatHuggingFacecomponent now utilizes the newInferenceClientand itschatCompletionAPI, aligning with the updated library's best practices for conversational models. - Inference Provider Support: Both
HuggingFaceInference(LLM) andHuggingFaceInferenceEmbeddingcomponents have been updated to leverage the v4HfInferenceand its support for Inference Providers, simplifying model access. - Improved Endpoint Handling: New logic has been implemented to intelligently handle custom endpoints, ensuring they are ignored for models that use Inference Providers or router endpoints, preventing conflicts and improving reliability.
- Enhanced API Key Validation and Error Handling: Robust API key validation has been added, including checks for existence and format (
hf_prefix). More descriptive error messages are now provided for authentication and endpoint-related issues. - UI Guidance Updates: User interface descriptions for 'Model' and 'Endpoint' fields have been updated to provide clearer guidance on proper configuration when using Inference Providers or custom endpoints.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.
also confirming working with HF embeddings: