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 后在输出中显示的端点
可选地,您可以传入诸如 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:"
)