Skip to content

Commit 6294505

Browse files
authored
Merge pull request #19 from second-state/qwen
add Qwen
2 parents 017e383 + 1c0b93f commit 6294505

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

doc/docs/server/qwen.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
sidebar_position: 7
3+
---
4+
5+
# Qwen series models
6+
7+
Qwen is one of the best open-sourced LLMs in the world. Besides the open source models, Alibaba Cloud also offers multiple commercial models through their Bailian platform. In this article, we will show you how to integrate Qwen series models with EchoKit, which is especially useful if you're in China.
8+
9+
## Prerequisites
10+
11+
Before setting up your Qwen pipeline, ensure you have:
12+
* **EchoKit server source code** – Follow the [guide](./echokit-server.md) if you haven't already
13+
* **Alibaba Cloud API key** – Obtain from [Aliyun Bailian Console](https://bailian.console.aliyun.com/#/home)
14+
15+
## Configuration
16+
17+
Create or modify your `config.toml` file with the appropriate sections or use [the pre-set examples](https://github.com/second-state/echokit_server/blob/main/examples/alibailian/config.toml).:
18+
19+
### Complete Configuration Example
20+
21+
```toml
22+
[asr]
23+
paraformer_token = "your-paraformer-api-key"
24+
25+
[llm]
26+
llm_chat_url = "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"
27+
api_key = "your-bailian-api-key"
28+
model = "qwen-plus"
29+
history = 5
30+
31+
[tts]
32+
platform = "CosyVoice"
33+
token = "your-cosyvoice-api-key"
34+
speaker = "longhua_v2"
35+
```
36+
37+
### ASR Configuration
38+
39+
For the ASR (Automatic Speech Recognition) component, EchoKit only supports the Paraformer model. All you need to do is insert your API key:
40+
41+
```toml
42+
[asr]
43+
paraformer_token = "your-paraformer-api-key"
44+
```
45+
46+
### LLM Configuration
47+
48+
For the LLM component, you can use any text generation model from the Bailian platform. Popular Qwen models include:
49+
- `qwen-plus` - Balanced performance and cost
50+
- `qwen-turbo` - Faster inference, lower cost
51+
- `qwen-max` - Highest performance
52+
- `qwen-long` - Extended context length
53+
54+
```toml
55+
[llm]
56+
llm_chat_url = "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"
57+
api_key = "your-bailian-api-key"
58+
model = "qwen-plus"
59+
history = 5
60+
```
61+
62+
**Configuration Options:**
63+
- `llm_chat_url`: The Bailian API endpoint (keep as shown)
64+
- `api_key`: Your Bailian platform API key
65+
- `model`: Choose from available Qwen models
66+
- `history`: Number of previous messages to include for context
67+
68+
### TTS Configuration
69+
70+
EchoKit supports CosyVoice v1 and CosyVoice v2 for text-to-speech. The default is CosyVoice v2:
71+
72+
```toml
73+
[tts]
74+
platform = "CosyVoice"
75+
token = "your-cosyvoice-api-key"
76+
speaker = "longhua_v2"
77+
```
78+
79+
**Available Speakers:**
80+
You can choose your favorite one [here](https://help.aliyun.com/zh/model-studio/cosyvoice-java-sdk#722dd7ca66a6x).
81+
- `longhua_v2` - Natural Chinese voice.
82+
- `longxiaochun` - Alternative Chinese voice
83+
- `longyueyue` - Another voice option
84+
85+
## Starting the Server
86+
87+
After editing the configuration file, restart the EchoKit server to apply the changes.
88+
89+
If you're using a custom configuration file path, use this command:
90+
91+
```bash
92+
./target/release/echokit_server ./examples/alibailian/config.toml
93+
```
94+
95+
For the default configuration location:
96+
97+
```bash
98+
./target/release/echokit_server
99+
```
100+
101+
That's it.

0 commit comments

Comments
 (0)