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:"
)