跳转到内容

Hub

langchain-classic 文档

本文档涵盖 langchain-classic 包。该包将持续维护安全漏洞至 2026 年 12 月。我们鼓励用户迁移到 langchain 包以获取最新的功能和改进。查看 langchain 的文档

langchain_classic.hub

LangChain Hub 的交互接口。

函数 描述
push

将一个对象推送到 Hub,并返回可在浏览器中查看该对象的 URL。

pull

从 Hub 拉取一个对象,并将其作为 LangChain 对象返回。

push

push(
    repo_full_name: str,
    object: Any,
    *,
    api_url: str | None = None,
    api_key: str | None = None,
    parent_commit_hash: str | None = None,
    new_repo_is_public: bool = False,
    new_repo_description: str | None = None,
    readme: str | None = None,
    tags: Sequence[str] | None = None,
) -> str

将一个对象推送到 Hub,并返回可在浏览器中查看该对象的 URL。

参数 描述
repo_full_name

要推送到的提示的完整名称,格式为 owner/prompt_nameprompt_name

类型: str

object

要序列化并推送到 Hub 的 LangChain 对象。

类型: Any

api_url

LangChain Hub API 的 URL。如果您设置了 API 密钥,则默认为托管的 API 服务;否则默认为本地主机实例。

类型: str | None 默认值: None

api_key

用于向 LangChain Hub API 进行身份验证的 API 密钥。

类型: str | None 默认值: None

parent_commit_hash

要推送到的父提交的提交哈希值。默认自动使用最新的提交。

类型: str | None 默认值: None

new_repo_is_public

提示是否应为公开。

类型: bool 默认值: False

new_repo_description

提示的描述。

类型: str | None 默认值: None

readme

仓库的 README 内容。

类型: str | None 默认值: None

tags

与提示相关联的标签。

类型: Sequence[str] | None 默认值: None

返回 描述
str

可在浏览器中查看已推送对象的 URL。

pull

pull(
    owner_repo_commit: str,
    *,
    include_model: bool | None = None,
    api_url: str | None = None,
    api_key: str | None = None,
) -> Any

从 Hub 拉取一个对象,并将其作为 LangChain 对象返回。

参数 描述
owner_repo_commit

要从中拉取的提示的完整名称,格式为 owner/prompt_name:commit_hashowner/prompt_name,或者如果是您自己的提示,则仅为 prompt_name

类型: str

include_model

是否在拉取的提示中包含模型配置。

类型: bool | None 默认值: None

api_url

LangChain Hub API 的 URL。如果您设置了 API 密钥,则默认为托管的 API 服务;否则默认为本地主机实例。

类型: str | None 默认值: None

api_key

用于向 LangChain Hub API 进行身份验证的 API 密钥。

类型: str | None 默认值: None

返回 描述
任意

已拉取的 LangChain 对象。

© . This site is unofficial and not affiliated with LangChain, Inc.