diff --git a/core/config/types.ts b/core/config/types.ts index 84e888244..e69c312ab 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -600,6 +600,7 @@ declare global { | "msty" | "watsonx" | "openrouter" + | "sambanova" | "nvidia"; export type ModelName = diff --git a/core/index.d.ts b/core/index.d.ts index 8872cc7c9..0d8a13d93 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -636,6 +636,7 @@ type ModelProvider = | "msty" | "watsonx" | "openrouter" + | "sambanova" | "nvidia" | "vllm" | "mock"; diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 1696bd674..523bcb028 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -45,6 +45,7 @@ const PROVIDER_HANDLES_TEMPLATING: ModelProvider[] = [ "sagemaker", "continue-proxy", "mistral", + "sambanova", ]; const PROVIDER_SUPPORTS_IMAGES: ModelProvider[] = [ @@ -108,6 +109,7 @@ const PARALLEL_PROVIDERS: ModelProvider[] = [ "free-trial", "replicate", "together", + "sambanova", ]; function llmCanGenerateInParallel( diff --git a/core/llm/llms/SambaNova.ts b/core/llm/llms/SambaNova.ts new file mode 100644 index 000000000..2b409dcde --- /dev/null +++ b/core/llm/llms/SambaNova.ts @@ -0,0 +1,22 @@ +import type { LLMOptions, ModelProvider } from "../../index.js"; + +import OpenAI from "./OpenAI.js"; + +class SambaNova extends OpenAI { + static providerName: ModelProvider = "sambanova"; + static defaultOptions: Partial = { + apiBase: "https://api.sambanova.ai/v1/", + }; + + private static MODEL_IDS: { [name: string]: string } = { + "llama3.1-8b": "Meta-Llama-3.1-8B-Instruct", + "llama3.1-70b": "Meta-Llama-3.1-70B-Instruct", + "llama3.1-405b": "Meta-Llama-3.1-405B-Instruct", + }; + + protected _convertModelName(model: string) { + return SambaNova.MODEL_IDS[model] || this.model; + } +} + +export default SambaNova; diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 55b6e1f7e..2b894f418 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -36,6 +36,7 @@ import OpenAI from "./OpenAI"; import OpenRouter from "./OpenRouter"; import Replicate from "./Replicate"; import SageMaker from "./SageMaker"; +import SambaNova from "./SambaNova"; import TextGenWebUI from "./TextGenWebUI"; import Together from "./Together"; import Vllm from "./Vllm"; @@ -75,6 +76,7 @@ const LLMs = [ OpenRouter, Nvidia, Vllm, + SambaNova, Mock, ]; diff --git a/docs/docs/reference/Model Providers/SambaNova.md b/docs/docs/reference/Model Providers/SambaNova.md new file mode 100644 index 000000000..e19cc70d7 --- /dev/null +++ b/docs/docs/reference/Model Providers/SambaNova.md @@ -0,0 +1,18 @@ +# SambaNova Cloud + +The SambaNova Cloud is a cloud platform for running large AI models with the world record Llama 3.1 70B/405B performance. You can sign up [here](https://cloud.sambanova.ai/), copy your API key on the initial welcome screen, and then hit the play button on any model from the [model list](https://community.sambanova.ai/t/quick-start-guide/104). Change `~/.continue/config.json` to look like this: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "SambaNova Llama 3.1 405B", + "provider": "sambanova", + "model": "llama3.1-405b", + "apiKey": "YOUR_API_KEY" + } + ] +} +``` + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/SambaNova.ts) diff --git a/docs/docs/setup/model-providers.md b/docs/docs/setup/model-providers.md index f9feb3482..ce4cb847d 100644 --- a/docs/docs/setup/model-providers.md +++ b/docs/docs/setup/model-providers.md @@ -80,6 +80,7 @@ You can run open-source LLMs with cloud services like: - [Replicate](../reference/Model%20Providers/replicatellm.md) - [Deepinfra](../reference/Model%20Providers/deepinfra.md) - [Groq](../reference/Model%20Providers/openai.md) (OpenAI compatible API) +- [SambaNova](../reference/Model%20Providers/sambanova.md) ### Commercial models diff --git a/docs/docs/walkthroughs/llama3.1.md b/docs/docs/walkthroughs/llama3.1.md index ac3fbe059..3977dd412 100644 --- a/docs/docs/walkthroughs/llama3.1.md +++ b/docs/docs/walkthroughs/llama3.1.md @@ -92,3 +92,24 @@ Replicate makes it easy to host and run open-source AI with an API. ] } ``` + +## SambaNova + +SambaNova Cloud provides world record Llama3.1 70B/405B serving. + +1. Create an account [here](https://cloud.sambanova.ai/) +2. Copy your API key +3. Update your Continue config file like this: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "SambaNova Llama 3.1 405B", + "provider": "sambanova", + "model": "llama3.1-405b", + "apiKey": "YOUR_API_KEY" + } + ] +} +``` \ No newline at end of file diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 1c8047bf7..04c730395 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -192,6 +192,7 @@ "msty", "watsonx", "openrouter", + "sambanova", "nvidia", "vllm" ], @@ -398,7 +399,8 @@ "huggingface-inference-api", "replicate", "together", - "cloudflare" + "cloudflare", + "sambanova" ] } }, @@ -1300,6 +1302,35 @@ }, "required": ["watsonxUrl", "watsonxProjectId"] } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["sambanova"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b" + ] + }, + { + "type": "string" + } + ], + "markdownDescription": "Select a pre-defined option." + } + } + } } ] }, diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 1c8047bf7..04c730395 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -192,6 +192,7 @@ "msty", "watsonx", "openrouter", + "sambanova", "nvidia", "vllm" ], @@ -398,7 +399,8 @@ "huggingface-inference-api", "replicate", "together", - "cloudflare" + "cloudflare", + "sambanova" ] } }, @@ -1300,6 +1302,35 @@ }, "required": ["watsonxUrl", "watsonxProjectId"] } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["sambanova"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b" + ] + }, + { + "type": "string" + } + ], + "markdownDescription": "Select a pre-defined option." + } + } + } } ] }, diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 1c8047bf7..04c730395 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -192,6 +192,7 @@ "msty", "watsonx", "openrouter", + "sambanova", "nvidia", "vllm" ], @@ -398,7 +399,8 @@ "huggingface-inference-api", "replicate", "together", - "cloudflare" + "cloudflare", + "sambanova" ] } }, @@ -1300,6 +1302,35 @@ }, "required": ["watsonxUrl", "watsonxProjectId"] } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["sambanova"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b" + ] + }, + { + "type": "string" + } + ], + "markdownDescription": "Select a pre-defined option." + } + } + } } ] }, diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 5eb03cd3b..579b590e2 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -195,6 +195,7 @@ "msty", "watsonx", "openrouter", + "sambanova", "nvidia", "vllm" ], @@ -410,7 +411,8 @@ "huggingface-inference-api", "replicate", "together", - "cloudflare" + "cloudflare", + "sambanova" ] } }, @@ -1442,6 +1444,39 @@ "watsonxProjectId" ] } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "sambanova" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "llama3.1-8b", + "llama3.1-70b", + "llama3.1-405b" + ] + }, + { + "type": "string" + } + ], + "markdownDescription": "Select a pre-defined option." + } + } + } } ] }, diff --git a/gui/public/logos/sambanova.png b/gui/public/logos/sambanova.png new file mode 100644 index 000000000..6f95c6a58 Binary files /dev/null and b/gui/public/logos/sambanova.png differ diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index 4763f77ff..310523bcb 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -67,6 +67,7 @@ export const models: { [key: string]: ModelPackage } = { "together", "llama.cpp", "replicate", + "sambanova", ], isOpenSource: true, }, @@ -741,7 +742,7 @@ export const models: { [key: string]: ModelPackage } = { params: { model: "ibm/granite-20b-code-instruct", contextLength: 20_000, - title: "watsonx - Granite Code 20b" + title: "watsonx - Granite Code 20b", }, providerOptions: ["watsonx"], icon: "watsonx.png", diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 2cd32b876..71c405ab4 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -580,4 +580,34 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo ], collectInputFor: [...completionParamsInputsConfigs], }, + sambanova: { + title: "SambaNova Cloud", + provider: "sambanova", + refPage: "sambanova", + description: + "Use SambaNova Cloud for Llama3.1 fast inference performance", + icon: "sambanova.png", + longDescription: `The SambaNova Cloud is a cloud platform for running large AI models with the world record Llama 3.1 70B/405B performance. You can sign up [here](https://cloud.sambanova.ai/)`, + tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], + params: { + apiKey: "", + }, + collectInputFor: [ + { + inputType: "text", + key: "apiKey", + label: "API Key", + placeholder: "Enter your SambaNova Cloud API key", + required: true, + }, + ...completionParamsInputsConfigs, + ], + packages: [ + models.llama31Chat, + ].map((p) => { + p.params.contextLength = 4096; + return p; + }), + apiKeyUrl: "https://cloud.sambanova.ai/apis", + }, }; diff --git a/packages/openai-adapters/src/index.ts b/packages/openai-adapters/src/index.ts index 3a47980bc..261eaf090 100644 --- a/packages/openai-adapters/src/index.ts +++ b/packages/openai-adapters/src/index.ts @@ -68,6 +68,11 @@ export function constructLlmApi(config: LlmApiConfig): BaseLlmApi { ...config, apiBase: "https://api.together.xyz/v1/", }); + case "sambanova": + return new OpenAIApi({ + ...config, + apiBase: "https://api.sambanova.ai/v1/", + }); default: throw new Error(`Unsupported LLM API format: ${config.provider}`); } diff --git a/packages/openai-adapters/test/main.test.ts b/packages/openai-adapters/test/main.test.ts index c4615a05b..77cae38ec 100644 --- a/packages/openai-adapters/test/main.test.ts +++ b/packages/openai-adapters/test/main.test.ts @@ -204,6 +204,12 @@ const COMPLETION_TESTS: ({ chatOnly?: boolean } & LlmApiConfig)[] = [ apiKey: process.env.TOGETHER_API_KEY!, chatOnly: true, }, + { + provider: "sambanova", + model: "Meta-Llama-3.1-8B-Instruct", + apiKey: process.env.SAMBANOVA_API_KEY!, + chatOnly: true, + }, ]; const FIM_TESTS: LlmApiConfig[] = [