KoboldAI API
KoboldAI 是一个“基于浏览器的 AI 辅助写作前端,支持多种本地和远程 AI 模型……”。它有一个公共和本地 API 可以与 langchain 一起使用。
本示例将介绍如何将 LangChain 与该 API 配合使用。
您可以在浏览器中通过在端点后添加 /api 来找到文档(即 http://127.0.0.1/:5000/api)。
from langchain_community.llms import KoboldApiLLM
API Reference: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:"
)
Related
- LLM conceptual guide
- LLM how-to guides