diff --git a/README.md b/README.md index 9751d618d..b2a16d6f6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@
-**[Continue](https://docs.continue.dev) is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)** +**[Continue](https://docs.continue.dev) is the leading open-source AI code assistant. You can create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub](https://hub.continue.dev) of models, rules, prompts, docs, and other building blocks**
diff --git a/core/llm/llms/NCompass.ts b/core/llm/llms/NCompass.ts new file mode 100644 index 000000000..56fad94c5 --- /dev/null +++ b/core/llm/llms/NCompass.ts @@ -0,0 +1,62 @@ +import { ChatMessage, CompletionOptions, LLMOptions } from "../../index.js"; +import { ChatCompletionCreateParams } from "openai/resources/index"; + +import OpenAI from "./OpenAI.js"; + +class NCompass extends OpenAI { + static providerName = "ncompass"; + static defaultOptions: Partial = { + apiBase: "https://api.ncompass.tech/v1" + }; + static embeddingsApiEndpoint: "https://api.gcp.ncompass.tech/v1/embeddings" + + private static modelConversion: { [key: string]: string } = { + "qwen2.5-coder-32b": "Qwen/Qwen2.5-Coder-32B-Instruct", + "qwen2.5-72b": "Qwen/Qwen2.5-72B-Instruct", + "llama3.3-70b": "meta-llama/Llama-3.3-70B-Instruct", + "llama3.1-8b": "meta-llama/Llama-3.1-8B-Instruct", + }; + protected _convertModelName(model: string): string { + return NCompass.modelConversion[model] ?? model; + } + + protected _convertArgs( + options: CompletionOptions, + messages: ChatMessage[], + ): ChatCompletionCreateParams { + const finalOptions = super._convertArgs(options, messages); + finalOptions.model = this._convertModelName(options.model); + return finalOptions; + } + + protected _getHeaders() { + const headers = super._getHeaders() as { "Content-Type": string; Authorization: string; "api-key": string; Accept?: string }; + headers["Accept"] = "text/event-stream"; + return headers; + } + + protected async _embed(chunks: string[]): Promise { + const resp = await this.fetch(NCompass.embeddingsApiEndpoint, { + method: "POST", + body: JSON.stringify({ + input: chunks, + model: this.model, + ...this.extraBodyProperties(), + }), + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + }, + }); + + if (!resp.ok) { + throw new Error(await resp.text()); + } + + const data = (await resp.json()) as any; + return data.data.map((result: { embedding: number[] }) => result.embedding); + } + +} + +export default NCompass; diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 20bc8b710..32cda4aec 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -19,6 +19,7 @@ import Cohere from "./Cohere"; import DeepInfra from "./DeepInfra"; import Deepseek from "./Deepseek"; import Fireworks from "./Fireworks"; +import NCompass from "./NCompass"; import Flowise from "./Flowise"; import FreeTrial from "./FreeTrial"; import FunctionNetwork from "./FunctionNetwork"; @@ -81,6 +82,7 @@ export const LLMClasses = [ Flowise, Groq, Fireworks, + NCompass, ContinueProxy, Cloudflare, Deepseek, diff --git a/docs/docs/customize/model-providers/more/ncompass.mdx b/docs/docs/customize/model-providers/more/ncompass.mdx new file mode 100644 index 000000000..e6f98c296 --- /dev/null +++ b/docs/docs/customize/model-providers/more/ncompass.mdx @@ -0,0 +1,34 @@ +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# nCompass + +The nCompass Technologies API exposes an extremely fast inference engine for open-source language models. You can sign up [here](https://app.ncompass.tech/api-settings), copy your API key on the initial welcome screen, and then hit the play button on any model from the [nCompass Models list](https://console.ncompass.tech/models). Change `~/.continue/config.json` to look like this: + + + + ```yaml title="Package or config.yaml" + models: + - name: Ncompass Qwen2.5 Coder + provider: ncompass + model: Qwen/Qwen2.5-Coder-32B-Instruct + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Ncompass Qwen2.5 Coder", + "provider": "ncompass", + "model": "Qwen/Qwen2.5-Coder-32B-Instruct", + "apiKey": "" + } + ] + } + ``` + + + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/NCompass.ts) diff --git a/docs/docs/yaml-reference.md b/docs/docs/yaml-reference.md index 42b228105..126199f05 100644 --- a/docs/docs/yaml-reference.md +++ b/docs/docs/yaml-reference.md @@ -417,6 +417,46 @@ data: - chatInteraction ``` +## Using YAML anchors to avoid config duplication + +You can also use node anchors to avoid duplication of properties. To do so, +adding the YAML version header `%YAML 1.1` is needed, here's an example of +a `config.yaml` configuration file using anchors: + +```yaml title="config.yaml" +%YAML 1.1 +--- +name: MyProject +version: 0.0.1 + +model_defaults: &model_defaults + provider: openai + apiKey: my-api-key + apiBase: https://api.example.com/llm + +models: +- name: mistral + <<: *model_defaults + model: mistral-7b-instruct + roles: + - chat + - edit + +- name: qwen2.5-coder-7b-instruct + <<: *model_defaults + model: qwen2.5-coder-7b-instruct + roles: + - chat + - edit + +- name: qwen2.5-coder-7b + <<: *model_defaults + model: qwen2.5-coder-7b + useLegacyCompletionsEndpoint: false + roles: + - autocomplete +``` + ### Fully deprecated settings Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the [User Settings Page](./customize/settings.md). If found in `config.json`, they will be migrated to the [User Settings Page](./customize/settings.md) and removed from `config.json`. diff --git a/extensions/intellij/README.md b/extensions/intellij/README.md index 79b0d6cab..bce72f89c 100644 --- a/extensions/intellij/README.md +++ b/extensions/intellij/README.md @@ -6,7 +6,7 @@ [**Continue**](https://docs.continue.dev) is the leading open-source AI code assistant. -You can connect any models and any context to build custom autocomplete and chat experiences inside [**VS Code**](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [**JetBrains**](https://plugins.jetbrains.com/plugin/22707-continue-extension) IDEs. +You can create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub](https://hub.continue.dev) of models, rules, prompts, docs, and other building blocks. diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt index 735b23cff..46be13797 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt @@ -428,7 +428,7 @@ class IdeProtocolClient( if (editor.document.text.trim().isEmpty()) { WriteCommandAction.runWriteCommandAction(project) { - editor.document.insertString(0, msg) + editor.document.insertString(0, params.text) } respond(null) return@launch diff --git a/extensions/vscode/README.md b/extensions/vscode/README.md index 8bfc32b73..90b1b071b 100644 --- a/extensions/vscode/README.md +++ b/extensions/vscode/README.md @@ -8,7 +8,7 @@
-**[Continue](https://docs.continue.dev) is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)** +**[Continue](https://docs.continue.dev) is the leading open-source AI code assistant. You can create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub](https://hub.continue.dev) of models, rules, prompts, docs, and other building blocks**
diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index b41ebc06d..39ba71ba5 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -193,6 +193,7 @@ "deepinfra", "groq", "fireworks", + "ncompass", "cloudflare", "deepseek", "azure", @@ -238,6 +239,7 @@ "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)", "### Groq\nGroq provides extremely fast inference of open-source language models. To get started, obtain an API key from [their console](https://console.groq.com/keys).", "### Fireworks\nFireworks is a fast inference engine for open-source language models. To get started, obtain an API key from [their console](https://fireworks.ai/api-keys).", + "### Ncompass\nnCompass is an extremely fast inference engine for open-source language models. To get started, obtain an API key from [their console](https://app.ncompass.tech/api-settings).", "### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)", "### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)", "### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)", @@ -264,7 +266,7 @@ }, "apiKey": { "title": "Api Key", - "description": "OpenAI, Anthropic, Cohere, Together, Novita AI, or other API key", + "description": "OpenAI, Anthropic, Cohere, Together, Novita AI, nCompass, or other API key", "type": "string" }, "apiBase": { @@ -481,6 +483,7 @@ "huggingface-inference-api", "replicate", "together", + "ncompass", "novita", "cloudflare", "sambanova", @@ -1369,6 +1372,23 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["ncompass"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "enum": ["qwen2.5-coder-32b", "qwen2.5-72b", "llama3.3-70b"] + } + } + } + }, { "if": { "properties": { diff --git a/gui/public/logos/ncompass.png b/gui/public/logos/ncompass.png new file mode 100644 index 000000000..09c306695 Binary files /dev/null and b/gui/public/logos/ncompass.png differ diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index 72303ce17..7f563f845 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -499,7 +499,20 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 8192, }, icon: "meta.png", - providerOptions: ["groq", "scaleway", "nebius"], + providerOptions: ["groq", "scaleway", "nebius", "ncompass"], + isOpenSource: false, + }, + llama3370bChat: { + title: "Llama3.3 70b Chat", + description: "A model from Meta, fine-tuned for chat", + refUrl: "", + params: { + title: "Llama3.3-70b", + model: "llama3.3-70b", + contextLength: 65536, + }, + icon: "meta.png", + providerOptions: ["ncompass"], isOpenSource: false, }, llama3170bChat: { @@ -1374,7 +1387,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 32_000, }, icon: "qwen.png", - providerOptions: ["scaleway", "nebius"], + providerOptions: ["scaleway", "nebius", "ncompass"], isOpenSource: true, }, grokBeta: { diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 31c0bb2f6..38ed33400 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -409,6 +409,38 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n }), apiKeyUrl: "https://api.together.xyz/settings/api-keys", }, + ncompass: { + title: "nCompass", + provider: "ncompass", + refPage: "ncompass", + description: + "Use the nCompass API for extremely fast streaming of open-source models", + icon: "ncompass.png", + longDescription: `nCompass is an extremely fast inference engine for open-source language models. To get started, obtain an API key from [their console](https://app.ncompass.tech/api-settings).`, + tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], + params: { + apiKey: "", + }, + collectInputFor: [ + { + inputType: "text", + key: "apiKey", + label: "API Key", + placeholder: "Enter your nCompass API key", + required: true, + }, + ...completionParamsInputsConfigs, + ], + packages: [ + models.llama318bChat, + models.llama3370bChat, + models.Qwen25Coder32b, + ].map((p) => { + p.params.contextLength = 4096; + return p; + }), + apiKeyUrl: "https://app.ncompass.tech/api-settings", + }, novita: { title: "NovitaAI", provider: "novita", diff --git a/packages/openai-adapters/src/index.ts b/packages/openai-adapters/src/index.ts index dede527c4..e3ac2cadd 100644 --- a/packages/openai-adapters/src/index.ts +++ b/packages/openai-adapters/src/index.ts @@ -74,6 +74,8 @@ export function constructLlmApi(config: LLMConfig): BaseLlmApi | undefined { return openAICompatible("https://api.fireworks.ai/inference/v1/", config); case "together": return openAICompatible("https://api.together.xyz/v1/", config); + case "ncompass": + return openAICompatible("https://api.ncompass.tech/v1", config); case "novita": return openAICompatible("https://api.novita.ai/v3/openai", config); case "nebius":