类class
agentscope.credentialOllamaCredential
class OllamaCredential(CredentialBase)
源码Source
agentscope/credential/_ollama.py:14–45Ollama 凭证,与模型服务通信并返回生成或向量化结果。位于 agentscope.credential 包,继承自 CredentialBase。核心成员包括 get_chat_model_class、get_embedding_model_class。
The Ollama credential model (connection settings). Declared in agentscope.credential. Extends CredentialBase.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
model_config | — | 模型配置字段。 | ConfigDict(title='Ollama API') |
type | Literal['ollama_credential'] | 类型字段。 | 'ollama_credential' |
host | str | None | `host` 字段。 | Field(default=None, description='The Ollama server host URL. Defaults to http://localhost:11434 if not specified.') |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
def get_chat_model_class() -> Type['ChatModelBase'] | 返回OllamaChatModel 类。 Return the OllamaChatModel class. |
def get_embedding_model_class() -> Type['EmbeddingModelBase'] | 返回OllamaEmbeddingModel 类。 Return the OllamaEmbeddingModel class. |
属性详情Attribute Detail
model_config
= ConfigDict(title='Ollama API')模型配置字段。
Ollama API
源码Source
agentscope/credential/_ollama.py:17type
Literal['ollama_credential'] = 'ollama_credential'类型字段。声明为 Literal['ollama_credential']。
The type field.
源码Source
agentscope/credential/_ollama.py:21host
str | None = Field(default=None, description='The Ollama server host URL. Defaults to http://localhost:11434 if not specified.')host 字段。声明为 str | None。
The Ollama server host URL.
源码Source
agentscope/credential/_ollama.py:24方法详情Method Detail
get_chat_model_class
def get_chat_model_class() -> Type['ChatModelBase']
返回OllamaChatModel 类。
Return the OllamaChatModel class.
Type['ChatModelBase']
返回类型['ChatModelBase']。Returns type chat model base.
源码Source
agentscope/credential/_ollama.py:34–38get_embedding_model_class
def get_embedding_model_class() -> Type['EmbeddingModelBase']
返回OllamaEmbeddingModel 类。
Return the OllamaEmbeddingModel class.
Type['EmbeddingModelBase']
返回类型['EmbeddingModelBase']。Returns type embedding model base.
源码Source
agentscope/credential/_ollama.py:41–45