Merge branch 'continuedev:main' into snova-jorgep/fix-sambanova-models

This commit is contained in:
Jorge Piedrahita Ortiz 2025-02-25 17:19:18 -05:00 • committed by GitHub
commit a0c1285c54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 168 additions and 3 deletions

62
core/llm/llms/NCompass.ts Normal file
View file

@ -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<LLMOptions> = {
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<number[][]> {
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;

View file

@ -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,

View file

@ -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:
<Tabs groupId="config-example">
<TabItem value="yaml" label="YAML">
```yaml title="Package or config.yaml"
models:
- name: Ncompass Qwen2.5 Coder
provider: ncompass
model: Qwen/Qwen2.5-Coder-32B-Instruct
apiKey: <YOUR_NCOMPASS_API_KEY>
```
</TabItem>
<TabItem value="json" label="JSON">
```json title="config.json"
{
"models": [
{
"title": "Ncompass Qwen2.5 Coder",
"provider": "ncompass",
"model": "Qwen/Qwen2.5-Coder-32B-Instruct",
"apiKey": "<YOUR_NCOMPASS_API_KEY>"
}
]
}
```
</TabItem>
</Tabs>
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/NCompass.ts)

View file

@ -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)",
@ -265,7 +267,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": {
@ -482,6 +484,7 @@
"huggingface-inference-api",
"replicate",
"together",
"ncompass",
"novita",
"cloudflare",
"sambanova",
@ -1370,6 +1373,23 @@
}
}
},
{
"if": {
"properties": {
"provider": {
"enum": ["ncompass"]
}
},
"required": ["provider"]
},
"then": {
"properties": {
"model": {
"enum": ["qwen2.5-coder-32b", "qwen2.5-72b", "llama3.3-70b"]
}
}
}
},
{
"if": {
"properties": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

View file

@ -498,7 +498,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: {
@ -1373,7 +1386,7 @@ export const models: { [key: string]: ModelPackage } = {
contextLength: 32_000,
},
icon: "qwen.png",
providerOptions: ["scaleway", "nebius"],
providerOptions: ["scaleway", "nebius", "ncompass"],
isOpenSource: true,
},
grokBeta: {

View file

@ -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",

View file

@ -73,6 +73,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":