Skip to main content
Open on GitHub

Stack Exchange

Stack Exchange is a network of question-and-answer (Q&A) websites on topics in diverse fields, each site covering a specific topic, where questions, answers, and users are subject to a reputation award process.

此页面介绍如何在 LangChain 中使用 Stack Exchange API。

安装与设置​

  • 使用以下命令安装所需依赖:
pip install stackapi

包装器​

工具​

存在一个封装了此 API 的 StackExchangeAPIWrapper 工具。要导入此工具:

from langchain_community.utilities import StackExchangeAPIWrapper

有关此包装器的更详细指南,请参见 这个笔记本。

工具​

你还可以轻松将此包装器加载为工具(与代理一起使用)。 你可以通过以下方式实现:

from langchain.agents import load_tools
tools = load_tools(["stackexchange"])
API 参考:load_tools

有关工具的更多信息,请参见 此页面。