类class
agentscope.credentialDashScopeCredential
class DashScopeCredential(CredentialBase)
源码Source
agentscope/credential/_dashscope.py:18–80凭证用于 DashScope API。位于 agentscope.credential 包,继承自 CredentialBase。核心成员包括 get_chat_model_class、get_tts_model_classes、get_realtime_model_classes、get_embedding_model_class。
The credential for DashScope API. Declared in agentscope.credential. Extends CredentialBase.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
model_config | — | 模型配置字段。 | ConfigDict(title='DashScope API') |
type | Literal['dashscope_credential'] | 类型字段。 | 'dashscope_credential' |
api_key | SecretStr | DashScope API 密钥。 | Field(description='The DashScope API key.', title='API Key') |
base_url | str | 基类 URL 用于 DashScope OpenAI 兼容的 API 端点。 | Field(default=_DASHSCOPE_BASE_URL, title='API Base URL', description='The base URL for the DashScope OpenAI-compatible API endpoint.') |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
def get_chat_model_class() -> Type['ChatModelBase'] | 返回DashScopeChatModel 类。 Return the DashScopeChatModel class. |
def get_tts_model_classes() -> list[Type['TTSModelBase']] | 获取 `get_tts_model_classes`。 Return the DashScope TTS model classes. |
def get_realtime_model_classes() -> list[Type['RealtimeModelBase']] | 获取 `get_realtime_model_classes`。 Return the DashScope realtime model classes. |
def get_embedding_model_class() -> Type['EmbeddingModelBase'] | 返回DashScopeEmbeddingModel 类。 Return the DashScopeEmbeddingModel class. |
属性详情Attribute Detail
model_config
= ConfigDict(title='DashScope API')模型配置字段。
DashScope API
源码Source
agentscope/credential/_dashscope.py:21type
Literal['dashscope_credential'] = 'dashscope_credential'类型字段。声明为 Literal['dashscope_credential']。
The type field.
源码Source
agentscope/credential/_dashscope.py:25api_key
SecretStr = Field(description='The DashScope API key.', title='API Key')DashScope API 密钥。
The DashScope API key.
源码Source
agentscope/credential/_dashscope.py:28base_url
str = Field(default=_DASHSCOPE_BASE_URL, title='API Base URL', description='The base URL for the DashScope OpenAI-compatible API endpoint.')基类 URL 用于 DashScope OpenAI 兼容的 API 端点。
The base URL for the DashScope OpenAI-compatible API endpoint.
源码Source
agentscope/credential/_dashscope.py:33方法详情Method Detail
get_chat_model_class
def get_chat_model_class() -> Type['ChatModelBase']
返回DashScopeChatModel 类。
Return the DashScopeChatModel class.
Type['ChatModelBase']
返回类型['ChatModelBase']。Returns type chat model base.
源码Source
agentscope/credential/_dashscope.py:42–46get_tts_model_classes
def get_tts_model_classes() -> list[Type['TTSModelBase']]
获取 get_tts_model_classes。
Return the DashScope TTS model classes.
list[Type['TTSModelBase']]
返回类型['TTSModelBase']列表。Returns a list of type TTS model base.
源码Source
agentscope/credential/_dashscope.py:49–61get_realtime_model_classes
def get_realtime_model_classes() -> list[Type['RealtimeModelBase']]
获取 get_realtime_model_classes。
Return the DashScope realtime model classes.
list[Type['RealtimeModelBase']]
返回类型['RealtimeModelBase']列表。Returns a list of type realtime model base.
源码Source
agentscope/credential/_dashscope.py:64–73get_embedding_model_class
def get_embedding_model_class() -> Type['EmbeddingModelBase']
返回DashScopeEmbeddingModel 类。
Return the DashScopeEmbeddingModel class.
Type['EmbeddingModelBase']
返回类型['EmbeddingModelBase']。Returns type embedding model base.
源码Source
agentscope/credential/_dashscope.py:76–80