diff --git a/docs/user_guide/examples/online_serving/qwen2_5_omni.md b/docs/user_guide/examples/online_serving/qwen2_5_omni.md index e54ffe6ff..867d44e16 100644 --- a/docs/user_guide/examples/online_serving/qwen2_5_omni.md +++ b/docs/user_guide/examples/online_serving/qwen2_5_omni.md @@ -74,13 +74,86 @@ bash run_curl_multimodal_generation.sh mixed_modalities ``` ## Modality control -If you want to control output modalities, e.g. only output text, you can run the command below: + +You can control output modalities to specify which types of output the model should generate. This is useful when you only need text output and want to skip audio generation stages for better performance. + +### Supported modalities + +| Modalities | Output | +|------------|--------| +| `["text"]` | Text only | +| `["audio"]` | Text + Audio | +| `["text", "audio"]` | Text + Audio | +| Not specified | Text + Audio (default) | + +### Using curl + +#### Text only + +```bash +curl http://localhost:8091/v1/chat/completions \ + -H "Content-Type: application/json" \ + -d '{ + "model": "Qwen/Qwen2.5-Omni-7B", + "messages": [{"role": "user", "content": "Describe vLLM in brief."}], + "modalities": ["text"] + }' +``` + +#### Text + Audio + +```bash +curl http://localhost:8091/v1/chat/completions \ + -H "Content-Type: application/json" \ + -d '{ + "model": "Qwen/Qwen2.5-Omni-7B", + "messages": [{"role": "user", "content": "Describe vLLM in brief."}], + "modalities": ["audio"] + }' +``` + +### Using Python client + ```bash python openai_chat_completion_client_for_multimodal_generation.py \ --query-type mixed_modalities \ --modalities text ``` +### Using OpenAI Python SDK + +#### Text only + +```python +from openai import OpenAI + +client = OpenAI(base_url="http://localhost:8091/v1", api_key="EMPTY") + +response = client.chat.completions.create( + model="Qwen/Qwen2.5-Omni-7B", + messages=[{"role": "user", "content": "Describe vLLM in brief."}], + modalities=["text"] +) +print(response.choices[0].message.content) +``` + +#### Text + Audio + +```python +from openai import OpenAI + +client = OpenAI(base_url="http://localhost:8091/v1", api_key="EMPTY") + +response = client.chat.completions.create( + model="Qwen/Qwen2.5-Omni-7B", + messages=[{"role": "user", "content": "Describe vLLM in brief."}], + modalities=["audio"] +) +# Response contains two choices: one with text, one with audio +print(response.choices[0].message.content) # Text response +print(response.choices[1].message.audio) # Audio response +``` + ## Run Local Web UI Demo This Web UI demo allows users to interact with the model through a web browser. diff --git a/docs/user_guide/examples/online_serving/qwen3_omni.md b/docs/user_guide/examples/online_serving/qwen3_omni.md index 320271f89..5b6c3a7b2 100644 --- a/docs/user_guide/examples/online_serving/qwen3_omni.md +++ b/docs/user_guide/examples/online_serving/qwen3_omni.md @@ -82,13 +82,86 @@ sudo apt install ffmpeg ``` ## Modality control -If you want to control output modalities, e.g. only output text, you can run the command below: + +You can control output modalities to specify which types of output the model should generate. This is useful when you only need text output and want to skip audio generation stages for better performance. + +### Supported modalities + +| Modalities | Output | +|------------|--------| +| `["text"]` | Text only | +| `["audio"]` | Text + Audio | +| `["text", "audio"]` | Text + Audio | +| Not specified | Text + Audio (default) | + +### Using curl + +#### Text only + +```bash +curl http://localhost:8091/v1/chat/completions \ + -H "Content-Type: application/json" \ + -d '{ + "model": "Qwen/Qwen3-Omni-30B-A3B-Instruct", + "messages": [{"role": "user", "content": "Describe vLLM in brief."}], + "modalities": ["text"] + }' +``` + +#### Text + Audio + +```bash +curl http://localhost:8091/v1/chat/completions \ + -H "Content-Type: application/json" \ + -d '{ + "model": "Qwen/Qwen3-Omni-30B-A3B-Instruct", + "messages": [{"role": "user", "content": "Describe vLLM in brief."}], + "modalities": ["audio"] + }' +``` + +### Using Python client + ```bash python openai_chat_completion_client_for_multimodal_generation.py \ --query-type use_image \ --modalities text ``` +### Using OpenAI Python SDK + +#### Text only + +```python +from openai import OpenAI + +client = OpenAI(base_url="http://localhost:8091/v1", api_key="EMPTY") + +response = client.chat.completions.create( + model="Qwen/Qwen3-Omni-30B-A3B-Instruct", + messages=[{"role": "user", "content": "Describe vLLM in brief."}], + modalities=["text"] +) +print(response.choices[0].message.content) +``` + +#### Text + Audio + +```python +from openai import OpenAI + +client = OpenAI(base_url="http://localhost:8091/v1", api_key="EMPTY") + +response = client.chat.completions.create( + model="Qwen/Qwen3-Omni-30B-A3B-Instruct", + messages=[{"role": "user", "content": "Describe vLLM in brief."}], + modalities=["audio"] +) +# Response contains two choices: one with text, one with audio +print(response.choices[0].message.content) # Text response +print(response.choices[1].message.audio) # Audio response +``` + ## Run Local Web UI Demo This Web UI demo allows users to interact with the model through a web browser.