Skip to main content
KoboldAI 是一款”基于浏览器的前端,支持多种本地与远程 AI 模型辅助写作……”。它提供公开和本地两种 API,均可在 LangChain 中使用。 本示例介绍如何将 LangChain 与该 API 结合使用。 文档可在浏览器中通过在端点末尾添加 /api 来查看(例如 127.0.0.1/:5000/api)。
from langchain_community.llms import KoboldApiLLM
将下方端点替换为使用 —api 或 —public-api 启动 webui 后输出中显示的地址。 您也可以选择传入温度或最大长度等参数。
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:"
)