跳至主要內容

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

此頁面是否有幫助?