node-llama-cpp 0.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +210 -0
  3. package/dist/AbortError.d.ts +3 -0
  4. package/dist/AbortError.js +6 -0
  5. package/dist/AbortError.js.map +1 -0
  6. package/dist/ChatPromptWrapper.d.ts +7 -0
  7. package/dist/ChatPromptWrapper.js +14 -0
  8. package/dist/ChatPromptWrapper.js.map +1 -0
  9. package/dist/LlamaChatSession.d.ts +24 -0
  10. package/dist/LlamaChatSession.js +86 -0
  11. package/dist/LlamaChatSession.js.map +1 -0
  12. package/dist/LlamaModel.d.ts +13 -0
  13. package/dist/LlamaModel.js +43 -0
  14. package/dist/LlamaModel.js.map +1 -0
  15. package/dist/chatWrappers/EmptyChatPromptWrapper.d.ts +3 -0
  16. package/dist/chatWrappers/EmptyChatPromptWrapper.js +4 -0
  17. package/dist/chatWrappers/EmptyChatPromptWrapper.js.map +1 -0
  18. package/dist/chatWrappers/LlamaChatPromptWrapper.d.ts +8 -0
  19. package/dist/chatWrappers/LlamaChatPromptWrapper.js +16 -0
  20. package/dist/chatWrappers/LlamaChatPromptWrapper.js.map +1 -0
  21. package/dist/cli/cli.d.ts +2 -0
  22. package/dist/cli/cli.js +33 -0
  23. package/dist/cli/cli.js.map +1 -0
  24. package/dist/cli/commands/BuildCommand.d.ts +8 -0
  25. package/dist/cli/commands/BuildCommand.js +41 -0
  26. package/dist/cli/commands/BuildCommand.js.map +1 -0
  27. package/dist/cli/commands/ChatCommand.d.ts +8 -0
  28. package/dist/cli/commands/ChatCommand.js +83 -0
  29. package/dist/cli/commands/ChatCommand.js.map +1 -0
  30. package/dist/cli/commands/ClearCommand.d.ts +7 -0
  31. package/dist/cli/commands/ClearCommand.js +42 -0
  32. package/dist/cli/commands/ClearCommand.js.map +1 -0
  33. package/dist/cli/commands/DownloadCommand.d.ts +11 -0
  34. package/dist/cli/commands/DownloadCommand.js +179 -0
  35. package/dist/cli/commands/DownloadCommand.js.map +1 -0
  36. package/dist/cli/commands/OnPostInstallCommand.d.ts +4 -0
  37. package/dist/cli/commands/OnPostInstallCommand.js +24 -0
  38. package/dist/cli/commands/OnPostInstallCommand.js.map +1 -0
  39. package/dist/commands.d.ts +4 -0
  40. package/dist/commands.js +5 -0
  41. package/dist/commands.js.map +1 -0
  42. package/dist/config.d.ts +9 -0
  43. package/dist/config.js +25 -0
  44. package/dist/config.js.map +1 -0
  45. package/dist/index.d.ts +7 -0
  46. package/dist/index.js +8 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/utils/clearLlamaBuild.d.ts +1 -0
  49. package/dist/utils/clearLlamaBuild.js +12 -0
  50. package/dist/utils/clearLlamaBuild.js.map +1 -0
  51. package/dist/utils/clearTempFolder.d.ts +1 -0
  52. package/dist/utils/clearTempFolder.js +16 -0
  53. package/dist/utils/clearTempFolder.js.map +1 -0
  54. package/dist/utils/compileLLamaCpp.d.ts +6 -0
  55. package/dist/utils/compileLLamaCpp.js +43 -0
  56. package/dist/utils/compileLLamaCpp.js.map +1 -0
  57. package/dist/utils/getBin.d.ts +18 -0
  58. package/dist/utils/getBin.js +70 -0
  59. package/dist/utils/getBin.js.map +1 -0
  60. package/dist/utils/spawnCommand.d.ts +1 -0
  61. package/dist/utils/spawnCommand.js +39 -0
  62. package/dist/utils/spawnCommand.js.map +1 -0
  63. package/dist/utils/usedBinFlag.d.ts +6 -0
  64. package/dist/utils/usedBinFlag.js +15 -0
  65. package/dist/utils/usedBinFlag.js.map +1 -0
  66. package/dist/utils/withLock.d.ts +1 -0
  67. package/dist/utils/withLock.js +19 -0
  68. package/dist/utils/withLock.js.map +1 -0
  69. package/dist/utils/withOra.d.ts +5 -0
  70. package/dist/utils/withOra.js +21 -0
  71. package/dist/utils/withOra.js.map +1 -0
  72. package/llama/.clang-format +46 -0
  73. package/llama/addon.cpp +183 -0
  74. package/llama/binding.gyp +24 -0
  75. package/llama/usedBin.json +3 -0
  76. package/llamaBins/linux-arm64-16.node +0 -0
  77. package/llamaBins/linux-arm64-17.node +0 -0
  78. package/llamaBins/linux-arm64-18.node +0 -0
  79. package/llamaBins/linux-arm64-19.node +0 -0
  80. package/llamaBins/linux-arm64-20.node +0 -0
  81. package/llamaBins/linux-armv7l-16.node +0 -0
  82. package/llamaBins/linux-armv7l-17.node +0 -0
  83. package/llamaBins/linux-armv7l-18.node +0 -0
  84. package/llamaBins/linux-armv7l-19.node +0 -0
  85. package/llamaBins/linux-armv7l-20.node +0 -0
  86. package/llamaBins/linux-ppc64le-16.node +0 -0
  87. package/llamaBins/linux-ppc64le-17.node +0 -0
  88. package/llamaBins/linux-ppc64le-18.node +0 -0
  89. package/llamaBins/linux-ppc64le-19.node +0 -0
  90. package/llamaBins/linux-ppc64le-20.node +0 -0
  91. package/llamaBins/linux-x64-16.node +0 -0
  92. package/llamaBins/linux-x64-17.node +0 -0
  93. package/llamaBins/linux-x64-18.node +0 -0
  94. package/llamaBins/linux-x64-19.node +0 -0
  95. package/llamaBins/linux-x64-20.node +0 -0
  96. package/llamaBins/mac-arm64-16.node +0 -0
  97. package/llamaBins/mac-arm64-17.node +0 -0
  98. package/llamaBins/mac-arm64-18.node +0 -0
  99. package/llamaBins/mac-arm64-19.node +0 -0
  100. package/llamaBins/mac-arm64-20.node +0 -0
  101. package/llamaBins/mac-x64-16.node +0 -0
  102. package/llamaBins/mac-x64-17.node +0 -0
  103. package/llamaBins/mac-x64-18.node +0 -0
  104. package/llamaBins/mac-x64-19.node +0 -0
  105. package/llamaBins/mac-x64-20.node +0 -0
  106. package/llamaBins/win-x64-16.node +0 -0
  107. package/llamaBins/win-x64-17.node +0 -0
  108. package/llamaBins/win-x64-18.node +0 -0
  109. package/llamaBins/win-x64-19.node +0 -0
  110. package/llamaBins/win-x64-20.node +0 -0
  111. package/package.json +71 -10
package/package.json CHANGED
@@ -1,52 +1,95 @@
1
1
  {
2
2
  "name": "node-llama-cpp",
3
- "version": "0.0.1",
4
- "description": "",
3
+ "version": "1.1.1",
4
+ "description": "node.js bindings for llama.cpp",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "node-llama-cpp": "./dist/cli/cli.js"
10
+ },
8
11
  "files": [
9
12
  "dist/",
13
+ "llama/",
14
+ "llamaBins/",
10
15
  "package.json",
11
- "README.md"
16
+ "README.md",
17
+ "LICENSE"
12
18
  ],
19
+ "exports": {
20
+ ".": {
21
+ "default": "./dist/index.js",
22
+ "import": "./dist/index.js",
23
+ "node": "./dist/index.js",
24
+ "types": "./dist/index.d.ts"
25
+ },
26
+ "./commands": {
27
+ "default": "./dist/commands.js",
28
+ "import": "./dist/commands.js",
29
+ "node": "./dist/commands.js",
30
+ "types": "./dist/commands.d.ts"
31
+ },
32
+ "./commands.js": {
33
+ "default": "./dist/commands.js",
34
+ "import": "./dist/commands.js",
35
+ "node": "./dist/commands.js",
36
+ "types": "./dist/commands.d.ts"
37
+ }
38
+ },
39
+ "engines": {
40
+ "node": ">=18.0.0"
41
+ },
13
42
  "scripts": {
43
+ "postinstall": "node ./dist/cli/cli.js postinstall",
14
44
  "prepare": "[ $CI = true ] || [ -d '.husky/_' ] || husky install",
15
45
  "prebuild": "rm -rf ./dist ./tsconfig.tsbuildinfo",
16
46
  "build": "tsc --build tsconfig.json --force",
17
47
  "prewatch": "rm -rf ./dist ./tsconfig.tsbuildinfo",
18
48
  "watch": "tsc --build tsconfig.json --watch --force",
49
+ "node-gyp-llama": "cd llama && node-gyp",
50
+ "node-gyp-llama-build": "cd llama && cross-env CXXFLAGS=\"-fexceptions\" CFLAGS=\"-fexceptions\" node-gyp build -j max",
19
51
  "test": "npm run test:typescript && npm run lint:eslint",
20
52
  "test:typescript": "tsc --build tsconfig.json --dry --force",
21
53
  "lint": "npm run lint:eslint",
22
54
  "lint:eslint": "eslint --ext .js --ext .ts .",
23
- "lint:fix": "npm run lint:eslint -- --fix",
55
+ "format": "npm run lint:eslint -- --fix",
24
56
  "clean": "rm -rf ./node_modules ./dist ./tsconfig.tsbuildinfo"
25
57
  },
26
58
  "repository": {
27
59
  "type": "git",
28
- "url": "git+ssh://git@github.com:giladgd/node-llama-cpp.git"
60
+ "url": "git+https://github.com/withcatai/node-llama-cpp.git"
29
61
  },
30
62
  "keywords": [
31
63
  "llama",
32
64
  "llama-cpp",
33
65
  "bindings",
34
- "node-gyp",
35
66
  "ai",
67
+ "node-gyp",
68
+ "prebuilt-binaries",
36
69
  "llm",
37
70
  "ggml",
38
- "ggmlv3"
71
+ "ggmlv3",
72
+ "raspberry-pi",
73
+ "self-hosted",
74
+ "local",
75
+ "catai"
39
76
  ],
40
77
  "author": "Gilad S.",
41
78
  "license": "ISC",
42
79
  "bugs": {
43
- "url": "https://github.com/giladgd/node-llama-cpp/issues"
80
+ "url": "https://github.com/withcatai/node-llama-cpp/issues"
44
81
  },
45
- "homepage": "https://github.com/giladgd/node-llama-cpp#readme",
82
+ "homepage": "https://github.com/withcatai/node-llama-cpp#readme",
46
83
  "devDependencies": {
47
84
  "@commitlint/cli": "^17.7.1",
48
85
  "@commitlint/config-conventional": "^17.7.0",
86
+ "@types/bytes": "^3.1.1",
87
+ "@types/cli-progress": "^3.11.0",
88
+ "@types/cross-spawn": "^6.0.2",
89
+ "@types/fs-extra": "^11.0.1",
49
90
  "@types/node": "^20.4.9",
91
+ "@types/uuid": "^9.0.2",
92
+ "@types/yargs": "^17.0.24",
50
93
  "@typescript-eslint/eslint-plugin": "^6.3.0",
51
94
  "@typescript-eslint/parser": "^6.3.0",
52
95
  "eslint": "^8.46.0",
@@ -56,6 +99,24 @@
56
99
  "semantic-release": "^21.0.7",
57
100
  "ts-node": "^10.9.1",
58
101
  "tslib": "^2.6.1",
59
- "typescript": "^5.1.6"
102
+ "typescript": "^5.1.6",
103
+ "zx": "^7.2.3"
104
+ },
105
+ "dependencies": {
106
+ "bytes": "^3.1.2",
107
+ "chalk": "^5.3.0",
108
+ "cli-progress": "^3.12.0",
109
+ "cross-env": "^7.0.3",
110
+ "cross-spawn": "^7.0.3",
111
+ "env-var": "^7.3.1",
112
+ "fs-extra": "^11.1.1",
113
+ "node-addon-api": "^7.0.0",
114
+ "node-downloader-helper": "^2.1.9",
115
+ "node-gyp": "^9.4.0",
116
+ "node-stream-zip": "^1.15.0",
117
+ "octokit": "^3.1.0",
118
+ "ora": "^7.0.1",
119
+ "uuid": "^9.0.0",
120
+ "yargs": "^17.7.2"
60
121
  }
61
122
  }