agentscope.credentialCredentialBase
class CredentialBase(BaseModel)
agentscope/credential/_base.py:18–145凭证基类类。位于 agentscope.credential 包。核心成员包括 get_chat_model_class、get_chat_model_classes、get_tts_model_classes、get_asr_model_classes、list_asr_models、list_tts_models。
The credential base class. Declared in agentscope.credential.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
id | str | 凭证标识。 | Field(default_factory=_generate_id, description='The credential id') |
name | str | 名称字段。 | Field(default='', description='User-facing display name for this credential.') |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
def get_chat_model_class() -> Type['ChatModelBase'] | 获取聊天模型类。 Return the :class:`ChatModelBase` subclass that consumes this credential. Subclasses must override this method to return the corresponding chat model class. |
def get_chat_model_classes() -> list[Type['ChatModelBase']] | 获取 `get_chat_model_classes`。 Return all chat model classes supported by this credential. |
def get_tts_model_classes() -> list[Type['TTSModelBase']] | 获取 `get_tts_model_classes`。 Return the TTS model classes supported by this credential. |
def get_asr_model_classes() -> list[Type['ASRModelBase']] | 获取 `get_asr_model_classes`。 Return supported speech recognition implementations. |
def list_asr_models() -> list['ASRModelCard'] | 列出ASR 模型。 List candidate ASR models for this credential. |
def list_tts_models() -> list['TTSModelCard'] | 列出TTS 模型。 List the candidate TTS models available under this credential. |
def get_realtime_model_classes() -> list[Type['RealtimeModelBase']] | 获取 `get_realtime_model_classes`。 Return the realtime model classes supported by this credential. The default returns an empty list (provider does not support realtime). |
def list_realtime_models() -> list['RealtimeModelCard'] | 列出实时模型。 List the candidate realtime models under this credential. |
def list_models() -> list['ModelCard'] | 列出模型。 List the candidate chat models that are available under this credential. Merges model cards from all classes returned by :meth:`get_chat_model_classes`. |
def get_embedding_model_class() -> Type['EmbeddingModelBase'] | None | 获取向量化模型类。 Return the :class:`EmbeddingModelBase` subclass that consumes this credential, or ``None`` if this provider does not support embedding models. |
属性详情Attribute Detail
id
str = Field(default_factory=_generate_id, description='The credential id')凭证标识。
The credential id
agentscope/credential/_base.py:21name
str = Field(default='', description='User-facing display name for this credential.')名称字段。声明为 str。
User-facing display name for this credential.
agentscope/credential/_base.py:26方法详情Method Detail
get_chat_model_class
def get_chat_model_class() -> Type['ChatModelBase']
获取聊天模型类。
Return the :class:ChatModelBase subclass that consumes this credential.
agentscope/credential/_base.py:32–43get_chat_model_classes
def get_chat_model_classes() -> list[Type['ChatModelBase']]
获取 get_chat_model_classes。
Providers that expose multiple API surfaces (e.g.
agentscope/credential/_base.py:46–58get_tts_model_classes
def get_tts_model_classes() -> list[Type['TTSModelBase']]
获取 get_tts_model_classes。
Subclasses that support TTS should override this to return one or more :class:TTSModelBase subclasses.
agentscope/credential/_base.py:61–72get_asr_model_classes
def get_asr_model_classes() -> list[Type['ASRModelBase']]
获取 get_asr_model_classes。
Return supported speech recognition implementations.
agentscope/credential/_base.py:75–77list_asr_models
def list_asr_models() -> list['ASRModelCard']
列出ASR 模型。
List candidate ASR models for this credential.
agentscope/credential/_base.py:80–85list_tts_models
def list_tts_models() -> list['TTSModelCard']
列出TTS 模型。
List the candidate TTS models available under this credential.
agentscope/credential/_base.py:88–98get_realtime_model_classes
def get_realtime_model_classes() -> list[Type['RealtimeModelBase']]
获取 get_realtime_model_classes。
Return the realtime model classes supported by this credential.
agentscope/credential/_base.py:101–107list_realtime_models
def list_realtime_models() -> list['RealtimeModelCard']
列出实时模型。
List the candidate realtime models under this credential.
agentscope/credential/_base.py:110–115list_models
def list_models() -> list['ModelCard']
列出模型。
List the candidate chat models that are available under this credential.
agentscope/credential/_base.py:118–130get_embedding_model_class
def get_embedding_model_class() -> Type['EmbeddingModelBase'] | None
获取向量化模型类。
Subclasses that have a matching embedding implementation should override this method.
agentscope/credential/_base.py:133–145