npm package of llm bots with tree-structured chat histories. can be deployed on local browser, or node server with shared sessions and isolated user states.
APACHE-2.0 License
An npm package of many large language model (LLMs) client chat bots, e.g. ChatGPT, Bing Chat, bard, Alpaca, Vincuna, Claude, ChatGLM, MOSS, iFlytek Spark, ERNIE and more. You may register your own bots easily.
The package enables bots to support unlimited conversations. each conversation has tree-structured chat history ( each chat message has a lastMsgId
).
Another use case is to isolate different users for the same bot on the same nodejs server. All user related data: session/conversation/chat history, etc. is stored in the specified BotStorage on different namespaces.
npm install --save @pond918/llm-bots
import { ChatDto, LLMBots } from '@pond918/llm-bots'
const bots = new LLMBots()
const claudeBot = bots.instance('vicuna-13b')
// vicuna-13b needn't token
const token = null
const ready = await claudeBot?.initSession(token)
if (ready) {
const resp = await claudeBot?.sendPrompt(new ChatDto('hi there. 1 word most'))
console.log(resp)
// stream response
claudeBot?.sendPrompt(new ChatDto('who is Gauss. 5 words most'), (msg) => console.log(msg))
}
import { LLMBots } from '@pond918/llm-bots'
// you may apply a custom user data storage
const bots = LLMBots.factory(storage);
// new bot will replace old bot with same name.
bots.register(new MyLLMBot());
const models = LLMBots.list();
console.log(Object.keys(models));
There are 3 state for an llm bot instance:
This project is Apache-2.0 Licensed.