跳到主要内容
KoboldAI 是一个“用于 AI 辅助写作的基于浏览器的前端,支持多个本地和远程 AI 模型……”。它有一个公共和本地 API,可以在 LangChain 中使用。 此示例演示了如何将 LangChain 与该 API 一起使用。 文档可以通过在端点末尾添加 /api 在浏览器中找到(即 127.0.0.1/:5000/api)。
from langchain_community.llms import KoboldApiLLM
将下面显示的端点替换为启动带有 —api 或 —public-api 的 webui 后输出中显示的端点。 您可以选择传入温度或 max_length 等参数。
llm = KoboldApiLLM(endpoint="http://192.168.1.144:5000", max_length=80)
response = llm.invoke(
    "### Instruction:\nWhat is the first book of the bible?\n### Response:"
)

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.