Merge pull request #2230 from ztuowen/sambanova_api

Add SambaNova Cloud API
This commit is contained in:
Nate Sesti 2024-09-10 09:32:47 -07:00 • committed by GitHub
commit 7d7207dcc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 243 additions and 5 deletions

View file

@ -600,6 +600,7 @@ declare global {
| "msty"
| "watsonx"
| "openrouter"
| "sambanova"
| "nvidia";
export type ModelName =

1
core/index.d.ts vendored
View file

@ -636,6 +636,7 @@ type ModelProvider =
| "msty"
| "watsonx"
| "openrouter"
| "sambanova"
| "nvidia"
| "vllm"
| "mock";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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"
}
]
}
```

View file

@ -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."
}
}
}
}
]
},

View file

@ -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."
}
}
}
}
]
},

View file

@ -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."
}
}
}
}
]
},

View file

@ -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."
}
}
}
}
]
},

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

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

View file

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

View file

@ -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}`);
}

View file

@ -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[] = [