diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 2adb20a02a1..67219e92ec6 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -70,6 +70,7 @@ const PROVIDER_HANDLES_TEMPLATING: string[] = [ "groq", "gemini", "docker", + "nous", // TODO add these, change to inverted logic so only the ones that need templating are hardcoded // Asksage.ts // Azure.ts @@ -365,6 +366,10 @@ function autodetectTemplateType(model: string): TemplateType | undefined { return "deepseek"; } + if (lower.includes("hermes")) { + return "chatml"; + } + if (lower.includes("ninja") || lower.includes("openchat")) { return "openchat"; } diff --git a/core/llm/llms/Nous.ts b/core/llm/llms/Nous.ts new file mode 100644 index 00000000000..9a7b26ac5ae --- /dev/null +++ b/core/llm/llms/Nous.ts @@ -0,0 +1,13 @@ +import { LLMOptions } from "../.."; + +import OpenAI from "./OpenAI"; + +class Nous extends OpenAI { + static providerName = "nous"; + static defaultOptions: Partial = { + apiBase: "https://inference-api.nousresearch.com/v1", + useLegacyCompletionsEndpoint: false, + }; +} + +export default Nous; diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 03f6eeaa3a6..2bc147b57ef 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -43,6 +43,7 @@ import Moonshot from "./Moonshot"; import Msty from "./Msty"; import NCompass from "./NCompass"; import Nebius from "./Nebius"; +import Nous from "./Nous"; import Novita from "./Novita"; import Nvidia from "./Nvidia"; import Ollama from "./Ollama"; @@ -114,6 +115,7 @@ export const LLMClasses = [ Cerebras, Asksage, Nebius, + Nous, Venice, VertexAI, xAI, diff --git a/docs/customize/model-providers/more/nous.mdx b/docs/customize/model-providers/more/nous.mdx new file mode 100644 index 00000000000..3ac693e3caf --- /dev/null +++ b/docs/customize/model-providers/more/nous.mdx @@ -0,0 +1,95 @@ +--- +title: Nous Research +slug: ../nous +--- + + + **Discover Nous Research Hermes models for advanced reasoning and instruction following** + + + + You can get an API key from the [Nous Research Portal](https://portal.nousresearch.com/). + + +## Available Models + +| Model | Context Length | Description | +|-------|----------------|-------------| +| `Hermes-4.3-36B` | 128k | Compact reasoning model with thinking capabilities | +| `Hermes-4-70B` | 128k | Large reasoning model with 128k context | +| `Hermes-4-405B` | 128k | Flagship reasoning model | +| `Hermes-3-Llama-3.1-70B` | 32k | Instruction-tuned on Llama 3.1 70B | +| `Hermes-3-Llama-3.1-405B` | 32k | Instruction-tuned on Llama 3.1 405B | + +## Configuration + + + + ```yaml title="config.yaml" + name: My Config + version: 0.0.1 + schema: v1 + + models: + - name: Hermes 4.3 36B + provider: nous + model: Hermes-4.3-36B + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Hermes 4.3 36B", + "provider": "nous", + "model": "Hermes-4.3-36B", + "apiKey": "" + } + ] + } + ``` + + + +## Reasoning Mode + +Hermes 4 and DeepHermes models support reasoning with chain-of-thought. To enable reasoning, use the following system prompt: + +``` +You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside tags, and then provide your solution or response to the problem. +``` + + + + ```yaml title="config.yaml" + name: My Config + version: 0.0.1 + schema: v1 + + models: + - name: Hermes 4.3 36B (Reasoning) + provider: nous + model: Hermes-4.3-36B + apiKey: + systemMessage: | + You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside tags, and then provide your solution or response to the problem. + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Hermes 4.3 36B (Reasoning)", + "provider": "nous", + "model": "Hermes-4.3-36B", + "apiKey": "", + "systemMessage": "You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside tags, and then provide your solution or response to the problem." + } + ] + } + ``` + + diff --git a/docs/docs.json b/docs/docs.json index 659b3996c0a..cee626b5302 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -211,6 +211,7 @@ "customize/model-providers/more/llamastack", "customize/model-providers/more/mimo", "customize/model-providers/more/mistral", + "customize/model-providers/more/nous", "customize/model-providers/more/nvidia", "customize/model-providers/more/together", "customize/model-providers/more/xAI" diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index e07aba3ac22..70d58d92bb5 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -37,6 +37,76 @@ export interface ModelPackage { } export const models: { [key: string]: ModelPackage } = { + hermes3Llama31_405b: { + title: "Hermes 3 Llama 3.1 405B", + description: + "Nous Research's Hermes 3, a powerful instruction-tuned model built on Llama 3.1 405B with strong reasoning and tool use capabilities.", + refUrl: "https://nousresearch.com/hermes3", + params: { + title: "Hermes 3 Llama 3.1 405B", + model: "Hermes-3-Llama-3.1-405B", + contextLength: 32_000, + }, + icon: "nous.png", + providerOptions: ["nous"], + isOpenSource: true, + }, + hermes3Llama31_70b: { + title: "Hermes 3 Llama 3.1 70B", + description: + "Nous Research's Hermes 3, built on Llama 3.1 70B with strong instruction following and reasoning.", + refUrl: "https://nousresearch.com/hermes3", + params: { + title: "Hermes 3 Llama 3.1 70B", + model: "Hermes-3-Llama-3.1-70B", + contextLength: 32_000, + }, + icon: "nous.png", + providerOptions: ["nous"], + isOpenSource: true, + }, + hermes4_405b: { + title: "Hermes 4 405B", + description: + "Nous Research's Hermes 4, featuring enhanced reasoning with thinking tags for chain-of-thought.", + refUrl: "https://nousresearch.com", + params: { + title: "Hermes 4 405B", + model: "Hermes-4-405B", + contextLength: 128_000, + }, + icon: "nous.png", + providerOptions: ["nous"], + isOpenSource: true, + }, + hermes4_70b: { + title: "Hermes 4 70B", + description: + "Nous Research's Hermes 4 70B with reasoning capabilities and 128k context.", + refUrl: "https://nousresearch.com", + params: { + title: "Hermes 4 70B", + model: "Hermes-4-70B", + contextLength: 128_000, + }, + icon: "nous.png", + providerOptions: ["nous"], + isOpenSource: true, + }, + hermes43_36b: { + title: "Hermes 4.3 36B", + description: + "Nous Research's Hermes 4.3 36B, a compact reasoning model with 128k context.", + refUrl: "https://nousresearch.com", + params: { + title: "Hermes 4.3 36B", + model: "Hermes-4.3-36B", + contextLength: 128_000, + }, + icon: "nous.png", + providerOptions: ["nous"], + isOpenSource: true, + }, deepseekV3Chat: { title: "deepseek v3", description: "A model from deekseek for chat", diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index b5543f1935f..cc1e4dd7cc7 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -1167,4 +1167,36 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo ], apiKeyUrl: "https://api.router.tetrate.ai/", }, + nous: { + title: "Nous Research", + provider: "nous", + refPage: "nous", + description: + "Nous Research provides Hermes models via an OpenAI-compatible API with advanced reasoning capabilities.", + longDescription: + "Nous Research offers Hermes models including Hermes 3 and Hermes 4 with strong instruction following and reasoning. Get an API key at [portal.nousresearch.com](https://portal.nousresearch.com).", + icon: "nous.png", + tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], + params: { + apiBase: "https://inference-api.nousresearch.com/v1", + }, + collectInputFor: [ + { + inputType: "text", + key: "apiKey", + label: "API Key", + placeholder: "Enter your Nous Research API key", + required: true, + }, + ...completionParamsInputsConfigs, + ], + packages: [ + models.hermes43_36b, + models.hermes4_70b, + models.hermes4_405b, + models.hermes3Llama31_70b, + models.hermes3Llama31_405b, + ], + apiKeyUrl: "https://portal.nousresearch.com", + }, };