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/extensions/engine-management-extension/models/huggingface.json b/extensions/engine-management-extension/models/huggingface.json new file mode 100644 index 000000000..322727825 --- /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": "1T parameters Moonshot chat model tuned for tool-aware, nuanced responses.", + "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 flagship reasoning engine with open weights and advanced tool control.", + "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": "Streamlined DeepSeek model focused on fast, high-quality completions and tool use.", + "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" + } +} 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 @@ + 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..9f40177bb 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: + '1T parameters Moonshot chat model tuned for tool-aware, nuanced responses.', + capabilities: ['completion', 'tools'], + }, + { + id: 'deepseek-ai/DeepSeek-R1-0528', + name: 'DeepSeek-R1-0528', + version: '1.0', + description: + "DeepSeek's flagship reasoning engine with open weights and advanced tool control.", + capabilities: ['completion', 'tools'], + }, + { + id: 'deepseek-ai/DeepSeek-V3-0324', + name: 'DeepSeek-V3-0324', + version: '1.0', + description: + 'Streamlined DeepSeek model focused on fast, high-quality completions and tool use.', + capabilities: ['completion', 'tools'], + }, + ], + }, ]