狗头人 API
KoboldAI是一个“基于浏览器的前端,用于AI辅助写作,具有多个本地和远程AI模型...”。它有一个可以在 langchain 中使用的公共和本地 API。
此示例介绍了如何将 LangChain 与该 API 一起使用。
文档可以在浏览器中找到,将 /api 添加到端点的末尾(即 http://127.0.0.1/:5000/api)。
from langchain_community.llms import KoboldApiLLM
API 参考:KoboldApiLLM
使用 --api 或 --public-api 启动 webui 后,将下面看到的终端节点替换为输出中显示的终端节点
(可选)您可以传入 temperature 或 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:"
)