{"_id":"@pond918/llm-bots","_rev":"59-305aac3842c4e1614c09fbc31ab484fb","name":"@pond918/llm-bots","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.2":{"name":"@pond918/llm-bots","version":"0.0.2","keywords":["llm","chatbot","gpt","openai"],"author":{"name":"pond918"},"license":"Apache-2.0","_id":"@pond918/llm-bots@0.0.2","maintainers":[{"name":"thisis.ithotmail","email":"thisis.it@hotmail.com"}],"homepage":"https://github.com/pond918/llm-bots","bugs":{"url":"https://github.com/pond918/llm-bots/issues"},"dist":{"shasum":"98c9e457b0f1cd6ccba0e5967eca32e87e80c5df","tarball":"https://registry.npmjs.org/@pond918/llm-bots/-/llm-bots-0.0.2.tgz","fileCount":51,"integrity":"sha512-VPISSJoSmG5YuJveeXhE/LKmYOub0uNLbHOwmquZklwXZowKmu27teQKulv6oR4TGSpI/rQ9IRQUueExn8qzcA==","signatures":[{"sig":"MEQCICxp2uWmA3PKOS7t0GY5WlND8bAEPO4obztj7+XJqIf+AiBJcT6qqGgTZIJEsZuMLnd46thWwjgop1Zq3J+1yFprlQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68628},"jest":{"rootDir":"src","testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"testEnvironment":"node","coverageDirectory":"../coverage","collectCoverageFrom":["**/*.(t|j)s"],"moduleFileExtensions":["js","json","ts"]},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"64a720a0e723420910dafa9de0060f8abebf18c0","scripts":{"lint":"eslint --ext .ts,.js .","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --config ./test/jest.config.js --detectOpenHandles","build":"tsc --project tsconfig.build.json","start":"node dist/main.js","format":"prettier \"./**\" --write --ignore-unknown","prepare":"husky install","test:ci":"npm run test -- --colors --coverage --ci","start:dev":"nodemon --ext js,ts,json,env --exec 'node --experimental-specifier-resolution=node --loader ts-node/esm' src/main.ts","test:watch":"npm run test -- --watch","build:clean":"rm -rf tsconfig.build.tsbuildinfo && rm -rf ./dist","format:check":"prettier \"./**\" --ignore-unknown --check","test:coverage":"npm run test -- --coverage"},"_npmUser":{"name":"thisis.ithotmail","email":"thisis.it@hotmail.com"},"repository":{"url":"git+https://github.com/pond918/llm-bots.git","type":"git"},"_npmVersion":"9.5.1","description":"extendable llm bots sdk to integrate with any system, with tree structured history and conversations support. you can easliy add new own bots under the hood.","directories":{},"_nodeVersion":"18.16.0","dependencies":{"ws":"^8.13.0","axios":"^1.4.0","nanoid":"^3.3.6","langchain":"^0.0.102","async-lock":"^1.4.0","@hodlen/sse.ts":"^0.0.3","websocket-as-promised":"^2.0.1"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.5.1","husky":"^8.0.1","dotenv":"^16.0.3","eslint":"^8.12.0","nodemon":"^2.0.15","ts-jest":"^27.1.5","ts-node":"^10.7.0","prettier":"^2.6.1","@types/ws":"^8.5.4","cross-env":"^7.0.3","supertest":"^6.3.3","typescript":"^4.6.3","@jest/types":"^28.0.0","@types/jest":"^27.5.2","@types/node":"^18.0.0","lint-staged":"^13.0.0","@jest/globals":"^28.0.0","@commitlint/cli":"^17.0.0","@types/supertest":"^2.0.12","@types/async-lock":"^1.4.0","eslint-plugin-node":"^11.1.0","eslint-plugin-tsdoc":"^0.2.14","eslint-plugin-import":"^2.25.4","@typescript-eslint/parser":"^5.17.0","@commitlint/config-conventional":"^17.0.0","@typescript-eslint/eslint-plugin":"^5.17.0"},"_npmOperationalInternal":{"tmp":"tmp/llm-bots_0.0.2_1689044005492_0.876504026182471","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-07-11T02:53:25.390Z","modified":"2024-11-26T07:27:34.939Z","0.1.0":"2023-07-06T20:41:05.229Z","0.0.100":"2023-07-06T20:56:34.451Z","0.0.1":"2023-07-06T21:03:32.182Z","0.0.1001":"2023-07-07T07:57:45.367Z","0.0.1002":"2023-07-07T08:07:21.875Z","0.0.1003":"2023-07-07T08:11:11.520Z","0.0.1004":"2023-07-07T08:28:49.720Z","0.0.1005":"2023-07-07T08:31:20.432Z","0.0.1006":"2023-07-07T08:52:50.772Z","0.0.1007":"2023-07-08T14:57:59.413Z","0.0.1008":"2023-07-08T15:03:50.544Z","0.0.1009":"2023-07-08T15:17:49.113Z","0.0.1010":"2023-07-09T01:50:21.619Z","0.0.1011":"2023-07-09T01:59:29.358Z","0.0.1012":"2023-07-09T03:17:02.106Z","0.0.1013":"2023-07-09T03:26:57.795Z","0.0.1014":"2023-07-09T03:39:25.424Z","0.0.1015":"2023-07-09T03:42:39.079Z","0.0.1016":"2023-07-09T03:46:27.889Z","0.0.1017":"2023-07-09T03:49:36.129Z","0.0.1018":"2023-07-09T09:50:01.853Z","0.0.1019":"2023-07-09T09:51:32.780Z","0.0.1020":"2023-07-10T08:30:21.949Z","0.0.2":"2023-07-11T02:53:25.729Z"},"bugs":{"url":"https://github.com/pond918/llm-bots/issues"},"author":{"name":"pond918"},"license":"Apache-2.0","homepage":"https://github.com/pond918/llm-bots","keywords":["llm","chatbot","gpt","openai"],"repository":{"url":"git+https://github.com/pond918/llm-bots.git","type":"git"},"description":"extendable llm bots sdk to integrate with any system, with tree structured history and conversations support. you can easliy add new own bots under the hood.","maintainers":[{"email":"thisis.it@hotmail.com","name":"thisis.ithotmail"}],"readme":"# LLM bots\n\n[![Actions Status](https://github.com/pond918/llm-bots/workflows/ci/badge.svg)](https://github.com/pond918/llm-bots/actions)\n[![npm](https://img.shields.io/npm/v/@pond918/llm-bots.svg)](https://www.npmjs.com/package/@pond918/llm-bots)\n[![Known Vulnerabilities](https://snyk.io/test/github/pond918/llm-bots/badge.svg?targetFile=package.json)](https://snyk.io/test/github/pond918/llm-bots?targetFile=package.json)\n[![prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier)\n[![license](https://img.shields.io/npm/l/l@pond918/lm-bots.svg)](https://www.npmjs.com/package/@pond918/llm-bots)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpond918%2Fllm-bots.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpond918%2Fllm-bots?ref=badge_shield)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)\n\n## What is it?\n\nAn 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.\n\nThe package enables bots to support unlimited conversations. each conversation has tree-structured chat history ( each chat message has a `lastMsgId`).\n\nAnother 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.\n\n## Getting Started\n\n### Install the library\n\n```sh\nnpm install --save @pond918/llm-bots\n```\n\n### using the bots\n\n```typescript\nimport { ChatDto, LLMBots } from '@pond918/llm-bots'\n\nconst bots = new LLMBots()\nconst claudeBot = bots.instance('vicuna-13b')\n// vicuna-13b needn't token\nconst token = null\nconst ready = await claudeBot?.initSession(token)\nif (ready) {\n  const resp = await claudeBot?.sendPrompt(new ChatDto('hi there. 1 word most'))\n  console.log(resp)\n\n  // stream response\n  claudeBot?.sendPrompt(new ChatDto('who is Gauss. 5 words most'), (msg) => console.log(msg))\n}\n```\n\n### register a new bot\n\n```typescript\nimport { LLMBots } from '@pond918/llm-bots'\n\n// you may apply a custom user data storage\nconst bots = LLMBots.factory(storage);\n\n// new bot will replace old bot with same name.\nbots.register(new MyLLMBot());\n\nconst models = LLMBots.list();\nconsole.log(Object.keys(models));\n```\n\n## bot state management\n\nThere are 3 state for an llm bot instance:\n\n- llm config state: e.g. llm url. Stored as bot class properties.\n- server session state: API tokens/login sessions. Stored in the session pool, may be shared among users.\n- user data state: conversation/chat history. Stored in the provided storage, usually users isolated.\n\n## TODOs\n\n- [ ] namespaced/scoped storage\n\n## License\n\nThis project is [Apache-2.0 Licensed](LICENSE).\n\n## Credits\n\n- bots implementation are based on [ChatAll](https://github.com/sunner/ChatALL). Respect!\n- [NodeJS Starter ToolKit](https://github.com/vitorsalgado/create-nodejs-ts)\n","readmeFilename":"README.md"}