-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #2974 from AnoyiX/main
support `Qwen/Qwen2.5-Coder-32B-Instruct` model provided by siliconflow
- v0.9.269-vscode
- v0.9.268-vscode
- v0.9.267-vscode
- v0.9.266-vscode
- v0.9.265-vscode
- v0.9.264-vscode
- v0.9.263-vscode
- v0.9.262-vscode
- v0.9.261-vscode
- v0.9.260-vscode
- v0.9.259-vscode
- v0.9.258-vscode
- v0.9.257-vscode
- v0.9.256-vscode
- v0.9.255-vscode
- v0.9.254-vscode
- v0.9.253-vscode
- v0.9.252-vscode
- v0.9.251-vscode
- v0.9.250-vscode
- v0.9.249-vscode
- v0.9.248-vscode
- v0.9.247-vscode
- v0.9.246-vscode
- v0.9.245-vscode
- v0.9.244-vscode
- v0.9.243-vscode
- v0.9.242-vscode
- v0.9.240-vscode
- v0.9.239-vscode
- v0.9.238-vscode
- v0.9.237-vscode
- v0.8.68-vscode
- v0.8.67-vscode-release-actual
- v0.8.66-vscode
- v0.8.65-vscode
- v0.8.64-vscode
- v0.8.63-vscode
- v0.8.62-vscode
- v0.8.61-vscode
- v0.0.91-jetbrains
- v0.0.90-jetbrains
- v0.0.89-jetbrains
- v0.0.88-jetbrains
- v0.0.87-jetbrains
- v0.0.86-jetbrains
- v0.0.85-jetbrains
- v0.0.84-jetbrains
- v0.0.83-jetbrains
- pe/win-arm64-lancedb-pt2
- pe/unsupported-cpu-check-pt-2
Showing
15 changed files
with
289 additions
and
22 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
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,14 @@ | ||
import { EmbeddingsProviderName, EmbedOptions } from "../.."; | ||
|
||
import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider"; | ||
|
||
class SiliconFlowEmbeddingsProvider extends OpenAIEmbeddingsProvider { | ||
static providerName: EmbeddingsProviderName = "siliconflow"; | ||
|
||
static defaultOptions: Partial<EmbedOptions> | undefined = { | ||
apiBase: "https://api.siliconflow.cn/v1/", | ||
model: "BAAI/bge-m3", | ||
}; | ||
} | ||
|
||
export default SiliconFlowEmbeddingsProvider; |
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 |
---|---|---|
|
@@ -333,4 +333,4 @@ class OpenAI extends BaseLLM { | |
} | ||
} | ||
|
||
export default OpenAI; | ||
export default OpenAI; |
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,58 @@ | ||
import { CompletionOptions, LLMOptions, ModelProvider } from "../../index.js"; | ||
import { streamSse } from "../stream.js"; | ||
import { osModelsEditPrompt } from "../templates/edit.js"; | ||
|
||
import OpenAI from "./OpenAI.js"; | ||
|
||
class SiliconFlow extends OpenAI { | ||
static providerName: ModelProvider = "siliconflow"; | ||
static defaultOptions: Partial<LLMOptions> = { | ||
apiBase: "https://api.siliconflow.cn/v1/", | ||
model: "Qwen/Qwen2.5-Coder-32B-Instruct", | ||
promptTemplates: { | ||
edit: osModelsEditPrompt, | ||
}, | ||
useLegacyCompletionsEndpoint: false, | ||
}; | ||
maxStopWords: number | undefined = 16; | ||
|
||
supportsFim(): boolean { | ||
return true; | ||
} | ||
|
||
async *_streamFim( | ||
prefix: string, | ||
suffix: string, | ||
signal: AbortSignal, | ||
options: CompletionOptions, | ||
): AsyncGenerator<string> { | ||
const endpoint = new URL("completions", this.apiBase); | ||
const resp = await this.fetch(endpoint, { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
model: options.model, | ||
prompt: prefix, | ||
suffix, | ||
max_tokens: options.maxTokens, | ||
temperature: options.temperature, | ||
top_p: options.topP, | ||
frequency_penalty: options.frequencyPenalty, | ||
presence_penalty: options.presencePenalty, | ||
stop: options.stop, | ||
stream: true, | ||
}), | ||
headers: { | ||
"Content-Type": "application/json", | ||
Accept: "application/json", | ||
Authorization: `Bearer ${this.apiKey}`, | ||
}, | ||
signal | ||
}); | ||
for await (const chunk of streamSse(resp)) { | ||
yield chunk.choices[0].text; | ||
} | ||
} | ||
|
||
} | ||
|
||
export default SiliconFlow; |
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,49 @@ | ||
--- | ||
title: SiliconFlow | ||
--- | ||
|
||
:::info | ||
|
||
You can get an API key from the [Silicon Cloud](https://cloud.siliconflow.cn/account/ak). | ||
|
||
::: | ||
|
||
## Chat model | ||
|
||
We recommend configuring **Qwen/Qwen2.5-Coder-32B-Instruct** as your chat model. | ||
|
||
```json title="config.json" | ||
{ | ||
"models": [ | ||
{ | ||
"title": "Qwen", | ||
"provider": "siliconflow", | ||
"model": "Qwen/Qwen2.5-Coder-32B-Instruct", | ||
"apiKey": "[API_KEY]" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Autocomplete model | ||
|
||
We recommend configuring **Qwen/Qwen2.5-Coder-7B-Instruct** as your autocomplete model. | ||
|
||
```json title="config.json" | ||
{ | ||
"tabAutocompleteModel": { | ||
"title": "Qwen", | ||
"provider": "siliconflow", | ||
"model": "Qwen/Qwen2.5-Coder-7B-Instruct", | ||
"apiKey": "[API_KEY]" | ||
} | ||
} | ||
``` | ||
|
||
## Embeddings model | ||
|
||
SiliconFlow provide some embeddings models, [Click here](https://siliconflow.cn/models) to see a list of embeddings models. | ||
|
||
## Reranking model | ||
|
||
SiliconFlow provide some reranking models, [Click here](https://siliconflow.cn/models) to see a list of reranking models. |
51 changes: 51 additions & 0 deletions
51
...aurus-plugin-content-docs/current/customize/model-providers/more/siliconflow.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,51 @@ | ||
--- | ||
title: 硅基流动 | ||
--- | ||
|
||
:::info | ||
|
||
你可以从 [Silicon Cloud](https://cloud.siliconflow.cn/account/ak) 获取 API key 。 | ||
|
||
::: | ||
|
||
## 聊天模型 | ||
|
||
我们推荐配置 **Qwen/Qwen2.5-Coder-32B-Instruct** 作为你的聊天模型。 | ||
|
||
```json title="config.json" | ||
{ | ||
"models": [ | ||
{ | ||
"title": "Qwen", | ||
"provider": "siliconflow", | ||
"model": "Qwen/Qwen2.5-Coder-32B-Instruct", | ||
"apiKey": "[API_KEY]" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## 自动补全模型 | ||
|
||
我们推荐配置 **Qwen/Qwen2.5-Coder-7B-Instruct** 作为你的自动补全模型。 | ||
|
||
```json title="config.json" | ||
{ | ||
"tabAutocompleteModel": { | ||
"title": "Qwen", | ||
"provider": "siliconflow", | ||
"model": "Qwen/Qwen2.5-Coder-7B-Instruct", | ||
"apiKey": "[API_KEY]" | ||
} | ||
} | ||
``` | ||
|
||
## 嵌入模型 | ||
|
||
SiliconFlow 提供了一些嵌入模型,[点击这里](https://siliconflow.cn/models) 查看所有的嵌入模型. | ||
|
||
## 重排序模型 | ||
|
||
SiliconFlow 提供了一些重排序模型,[点击这里](https://siliconflow.cn/models) 查看所有的重排序模型. | ||
|
||
[Click here](https://siliconflow.cn/models) to see a list of reranking models. |
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
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