Skip to content

Commit 7c931ba

Browse files
committed
feat(model/qwen3-tts-realtime):support instruct param, update audio ws connection auth config bear -> Bear
1 parent 16c9434 commit 7c931ba

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

dashscope/audio/qwen_omni/omni_realtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _get_websocket_header(self):
168168
)
169169
headers = {
170170
"user-agent": ua,
171-
"Authorization": "bearer " + self.apikey,
171+
"Authorization": "Bearer " + self.apikey,
172172
}
173173
if self.user_headers:
174174
headers = {**self.user_headers, **headers}

dashscope/audio/qwen_tts_realtime/qwen_tts_realtime.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _get_websocket_header(self):
120120
)
121121
headers = {
122122
"user-agent": ua,
123-
"Authorization": "bearer " + self.apikey,
123+
"Authorization": "Bearer " + self.apikey,
124124
}
125125
if self.user_headers:
126126
headers = {**self.user_headers, **headers}
@@ -177,6 +177,8 @@ def update_session(
177177
bit_rate: int = None,
178178
language_type: str = None,
179179
enable_tn: bool = None,
180+
instructions: str = None,
181+
optimize_instructions: bool = None,
180182
**kwargs,
181183
) -> None:
182184
"""
@@ -206,6 +208,10 @@ def update_session(
206208
bit_rate for tts, support 6~510,default is 128kbps. only work on format: opus/mp3 # noqa: E501 # pylint: disable=line-too-long
207209
enable_tn: bool
208210
enable text normalization for tts, default is None
211+
instructions: str
212+
instructions for tts, default is None
213+
optimize_instructions: bool
214+
optimize_instructions for tts, default is None
209215
"""
210216
self.config = {
211217
"voice": voice,
@@ -230,6 +236,10 @@ def update_session(
230236

231237
if language_type is not None:
232238
self.config["language_type"] = language_type
239+
if instructions is not None:
240+
self.config["instructions"] = instructions
241+
if optimize_instructions is not None:
242+
self.config["optimize_instructions"] = optimize_instructions
233243
self.config.update(kwargs)
234244
self.__send_str(
235245
json.dumps(

dashscope/audio/tts_v2/speech_synthesizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def getWebsocketHeaders(self, headers, workspace):
147147
)
148148
self.headers = {
149149
"user-agent": ua,
150-
"Authorization": "bearer " + self.apikey,
150+
"Authorization": "Bearer " + self.apikey,
151151
}
152152
if headers:
153153
self.headers = {**self.headers, **headers}

dashscope/multimodal/multimodal_dialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def get_websocket_header(self, api_key):
445445
)
446446
self.ws_headers = {
447447
"User-Agent": ua,
448-
"Authorization": f"bearer {api_key}",
448+
"Authorization": f"Bearer {api_key}",
449449
"Accept": "application/json",
450450
}
451451
logger.info("websocket header: %s", self.ws_headers)

dashscope/multimodal/tingwu/tingwu_realtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def get_websocket_header(self, api_key):
345345
)
346346
self.ws_headers = {
347347
"User-Agent": ua,
348-
"Authorization": f"bearer {api_key}",
348+
"Authorization": f"Bearer {api_key}",
349349
"Accept": "application/json",
350350
}
351351
logger.info("websocket header: %s", self.ws_headers)

0 commit comments

Comments
 (0)