跳到主要内容
Open In ColabOpen on GitHub

KoboldAI API

KoboldAI 是一个“基于浏览器的前端,用于 AI 辅助写作,支持多个本地和远程 AI 模型...”。它具有公共和本地 API,可以在 langchain 中使用。

此示例介绍了如何在 LangChain 中使用该 API。

文档可以在浏览器中找到,在端点末尾添加 /api 即可(例如 http://127.0.0.1/:5000/api)。

from langchain_community.llms import KoboldApiLLM
API 参考: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:"
)

此页是否对您有帮助?