-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add Hugging Face Inference Endpoints as Model Provider #5642
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,4 +49,4 @@ src-tauri/resources/bin | |
| # Helper tools | ||
| .opencode | ||
| OpenCode.md | ||
| archive/ | ||
| archive/flatpak/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
| "embla-carousel-react": "^8.0.0", | ||
| "fs": "^0.0.1-security", | ||
| "gray-matter": "^4.0.3", | ||
| "lucide-react": "^0.372.0", | ||
| "lucide-react": "^0.522.0", | ||
| "next": "^14.1.4", | ||
| "next-seo": "^6.5.0", | ||
| "next-sitemap": "^4.2.3", | ||
|
|
@@ -1503,7 +1503,7 @@ | |
|
|
||
| "lru-cache": ["[email protected]", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], | ||
|
|
||
| "lucide-react": ["lucide-react@0.372.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0" } }, "sha512-0cKdqmilHXWUwWAWnf6CrrjHD8YaqPMtLrmEHXolZusNTr9epULCsiJwIOHk2q1yFxdEwd96D4zShlAj67UJdA=="], | ||
| "lucide-react": ["lucide-react@0.522.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-jnJbw974yZ7rQHHEFKJOlWAefG3ATSCZHANZxIdx8Rk/16siuwjgA4fBULpXEAWx/RlTs3FzmKW/udWUuO0aRw=="], | ||
|
|
||
| "lz-string": ["[email protected]", "", { "bin": { "lz-string": "bin/bin.js" } }, "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ=="], | ||
|
|
||
|
|
||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| --- | ||
| title: Hugging Face | ||
| description: Learn how to integrate Hugging Face Inference Endpoints with Jan for enhanced functionality. | ||
| keywords: | ||
| [ | ||
| Hugging Face, | ||
| Jan, | ||
| Jan AI, | ||
| Hugging Face Inference Endpoints, | ||
| Hugging Face API, | ||
| Hugging Face Integration, | ||
| Hugging Face API Integration | ||
| ] | ||
| --- | ||
|
|
||
| import { Callout, Steps } from 'nextra/components' | ||
| import { Settings, Plus } from 'lucide-react' | ||
|
|
||
| # Hugging Face | ||
|
|
||
| Jan supports lots of models hosted on [Hugging Face](https://huggingface.co/). The main thing to keep | ||
| in mind is that **the method you use to deploy the model via huggingface has to be compatible with the | ||
| OpenAI API**. | ||
|
|
||
| ## Integrate Hugging Face API with Jan | ||
|
|
||
| <Steps> | ||
|
|
||
| ### Step 1: Navigate to the HuggingFace Model Hub | ||
|
|
||
| Visit the [HuggingFace Model Hub](https://huggingface.co/models) (make sure you are logged in) and | ||
| pick the model you want to use | ||
|
|
||
|  | ||
|
|
||
| ### Step 2: Configure HF Inference Endpoint and Deploy | ||
|
|
||
| After you have selected the model you want to use, click on the **Deploy** button and select a | ||
| deployment method. We will select HF Inference Endpoints for this one. | ||
|
|
||
|  | ||
| <br/> | ||
|
|
||
| This will take you to the deployment set up page. For this example, we will leave the default settings | ||
| as they are under the GPU tab and cick on **Create Endpoint**. | ||
|
|
||
|  | ||
| <br/> | ||
|
|
||
| Once your endpoint is ready, test that it works on the **Test your endpoint** tab. | ||
|
|
||
|  | ||
| <br/> | ||
|
|
||
| If you get a response, you can click on **Copy** to copy the endpoint URL and API key. | ||
|
|
||
| <Callout type='info'> | ||
| You will need to be logged into the HuggingFace Inference Endpoints and have a credit card on file to deploy a model. | ||
| </Callout> | ||
|
|
||
| ### Step 3: Configure Jan | ||
|
|
||
| If you do not have an API key you can create one under **Settings** > **Access Tokens** [here](https://huggingface.co/settings/tokens). Once | ||
| you finish, copy the token and add it to Jan alongside you endpoint URL at **Settings** > **Model Providers** > **HuggingFace**. | ||
|
|
||
| **3.1 HF Token** | ||
|  | ||
| <br/> | ||
|
|
||
| **3.2 HF Endpoint URL** | ||
|  | ||
| <br/> | ||
|
|
||
| **3.3 Jan Settings** | ||
|  | ||
|
|
||
| <Callout type='warning'> | ||
| Make sure to add `/v1/` to the end of your endpoint URL. This is required by the OpenAI API. | ||
| </Callout> | ||
|
|
||
| **3.4 Add Model Details** | ||
|  | ||
|
|
||
| ### Step 4: Configure Jan | ||
|
|
||
| Now you can start using the model in any chat. | ||
|
|
||
|  | ||
|
|
||
| If you want to learn how to use Jan Nano with MCP, check out [the guide here](../jan-models/jan-nano-32). | ||
| <br/> | ||
|
|
||
| </Steps> | ||
|
|
||
| ## Available Hugging Face Models | ||
|
|
||
| You can follow the steps above with a large amount of models on Hugging Face and bring them to Jan. Check | ||
| out other models in the [Hugging Face Model Hub](https://huggingface.co/models). | ||
|
|
||
|
|
||
| ## Troubleshooting | ||
|
|
||
| Common issues and solutions: | ||
|
|
||
| **1. Started a chat but the model is not responding** | ||
| - Verify your API_KEY/HF_TOKEN is correct and not expired | ||
| - Ensure the model you're trying to use is running again since, after a while, they go | ||
| idle so that you don't get charged when you are not using it | ||
|
|
||
|  | ||
|
|
||
| **2. Connection Problems** | ||
| - Check your internet connection | ||
| - Verify Hugging Face's system status | ||
| - Look for error messages in [Jan's logs](/docs/troubleshooting#how-to-get-error-logs) | ||
|
|
||
| **3. Model Unavailable** | ||
| - Confirm your API key has access to the model | ||
| - Check if you're using the correct model ID | ||
| - Verify your Hugging Face account has the necessary permissions | ||
|
|
||
| Need more help? Join our [Discord community](https://discord.gg/FTk2MvZwJH) or check the | ||
| [Hugging Face's documentation](https://docs.huggingface.co/en/inference-endpoints/index). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [] |
23 changes: 23 additions & 0 deletions
23
extensions/engine-management-extension/resources/huggingface.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "id": "huggingface", | ||
| "type": "remote", | ||
| "engine": "huggingface", | ||
| "url": "https://endpoints.huggingface.co/", | ||
| "api_key": "", | ||
| "metadata": { | ||
| "get_models_url": "{{base_url}}/models", | ||
| "header_template": "Authorization: Bearer {{api_key}}", | ||
| "transform_req": { | ||
| "chat_completions": { | ||
| "url": "{{base_url}}/chat/completions", | ||
| "template": "{ {% set first = true %} {% for key, value in input_request %} {% if key == \"messages\" or key == \"model\" or key == \"temperature\" or key == \"store\" or key == \"max_tokens\" or key == \"stream\" or key == \"presence_penalty\" or key == \"metadata\" or key == \"frequency_penalty\" or key == \"tools\" or key == \"tool_choice\" or key == \"logprobs\" or key == \"top_logprobs\" or key == \"logit_bias\" or key == \"n\" or key == \"modalities\" or key == \"prediction\" or key == \"response_format\" or key == \"service_tier\" or key == \"seed\" or key == \"stop\" or key == \"stream_options\" or key == \"top_p\" or key == \"parallel_tool_calls\" or key == \"user\" %} {% if not first %},{% endif %} \"{{ key }}\": {{ tojson(value) }} {% set first = false %} {% endif %} {% endfor %} }" | ||
| } | ||
| }, | ||
| "transform_resp": { | ||
| "chat_completions": { | ||
| "template": "{{tojson(input_request)}}" | ||
| } | ||
| }, | ||
| "explore_models_url": "https://endpoints.huggingface.co/catalog" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Typo alert: 'cick' should be 'click'.