[Doc] Fix Qwen3-Omni modality documentation examples (#5173)
Signed-off-by: psv666 <2693925048@qq.com> Co-authored-by: amy-why-3459 <wuhaiyan17@huawei.com>
This commit is contained in:
1 parent
4fbbdfd250
commit
e9991a5907
2 files changed
+16
-10
No files matched your search
@@ -140,7 +140,7 @@ You can control output modalities to specify which types of output the model sho
|
|||||||
| Modalities | Output |
|
| Modalities | Output |
|
||||||
|------------|--------|
|
|------------|--------|
|
||||||
| `["text"]` | Text only |
|
| `["text"]` | Text only |
|
||||||
| `["audio"]` | Text + Audio |
|
| `["audio"]` | Audio only |
|
||||||
| `["text", "audio"]` | Text + Audio |
|
| `["text", "audio"]` | Text + Audio |
|
||||||
| Not specified | Text + Audio (default) |
|
| Not specified | Text + Audio (default) |
|
||||||
|
|
||||||
@@ -161,13 +161,16 @@ curl http://localhost:8091/v1/chat/completions \
|
|||||||
#### Text + Audio
|
#### Text + Audio
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl http://localhost:8091/v1/chat/completions \
|
response=$(curl -s http://localhost:8091/v1/chat/completions \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"model": "Qwen/Qwen3-Omni-30B-A3B-Instruct",
|
"model": "Qwen/Qwen3-Omni-30B-A3B-Instruct",
|
||||||
"messages": [{"role": "user", "content": "Describe vLLM in brief."}],
|
"messages": [{"role": "user", "content": "Describe vLLM in brief."}],
|
||||||
"modalities": ["audio"]
|
"modalities": ["text", "audio"]
|
||||||
}'
|
}')
|
||||||
|
|
||||||
|
echo "$response" | jq -r '.choices[0].message.content'
|
||||||
|
echo "$response" | jq -r '.choices[1].message.audio.data' | base64 -d > output.wav
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Python client
|
### Using Python client
|
||||||
@@ -205,7 +208,7 @@ client = OpenAI(base_url="http://localhost:8091/v1", api_key="EMPTY")
|
|||||||
response = client.chat.completions.create(
|
response = client.chat.completions.create(
|
||||||
model="Qwen/Qwen3-Omni-30B-A3B-Instruct",
|
model="Qwen/Qwen3-Omni-30B-A3B-Instruct",
|
||||||
messages=[{"role": "user", "content": "Describe vLLM in brief."}],
|
messages=[{"role": "user", "content": "Describe vLLM in brief."}],
|
||||||
modalities=["audio"]
|
modalities=["text", "audio"]
|
||||||
)
|
)
|
||||||
# Response contains two choices: one with text, one with audio
|
# Response contains two choices: one with text, one with audio
|
||||||
print(response.choices[0].message.content) # Text response
|
print(response.choices[0].message.content) # Text response
|
||||||
|
|||||||
@@ -353,13 +353,16 @@ curl http://localhost:8091/v1/chat/completions \
|
|||||||
#### Text + Audio
|
#### Text + Audio
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -s http://localhost:8091/v1/chat/completions \
|
response=$(curl -s http://localhost:8091/v1/chat/completions \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"model": "Qwen/Qwen3-Omni-30B-A3B-Instruct",
|
"model": "Qwen/Qwen3-Omni-30B-A3B-Instruct",
|
||||||
"messages": [{"role": "user", "content": "Describe vLLM in brief."}],
|
"messages": [{"role": "user", "content": "Describe vLLM in brief."}],
|
||||||
"modalities": ["audio"]
|
"modalities": ["text", "audio"]
|
||||||
}' | jq -r '.choices[0].message.audio.data' | base64 -d > output.wav
|
}')
|
||||||
|
|
||||||
|
echo "$response" | jq -r '.choices[0].message.content'
|
||||||
|
echo "$response" | jq -r '.choices[1].message.audio.data' | base64 -d > output.wav
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Python client
|
### Using Python client
|
||||||
@@ -456,8 +459,8 @@ response = client.chat.completions.create(
|
|||||||
modalities=["audio"],
|
modalities=["audio"],
|
||||||
extra_body={"speaker": "chelsie"}
|
extra_body={"speaker": "chelsie"}
|
||||||
)
|
)
|
||||||
# Audio uses the specified speaker
|
# Audio-only responses contain a single audio choice
|
||||||
print(response.choices[1].message.audio)
|
print(response.choices[0].message.audio)
|
||||||
```
|
```
|
||||||
|
|
||||||
Supported speaker names depend on the model (e.g. `Ethan`, `Chelsie`, `Aiden`). Omit `speaker` to use the default.
|
Supported speaker names depend on the model (e.g. `Ethan`, `Chelsie`, `Aiden`). Omit `speaker` to use the default.
|
||||||
|
|||||||
Reference in new issue
Block a user