Merge branch 'dev' of https://github.com/continuedev/continue into dev
This commit is contained in:
commit
f75bc28479
11 changed files with 63 additions and 11 deletions
|
|
@ -489,6 +489,7 @@ declare global {
|
|||
| "flowise"
|
||||
| "groq"
|
||||
| "custom"
|
||||
| "nvidia"
|
||||
| "msty";
|
||||
|
||||
export type ModelName =
|
||||
|
|
|
|||
3
core/index.d.ts
vendored
3
core/index.d.ts
vendored
|
|
@ -619,7 +619,8 @@ type ModelProvider =
|
|||
| "openai-aiohttp"
|
||||
| "msty"
|
||||
| "watsonx"
|
||||
| "openrouter";
|
||||
| "openrouter"
|
||||
| "nvidia";
|
||||
|
||||
export type ModelName =
|
||||
| "AUTODETECT"
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ describe("BaseLLM", () => {
|
|||
baseLLM.apiBase = "api.groq.com";
|
||||
expect(baseLLM.supportsCompletions()).toBe(false);
|
||||
|
||||
baseLLM.apiBase = "integrate.api.nvidia.com";
|
||||
expect(baseLLM.supportsCompletions()).toBe(false);
|
||||
|
||||
baseLLM.apiBase = "api.mistral.ai";
|
||||
expect(baseLLM.supportsCompletions()).toBe(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
this.apiBase?.includes("api.groq.com") ||
|
||||
this.apiBase?.includes("api.mistral.ai") ||
|
||||
this.apiBase?.includes(":1337") ||
|
||||
this.apiBase?.includes("integrate.api.nvidia.com") ||
|
||||
this._llmOptions.useLegacyCompletionsEndpoint?.valueOf() === false
|
||||
) {
|
||||
// Jan + Groq + Mistral don't support completions : (
|
||||
|
|
|
|||
33
core/llm/llms/Nvidia.ts
Normal file
33
core/llm/llms/Nvidia.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { LLMOptions, ModelProvider, ChatMessage } from "../../index.js";
|
||||
import OpenAI from "./OpenAI.js";
|
||||
|
||||
class Nvidia extends OpenAI {
|
||||
// NVIDIA NIMs currently limits the number of stops for Starcoder 2 to 4
|
||||
// https://docs.api.nvidia.com/nim/reference/bigcode-starcoder2-7b-infer
|
||||
protected maxStopWordsStarCoder = 4;
|
||||
static providerName: ModelProvider = "nvidia";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: "https://integrate.api.nvidia.com/v1/",
|
||||
useLegacyCompletionsEndpoint: false,
|
||||
};
|
||||
|
||||
protected _convertArgs(options: any, messages: ChatMessage[]) {
|
||||
const url = new URL(this.apiBase!);
|
||||
const finalOptions = {
|
||||
messages: messages.map(this._convertMessage),
|
||||
model: this._convertModelName(options.model),
|
||||
max_tokens: options.maxTokens,
|
||||
temperature: options.temperature,
|
||||
top_p: options.topP,
|
||||
frequency_penalty: options.frequencyPenalty,
|
||||
presence_penalty: options.presencePenalty,
|
||||
stop: options.model.includes("starcoder2")
|
||||
? options.stop?.slice(0, this.maxStopWordsStarCoder)
|
||||
: options.stop,
|
||||
};
|
||||
|
||||
return finalOptions;
|
||||
}
|
||||
}
|
||||
|
||||
export default Nvidia;
|
||||
|
|
@ -38,6 +38,7 @@ import TextGenWebUI from "./TextGenWebUI";
|
|||
import Together from "./Together";
|
||||
import WatsonX from "./WatsonX";
|
||||
import ContinueProxy from "./stubs/ContinueProxy";
|
||||
import Nvidia from "./Nvidia";
|
||||
|
||||
const LLMs = [
|
||||
Anthropic,
|
||||
|
|
@ -70,6 +71,7 @@ const LLMs = [
|
|||
Azure,
|
||||
WatsonX,
|
||||
OpenRouter,
|
||||
Nvidia,
|
||||
];
|
||||
|
||||
export async function llmFromDescription(
|
||||
|
|
|
|||
6
docs/static/schemas/config.json
vendored
6
docs/static/schemas/config.json
vendored
|
|
@ -191,7 +191,8 @@
|
|||
"azure",
|
||||
"msty",
|
||||
"watsonx",
|
||||
"openrouter"
|
||||
"openrouter",
|
||||
"nvidia"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
|
||||
|
|
@ -219,7 +220,8 @@
|
|||
"### 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)",
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
|
||||
"### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
|
||||
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)."
|
||||
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys).",
|
||||
"### NVIDIA NIMs\nNVIDIA offers a single API to access almost any language model. To find out more, visit the [LLM APIs Documentation](https://docs.api.nvidia.com/nim/reference/llm-apis).\nFor information specific to getting a key, please check out the [docs here](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog)"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@
|
|||
"azure",
|
||||
"msty",
|
||||
"watsonx",
|
||||
"openrouter"
|
||||
"openrouter",
|
||||
"nvidia"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
|
||||
|
|
@ -219,8 +220,8 @@
|
|||
"### 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)",
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
|
||||
"### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
|
||||
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)."
|
||||
],
|
||||
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys).",
|
||||
"### NVIDIA NIMs\nNVIDIA offers a single API to access almost any language model. To find out more, visit the [LLM APIs Documentation](https://docs.api.nvidia.com/nim/reference/llm-apis).\nFor information specific to getting a key, please check out the [docs here](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog)" ],
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@
|
|||
"azure",
|
||||
"msty",
|
||||
"watsonx",
|
||||
"openrouter"
|
||||
"openrouter",
|
||||
"nvidia"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
|
||||
|
|
@ -219,8 +220,8 @@
|
|||
"### 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)",
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
|
||||
"### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
|
||||
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)."
|
||||
],
|
||||
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys).",
|
||||
"### NVIDIA NIMs\nNVIDIA offers a single API to access almost any language model. To find out more, visit the [LLM APIs Documentation](https://docs.api.nvidia.com/nim/reference/llm-apis).\nFor information specific to getting a key, please check out the [docs here](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog)" ],
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
|
|
|
|||
|
|
@ -194,7 +194,8 @@
|
|||
"azure",
|
||||
"msty",
|
||||
"watsonx",
|
||||
"openrouter"
|
||||
"openrouter",
|
||||
"nvidia"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
|
||||
|
|
@ -222,7 +223,8 @@
|
|||
"### 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)",
|
||||
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
|
||||
"### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
|
||||
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)."
|
||||
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys).",
|
||||
"### NVIDIA NIMs\nNVIDIA offers a single API to access almost any language model. To find out more, visit the [LLM APIs Documentation](https://docs.api.nvidia.com/nim/reference/llm-apis).\nFor information specific to getting a key, please check out the [docs here](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog)"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@ export function constructLlmApi(config: LlmApiConfig): BaseLlmApi {
|
|||
...config,
|
||||
apiBase: "https://api.groq.com/openai/v1/",
|
||||
});
|
||||
case "nvidia":
|
||||
return new OpenAIApi({
|
||||
...config,
|
||||
apiBase: "https://integrate.api.nvidia.com/v1/",
|
||||
});
|
||||
case "fireworks":
|
||||
return new OpenAIApi({
|
||||
...config,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue