类class
agentscope.ttsDashScopeTTSModel
class DashScopeTTSModel(TTSModelBase)
源码Source
agentscope/tts/_dashscope/_model.py:51–258DashScope TTS 模型,处理低延迟的实时语音与多模态交互。位于 agentscope.tts 包,继承自 TTSModelBase。核心成员包括 synthesize。
DashScope TTS model implementation using the MultiModalConversation API. Declared in agentscope.tts. Extends TTSModelBase.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Parameters | 类class | 参数,处理低延迟的实时语音与多模态交互。 Frontend-exposed parameters for DashScope TTS models. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
def __init__(credential: DashScopeCredential, model: str = 'qwen3-tts-flash', parameters: 'DashScopeTTSModel.Parameters… | 初始化 `DashScopeTTSModel` 实例。 Initialize the DashScope TTS model. |
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
type | Literal['dashscope_tts'] | 类型字段。 | 'dashscope_tts' |
realtime | bool | 实时字段。 | False |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
async def synthesize(text: str | None = None, **kwargs: Any) -> TTSResponse | AsyncGenerator[TTSResponse, None]async | 执行 `synthesize` 方法。 Call the DashScope TTS API to synthesize speech from text. |
构造器详情Constructor Detail
DashScopeTTSModel
def __init__(credential: DashScopeCredential, model: str = 'qwen3-tts-flash', parameters: 'DashScopeTTSModel.Parameters | None' = None, stream: bool = True) -> None
初始化 DashScopeTTSModel 实例。
Initialize the DashScope TTS model.
说明Notes
- 注意:该行为受运行时配置或底层实现影响,建议结合对应源码与版本说明确认。Note: More details about the parameters, such as `model` and `voice`, can be found in the `official document `_.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
credential | DashScopeCredential | 凭证对象(类型 `DashScopeCredential`)。The DashScope credential used to authenticate the API call. |
model默认default 'qwen3-tts-flash' | str | 模型实例(类型 `str`)。The TTS model name. Supported models include `qwen3-tts-flash`, `qwen-tts`, etc. |
parameters默认default None | 'DashScopeTTSModel.Parameters | None' | 参数(类型 `'DashScopeTTSModel.Parameters | None'`)。The TTS parameters (voice, language, etc.). When `None`, the default parameters will be used. |
stream默认default True | bool | 流(类型 `bool`)。Whether to use streaming output. When `True`, :meth:`synthesize` returns an async generator yielding `TTSResponse` chunks; when `False`, it returns a single aggregated `TTSResponse`. |
源码Source
agentscope/tts/_dashscope/_model.py:71–105属性详情Attribute Detail
type
Literal['dashscope_tts'] = 'dashscope_tts'类型字段。声明为 Literal['dashscope_tts']。
The type field.
源码Source
agentscope/tts/_dashscope/_model.py:66realtime
bool = False实时字段。声明为 bool。
The realtime field.
源码Source
agentscope/tts/_dashscope/_model.py:69方法详情Method Detail
synthesize
async def synthesize(text: str | None = None, **kwargs: Any) -> TTSResponse | AsyncGenerator[TTSResponse, None]
async
执行 synthesize 方法。
Call the DashScope TTS API to synthesize speech from text.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
text默认default None | str | None | 文本(类型 `str | None`)。The text to be synthesized. |
kwargs | Any | 关键字参数(类型 `Any`)。The kwargs. |
TTSResponse | AsyncGenerator[TTSResponse, None]
返回TTSResponse|AsyncGenerator[TTSResponse,None]。`TTSResponse | AsyncGenerator[TTSResponse, None]`:
源码Source
agentscope/tts/_dashscope/_model.py:107–144嵌套类详情Nested Class Detail
Parameters
class Parameters参数,处理低延迟的实时语音与多模态交互。位于 agentscope.tts 包。
Frontend-exposed parameters for DashScope TTS models. Declared in agentscope.tts.