AS AgentScopeAPI 手册 / API Reference
类class agentscope.credential

CredentialBase

class CredentialBase(BaseModel)
源码Source 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
idstr
凭证标识。
Field(default_factory=_generate_id, description='The credential id')
namestr
名称字段。
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

源码Source agentscope/credential/_base.py:21

name

str = Field(default='', description='User-facing display name for this credential.')

名称字段。声明为 str。

User-facing display name for this credential.

源码Source 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.

返回Returns Type['ChatModelBase']
返回类型['ChatModelBase']。`Type[ChatModelBase]`:
源码Source agentscope/credential/_base.py:32–43

get_chat_model_classes

def get_chat_model_classes() -> list[Type['ChatModelBase']]

获取 get_chat_model_classes。

Providers that expose multiple API surfaces (e.g.

返回Returns list[Type['ChatModelBase']]
返回类型['ChatModelBase']列表。`list[Type[ChatModelBase]]`:
源码Source agentscope/credential/_base.py:46–58

get_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.

返回Returns list[Type['TTSModelBase']]
返回类型['TTSModelBase']列表。`list[Type[TTSModelBase]]`:
源码Source agentscope/credential/_base.py:61–72

get_asr_model_classes

def get_asr_model_classes() -> list[Type['ASRModelBase']]

获取 get_asr_model_classes。

Return supported speech recognition implementations.

返回Returns list[Type['ASRModelBase']]
返回类型['ASRModelBase']列表。Returns a list of type ASR model base.
源码Source agentscope/credential/_base.py:75–77

list_asr_models

def list_asr_models() -> list['ASRModelCard']

列出ASR 模型。

List candidate ASR models for this credential.

返回Returns list['ASRModelCard']
返回'ASRModelCard'列表。Returns a list of ASR model card.
源码Source agentscope/credential/_base.py:80–85

list_tts_models

def list_tts_models() -> list['TTSModelCard']

列出TTS 模型。

List the candidate TTS models available under this credential.

返回Returns list['TTSModelCard']
返回'TTSModelCard'列表。`list[TTSModelCard]`:
源码Source agentscope/credential/_base.py:88–98

get_realtime_model_classes

def get_realtime_model_classes() -> list[Type['RealtimeModelBase']]

获取 get_realtime_model_classes。

Return the realtime model classes supported by this credential.

返回Returns list[Type['RealtimeModelBase']]
返回类型['RealtimeModelBase']列表。Returns a list of type realtime model base.
源码Source agentscope/credential/_base.py:101–107

list_realtime_models

def list_realtime_models() -> list['RealtimeModelCard']

列出实时模型。

List the candidate realtime models under this credential.

返回Returns list['RealtimeModelCard']
返回'RealtimeModelCard'列表。Returns a list of realtime model card.
源码Source agentscope/credential/_base.py:110–115

list_models

def list_models() -> list['ModelCard']

列出模型。

List the candidate chat models that are available under this credential.

返回Returns list['ModelCard']
返回'ModelCard'列表。`list[ModelCard]`:
源码Source agentscope/credential/_base.py:118–130

get_embedding_model_class

def get_embedding_model_class() -> Type['EmbeddingModelBase'] | None

获取向量化模型类。

Subclasses that have a matching embedding implementation should override this method.

返回Returns Type['EmbeddingModelBase'] | None
返回类型['EmbeddingModelBase']|None。`Type[EmbeddingModelBase] | None`:
源码Source agentscope/credential/_base.py:133–145
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.