-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3532 from vercelInfrAI/main
Add new LLM API Provider: Novita AI
- Loading branch information
Showing
19 changed files
with
300 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import OpenAI from "./OpenAI.js"; | ||
|
||
import type { CompletionOptions, LLMOptions } from "../../index.js"; | ||
|
||
class Novita extends OpenAI { | ||
static providerName = "novita"; | ||
static defaultOptions: Partial<LLMOptions> = { | ||
apiBase: "https://api.novita.ai/v3/openai/", | ||
}; | ||
|
||
private static MODEL_IDS: { [name: string]: string } = { | ||
"llama3-8b": "meta-llama/llama-3-8b-instruct", | ||
"llama3-70b": "meta-llama/llama-3-70b-instruct", | ||
"llama3.1-8b": "meta-llama/llama-3.1-8b-instruct", | ||
"llama3.1-70b": "meta-llama/llama-3.1-70b-instruct", | ||
"llama3.1-405b": "meta-llama/llama-3.1-405b-instruct", | ||
"llama3.2-1b": "meta-llama/llama-3.2-1b-instruct", | ||
"llama3.2-3b": "meta-llama/llama-3.2-3b-instruct", | ||
"llama3.2-11b": "meta-llama/llama-3.2-11b-vision-instruct", | ||
"llama3.3-70b": "meta-llama/llama-3.3-70b-instruct", | ||
"mistral-nemo": "mistralai/mistral-nemo", | ||
"mistral-7b": "mistralai/mistral-7b-instruct", | ||
}; | ||
|
||
protected _convertModelName(model: string) { | ||
return Novita.MODEL_IDS[model] || this.model; | ||
} | ||
|
||
protected async *_streamComplete( | ||
prompt: string, | ||
signal: AbortSignal, | ||
options: CompletionOptions, | ||
): AsyncGenerator<string> { | ||
for await (const chunk of this._legacystreamComplete( | ||
prompt, | ||
signal, | ||
options, | ||
)) { | ||
yield chunk; | ||
} | ||
} | ||
} | ||
|
||
export default Novita; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Novita | ||
|
||
[Novita AI](https://novita.ai?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link) offers an affordable, reliable, and simple inference platform with scalable [LLM API](https://novita.ai/docs/model-api/reference/introduction.html), empowering developers to build AI applications. Try the [Novita AI Llama 3 API Demo](https://novita.ai/model-api/product/llm-api/playground/meta-llama-llama-3.1-70b-instruct?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link) today!. You can sign up [here](https://novita.ai/user/login?&redirect=/&utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link), copy your API key on the [Key Management](https://novita.ai/settings/key-management?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link), and then hit the play button on any model from the [Novita AI Models list](https://novita.ai/llm-api?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link). Change `~/.continue/config.json` to look like this: | ||
|
||
```json title="config.json" | ||
{ | ||
"models": [ | ||
{ | ||
"title": "Llama 3.1 8B", | ||
"provider": "novita", | ||
"model": "meta-llama/llama-3.1-8b-instruct", | ||
"apiKey": "YOUR_API_KEY" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Novita.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...docusaurus-plugin-content-docs/current/customize/model-providers/more/novita.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Novita | ||
|
||
[Novita AI](https://novita.ai?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link) 提供了一个经济实惠、可靠且简单的推理平台。你可以在 [这里](https://novita.ai/user/login?&redirect=/&utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link) 注册,在 [Key Management](https://novita.ai/settings/key-management?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link)复制你的 API key ,然后在 [Novita 模型列表](https://novita.ai/llm-api?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link) 的任何模型上点击 Try it now 按钮。修改 `~/.continue/config.json` 像这样: | ||
|
||
```json title="config.json" | ||
{ | ||
"models": [ | ||
{ | ||
"title": "Llama 3.1 8b", | ||
"provider": "Novita", | ||
"model": "meta-llama/llama-3.1-8b-instruct", | ||
"apiKey": "YOUR_API_KEY" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
[查看代码](https://github.com/continuedev/continue/blob/main/core/llm/llms/Novita.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.