跳至主要内容

StackExchange 工具

StackExchange 工具将您的代理和链连接到 StackExchange 的 API。

用法

import { StackExchangeAPI } from "@langchain/community/tools/stackexchange";

// Get results from StackExchange API
const stackExchangeTool = new StackExchangeAPI();
const result = await stackExchangeTool.invoke("zsh: command not found: python");
console.log(result);

// Get results from StackExchange API with title query
const stackExchangeTitleTool = new StackExchangeAPI({
queryType: "title",
});
const titleResult = await stackExchangeTitleTool.invoke(
"zsh: command not found: python"
);
console.log(titleResult);

// Get results from StackExchange API with bad query
const stackExchangeBadTool = new StackExchangeAPI();
const badResult = await stackExchangeBadTool.invoke(
"sjefbsmnazdkhbazkbdoaencopebfoubaef"
);
console.log(badResult);

API 参考


此页面是否有帮助?


您也可以在 GitHub 上留下详细的反馈 GitHub.