From 7927f4ca2bf66ab1f490ba71b19ba33793645647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Mu=C5=A1tar?= Date: Fri, 18 Jul 2025 19:09:59 +0200 Subject: [PATCH 1/5] feat: add Hugging Face logo asset --- .../images/model-provider/huggingface.svg | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 web-app/public/images/model-provider/huggingface.svg diff --git a/web-app/public/images/model-provider/huggingface.svg b/web-app/public/images/model-provider/huggingface.svg new file mode 100644 index 000000000..0af6921f9 --- /dev/null +++ b/web-app/public/images/model-provider/huggingface.svg @@ -0,0 +1,29 @@ + From 54c1bf69500f6e558dbdb156e84c65582494a0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Mu=C5=A1tar?= Date: Fri, 18 Jul 2025 19:10:14 +0200 Subject: [PATCH 2/5] feat: add Hugging Face engine configuration and model definitions --- .../models/huggingface.json | 47 +++++++++++++++++++ .../resources/huggingface.json | 23 +++++++++ 2 files changed, 70 insertions(+) create mode 100644 extensions/engine-management-extension/models/huggingface.json create mode 100644 extensions/engine-management-extension/resources/huggingface.json diff --git a/extensions/engine-management-extension/models/huggingface.json b/extensions/engine-management-extension/models/huggingface.json new file mode 100644 index 000000000..d4bf92688 --- /dev/null +++ b/extensions/engine-management-extension/models/huggingface.json @@ -0,0 +1,47 @@ +[ + { + "model": "moonshotai/Kimi-K2-Instruct:groq", + "object": "model", + "name": "Kimi-K2-Instruct", + "version": "1.0", + "description": "Moonshot's Kimi K2 model with 131k context and tool calling support", + "inference_params": { + "temperature": 0.6, + "top_p": 1.0, + "frequency_penalty": 0, + "presence_penalty": 0, + "stream": true + }, + "engine": "huggingface" + }, + { + "model": "deepseek-ai/DeepSeek-R1-0528", + "object": "model", + "name": "DeepSeek-R1-0528", + "version": "1.0", + "description": "DeepSeek's reasoning model with 163k context, tool calling support, and open weights", + "inference_params": { + "temperature": 0.6, + "top_p": 0.95, + "frequency_penalty": 0, + "presence_penalty": 0, + "stream": true + }, + "engine": "huggingface" + }, + { + "model": "deepseek-ai/DeepSeek-V3-0324", + "object": "model", + "name": "DeepSeek-V3-0324", + "version": "1.0", + "description": "DeepSeek V3 with 16k context, tool calling support, and open weights", + "inference_params": { + "temperature": 0.3, + "top_p": 0.95, + "frequency_penalty": 0, + "presence_penalty": 0, + "stream": true + }, + "engine": "huggingface" + } +] diff --git a/extensions/engine-management-extension/resources/huggingface.json b/extensions/engine-management-extension/resources/huggingface.json new file mode 100644 index 000000000..6a161b65a --- /dev/null +++ b/extensions/engine-management-extension/resources/huggingface.json @@ -0,0 +1,23 @@ +{ + "id": "huggingface", + "type": "remote", + "engine": "huggingface", + "url": "https://huggingface.co/settings/tokens", + "api_key": "", + "metadata": { + "get_models_url": "https://router.huggingface.co/v1/models", + "header_template": "Authorization: Bearer {{api_key}}", + "transform_req": { + "chat_completions": { + "url": "https://router.huggingface.co/v1/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://huggingface.co/models?pipeline_tag=text-generation&inference_provider=all" + } +} From 178d1546fe6ec646111f5ee81384cc179f6a2b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Mu=C5=A1tar?= Date: Fri, 18 Jul 2025 19:10:30 +0200 Subject: [PATCH 3/5] feat: integrate Hugging Face provider into web app and engine management --- .../engine-management-extension/engines.mjs | 4 ++ web-app/src/lib/utils.ts | 4 ++ web-app/src/mock/data.ts | 60 +++++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/extensions/engine-management-extension/engines.mjs b/extensions/engine-management-extension/engines.mjs index eafe8a09c..b63bc6b52 100644 --- a/extensions/engine-management-extension/engines.mjs +++ b/extensions/engine-management-extension/engines.mjs @@ -3,6 +3,7 @@ import cohere from './resources/cohere.json' with { type: 'json' } import openai from './resources/openai.json' with { type: 'json' } import openrouter from './resources/openrouter.json' with { type: 'json' } import groq from './resources/groq.json' with { type: 'json' } +import huggingface from './resources/huggingface.json' with { type: 'json' } import martian from './resources/martian.json' with { type: 'json' } import mistral from './resources/mistral.json' with { type: 'json' } import nvidia from './resources/nvidia.json' with { type: 'json' } @@ -14,6 +15,7 @@ import cohereModels from './models/cohere.json' with { type: 'json' } import openaiModels from './models/openai.json' with { type: 'json' } import openrouterModels from './models/openrouter.json' with { type: 'json' } import groqModels from './models/groq.json' with { type: 'json' } +import huggingfaceModels from './models/huggingface.json' with { type: 'json' } import martianModels from './models/martian.json' with { type: 'json' } import mistralModels from './models/mistral.json' with { type: 'json' } import nvidiaModels from './models/nvidia.json' with { type: 'json' } @@ -26,6 +28,7 @@ const engines = [ cohere, openrouter, groq, + huggingface, mistral, martian, nvidia, @@ -38,6 +41,7 @@ const models = [ ...cohereModels, ...openrouterModels, ...groqModels, + ...huggingfaceModels, ...mistralModels, ...martianModels, ...nvidiaModels, diff --git a/web-app/src/lib/utils.ts b/web-app/src/lib/utils.ts index b193257f2..168798f45 100644 --- a/web-app/src/lib/utils.ts +++ b/web-app/src/lib/utils.ts @@ -11,6 +11,8 @@ export function getProviderLogo(provider: string) { return '/images/model-provider/llamacpp.svg' case 'anthropic': return '/images/model-provider/anthropic.svg' + case 'huggingface': + return '/images/model-provider/huggingface.svg' case 'mistral': return '/images/model-provider/mistral.svg' case 'martian': @@ -46,6 +48,8 @@ export const getProviderTitle = (provider: string) => { return 'OpenRouter' case 'gemini': return 'Gemini' + case 'huggingface': + return 'Hugging Face' default: return provider.charAt(0).toUpperCase() + provider.slice(1) } diff --git a/web-app/src/mock/data.ts b/web-app/src/mock/data.ts index 3610eab97..7e1d586fb 100644 --- a/web-app/src/mock/data.ts +++ b/web-app/src/mock/data.ts @@ -281,4 +281,64 @@ export const predefinedProviders = [ ], models: [], }, + { + active: true, + api_key: '', + base_url: 'https://router.huggingface.co/v1', + explore_models_url: + 'https://huggingface.co/models?pipeline_tag=text-generation&inference_provider=all', + provider: 'huggingface', + settings: [ + { + key: 'api-key', + title: 'API Key', + description: + "The Hugging Face API uses tokens for authentication. Visit your [Access Tokens](https://huggingface.co/settings/tokens) page to retrieve the token you'll use in your requests.", + controller_type: 'input', + controller_props: { + placeholder: 'Insert API Token', + value: '', + type: 'password', + input_actions: ['unobscure', 'copy'], + }, + }, + { + key: 'base-url', + title: 'Base URL', + description: + 'The base endpoint to use. See the [Hugging Face Inference Providers documentation](https://huggingface.co/docs/inference-providers) for more information.', + controller_type: 'input', + controller_props: { + placeholder: 'https://router.huggingface.co/v1', + value: 'https://router.huggingface.co/v1', + }, + }, + ], + models: [ + { + id: 'moonshotai/Kimi-K2-Instruct:groq', + name: 'Kimi-K2-Instruct', + version: '1.0', + description: + "Moonshot's Kimi K2 model with 131k context and tool calling support", + capabilities: ['completion', 'tools'], + }, + { + id: 'deepseek-ai/DeepSeek-R1-0528', + name: 'DeepSeek-R1-0528', + version: '1.0', + description: + "DeepSeek's reasoning model with 163k context, tool calling support, and open weights", + capabilities: ['completion', 'tools'], + }, + { + id: 'deepseek-ai/DeepSeek-V3-0324', + name: 'DeepSeek-V3-0324', + version: '1.0', + description: + 'DeepSeek V3 with 16k context, tool calling support, and open weights', + capabilities: ['completion', 'tools'], + }, + ], + }, ] From 6ce26b7b6d9e89418b09d90e4e967331908a5ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Mu=C5=A1tar?= Date: Fri, 18 Jul 2025 19:31:07 +0200 Subject: [PATCH 4/5] chore: update model descriptions for clarity and accuracy --- web-app/src/mock/data.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web-app/src/mock/data.ts b/web-app/src/mock/data.ts index 7e1d586fb..9f40177bb 100644 --- a/web-app/src/mock/data.ts +++ b/web-app/src/mock/data.ts @@ -320,7 +320,7 @@ export const predefinedProviders = [ name: 'Kimi-K2-Instruct', version: '1.0', description: - "Moonshot's Kimi K2 model with 131k context and tool calling support", + '1T parameters Moonshot chat model tuned for tool-aware, nuanced responses.', capabilities: ['completion', 'tools'], }, { @@ -328,7 +328,7 @@ export const predefinedProviders = [ name: 'DeepSeek-R1-0528', version: '1.0', description: - "DeepSeek's reasoning model with 163k context, tool calling support, and open weights", + "DeepSeek's flagship reasoning engine with open weights and advanced tool control.", capabilities: ['completion', 'tools'], }, { @@ -336,7 +336,7 @@ export const predefinedProviders = [ name: 'DeepSeek-V3-0324', version: '1.0', description: - 'DeepSeek V3 with 16k context, tool calling support, and open weights', + 'Streamlined DeepSeek model focused on fast, high-quality completions and tool use.', capabilities: ['completion', 'tools'], }, ], From 18dfe2b88349edfc6ec20441baf774c18759886c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Mu=C5=A1tar?= Date: Fri, 18 Jul 2025 19:53:12 +0200 Subject: [PATCH 5/5] chore: update model descriptions in huggingface.json to match web app mock data --- .../engine-management-extension/models/huggingface.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/engine-management-extension/models/huggingface.json b/extensions/engine-management-extension/models/huggingface.json index d4bf92688..322727825 100644 --- a/extensions/engine-management-extension/models/huggingface.json +++ b/extensions/engine-management-extension/models/huggingface.json @@ -4,7 +4,7 @@ "object": "model", "name": "Kimi-K2-Instruct", "version": "1.0", - "description": "Moonshot's Kimi K2 model with 131k context and tool calling support", + "description": "1T parameters Moonshot chat model tuned for tool-aware, nuanced responses.", "inference_params": { "temperature": 0.6, "top_p": 1.0, @@ -19,7 +19,7 @@ "object": "model", "name": "DeepSeek-R1-0528", "version": "1.0", - "description": "DeepSeek's reasoning model with 163k context, tool calling support, and open weights", + "description": "DeepSeek's flagship reasoning engine with open weights and advanced tool control.", "inference_params": { "temperature": 0.6, "top_p": 0.95, @@ -34,7 +34,7 @@ "object": "model", "name": "DeepSeek-V3-0324", "version": "1.0", - "description": "DeepSeek V3 with 16k context, tool calling support, and open weights", + "description": "Streamlined DeepSeek model focused on fast, high-quality completions and tool use.", "inference_params": { "temperature": 0.3, "top_p": 0.95,