node-llama-cpp 3.0.0-beta.3 → 3.0.0-beta.31

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 (690) hide show
  1. package/README.md +14 -11
  2. package/bins/linux-arm64/_nlcBuildMetadata.json +1 -0
  3. package/bins/linux-arm64/llama-addon.node +0 -0
  4. package/bins/linux-armv7l/_nlcBuildMetadata.json +1 -0
  5. package/bins/linux-armv7l/llama-addon.node +0 -0
  6. package/bins/linux-x64/_nlcBuildMetadata.json +1 -0
  7. package/bins/linux-x64/llama-addon.node +0 -0
  8. package/bins/linux-x64-cuda/_nlcBuildMetadata.json +1 -0
  9. package/bins/linux-x64-cuda/llama-addon.node +0 -0
  10. package/bins/linux-x64-vulkan/_nlcBuildMetadata.json +1 -0
  11. package/bins/linux-x64-vulkan/llama-addon.node +0 -0
  12. package/bins/mac-arm64-metal/_nlcBuildMetadata.json +1 -0
  13. package/bins/mac-arm64-metal/default.metallib +0 -0
  14. package/bins/mac-arm64-metal/llama-addon.node +0 -0
  15. package/bins/mac-x64/_nlcBuildMetadata.json +1 -0
  16. package/bins/mac-x64/llama-addon.node +0 -0
  17. package/bins/win-arm64/_nlcBuildMetadata.json +1 -0
  18. package/bins/win-arm64/llama-addon.exp +0 -0
  19. package/bins/win-arm64/llama-addon.lib +0 -0
  20. package/bins/win-arm64/llama-addon.node +0 -0
  21. package/bins/win-x64/_nlcBuildMetadata.json +1 -0
  22. package/bins/win-x64/llama-addon.exp +0 -0
  23. package/bins/win-x64/llama-addon.lib +0 -0
  24. package/bins/win-x64/llama-addon.node +0 -0
  25. package/bins/win-x64-cuda/_nlcBuildMetadata.json +1 -0
  26. package/bins/win-x64-cuda/llama-addon.exp +0 -0
  27. package/bins/win-x64-cuda/llama-addon.lib +0 -0
  28. package/bins/win-x64-cuda/llama-addon.node +0 -0
  29. package/bins/win-x64-vulkan/_nlcBuildMetadata.json +1 -0
  30. package/bins/win-x64-vulkan/llama-addon.exp +0 -0
  31. package/bins/win-x64-vulkan/llama-addon.lib +0 -0
  32. package/bins/win-x64-vulkan/llama-addon.node +0 -0
  33. package/dist/ChatWrapper.d.ts +8 -39
  34. package/dist/ChatWrapper.js +115 -72
  35. package/dist/ChatWrapper.js.map +1 -1
  36. package/dist/apiDocsIndex.d.ts +1 -0
  37. package/dist/apiDocsIndex.js +7 -0
  38. package/dist/apiDocsIndex.js.map +1 -0
  39. package/dist/{utils/getBin.d.ts → bindings/AddonTypes.d.ts} +54 -8
  40. package/dist/bindings/AddonTypes.js +2 -0
  41. package/dist/bindings/AddonTypes.js.map +1 -0
  42. package/dist/bindings/Llama.d.ts +47 -0
  43. package/dist/bindings/Llama.js +353 -0
  44. package/dist/bindings/Llama.js.map +1 -0
  45. package/dist/bindings/consts.d.ts +2 -0
  46. package/dist/bindings/consts.js +11 -0
  47. package/dist/bindings/consts.js.map +1 -0
  48. package/dist/bindings/getLlama.d.ts +148 -0
  49. package/dist/bindings/getLlama.js +401 -0
  50. package/dist/bindings/getLlama.js.map +1 -0
  51. package/dist/bindings/types.d.ts +56 -0
  52. package/dist/bindings/types.js +77 -0
  53. package/dist/bindings/types.js.map +1 -0
  54. package/dist/bindings/utils/MemoryOrchestrator.d.ts +21 -0
  55. package/dist/bindings/utils/MemoryOrchestrator.js +49 -0
  56. package/dist/bindings/utils/MemoryOrchestrator.js.map +1 -0
  57. package/dist/bindings/utils/NoBinaryFoundError.d.ts +2 -0
  58. package/dist/bindings/utils/NoBinaryFoundError.js +7 -0
  59. package/dist/bindings/utils/NoBinaryFoundError.js.map +1 -0
  60. package/dist/bindings/utils/asyncEvery.d.ts +5 -0
  61. package/dist/bindings/utils/asyncEvery.js +15 -0
  62. package/dist/bindings/utils/asyncEvery.js.map +1 -0
  63. package/dist/bindings/utils/asyncSome.d.ts +5 -0
  64. package/dist/bindings/utils/asyncSome.js +27 -0
  65. package/dist/bindings/utils/asyncSome.js.map +1 -0
  66. package/dist/{utils → bindings/utils}/binariesGithubRelease.js +1 -1
  67. package/dist/bindings/utils/binariesGithubRelease.js.map +1 -0
  68. package/dist/bindings/utils/clearAllLocalBuilds.d.ts +1 -0
  69. package/dist/bindings/utils/clearAllLocalBuilds.js +47 -0
  70. package/dist/bindings/utils/clearAllLocalBuilds.js.map +1 -0
  71. package/dist/bindings/utils/cloneLlamaCppRepo.d.ts +11 -0
  72. package/dist/bindings/utils/cloneLlamaCppRepo.js +166 -0
  73. package/dist/bindings/utils/cloneLlamaCppRepo.js.map +1 -0
  74. package/dist/bindings/utils/compileLLamaCpp.d.ts +17 -0
  75. package/dist/bindings/utils/compileLLamaCpp.js +226 -0
  76. package/dist/bindings/utils/compileLLamaCpp.js.map +1 -0
  77. package/dist/bindings/utils/detectAvailableComputeLayers.d.ts +14 -0
  78. package/dist/bindings/utils/detectAvailableComputeLayers.js +305 -0
  79. package/dist/bindings/utils/detectAvailableComputeLayers.js.map +1 -0
  80. package/dist/bindings/utils/detectGlibc.d.ts +4 -0
  81. package/dist/bindings/utils/detectGlibc.js +46 -0
  82. package/dist/bindings/utils/detectGlibc.js.map +1 -0
  83. package/dist/bindings/utils/getBestComputeLayersAvailable.d.ts +10 -0
  84. package/dist/bindings/utils/getBestComputeLayersAvailable.js +29 -0
  85. package/dist/bindings/utils/getBestComputeLayersAvailable.js.map +1 -0
  86. package/dist/bindings/utils/getBuildFolderNameForBuildOptions.d.ts +5 -0
  87. package/dist/bindings/utils/getBuildFolderNameForBuildOptions.js +93 -0
  88. package/dist/bindings/utils/getBuildFolderNameForBuildOptions.js.map +1 -0
  89. package/dist/bindings/utils/getCanUsePrebuiltBinaries.d.ts +1 -0
  90. package/dist/bindings/utils/getCanUsePrebuiltBinaries.js +8 -0
  91. package/dist/bindings/utils/getCanUsePrebuiltBinaries.js.map +1 -0
  92. package/dist/bindings/utils/getExampleUsageCodeOfGetLlama.d.ts +2 -0
  93. package/dist/bindings/utils/getExampleUsageCodeOfGetLlama.js +21 -0
  94. package/dist/bindings/utils/getExampleUsageCodeOfGetLlama.js.map +1 -0
  95. package/dist/bindings/utils/getGpuTypesToUseForOption.d.ts +12 -0
  96. package/dist/bindings/utils/getGpuTypesToUseForOption.js +30 -0
  97. package/dist/bindings/utils/getGpuTypesToUseForOption.js.map +1 -0
  98. package/dist/bindings/utils/getLinuxDistroInfo.d.ts +9 -0
  99. package/dist/bindings/utils/getLinuxDistroInfo.js +46 -0
  100. package/dist/bindings/utils/getLinuxDistroInfo.js.map +1 -0
  101. package/dist/bindings/utils/getLlamaWithoutBackend.d.ts +5 -0
  102. package/dist/bindings/utils/getLlamaWithoutBackend.js +27 -0
  103. package/dist/bindings/utils/getLlamaWithoutBackend.js.map +1 -0
  104. package/dist/bindings/utils/getPlatform.d.ts +2 -0
  105. package/dist/bindings/utils/getPlatform.js +15 -0
  106. package/dist/bindings/utils/getPlatform.js.map +1 -0
  107. package/dist/bindings/utils/getPlatformInfo.d.ts +5 -0
  108. package/dist/bindings/utils/getPlatformInfo.js +28 -0
  109. package/dist/bindings/utils/getPlatformInfo.js.map +1 -0
  110. package/dist/bindings/utils/hasBuildingFromSourceDependenciesInstalled.d.ts +3 -0
  111. package/dist/bindings/utils/hasBuildingFromSourceDependenciesInstalled.js +27 -0
  112. package/dist/bindings/utils/hasBuildingFromSourceDependenciesInstalled.js.map +1 -0
  113. package/dist/bindings/utils/hasFileInPath.d.ts +2 -0
  114. package/dist/bindings/utils/hasFileInPath.js +34 -0
  115. package/dist/bindings/utils/hasFileInPath.js.map +1 -0
  116. package/dist/bindings/utils/lastBuildInfo.d.ts +6 -0
  117. package/dist/bindings/utils/lastBuildInfo.js +17 -0
  118. package/dist/bindings/utils/lastBuildInfo.js.map +1 -0
  119. package/dist/bindings/utils/logBinaryUsageExampleToConsole.d.ts +2 -0
  120. package/dist/bindings/utils/logBinaryUsageExampleToConsole.js +22 -0
  121. package/dist/bindings/utils/logBinaryUsageExampleToConsole.js.map +1 -0
  122. package/dist/bindings/utils/logDistroInstallInstruction.d.ts +14 -0
  123. package/dist/bindings/utils/logDistroInstallInstruction.js +48 -0
  124. package/dist/bindings/utils/logDistroInstallInstruction.js.map +1 -0
  125. package/dist/bindings/utils/resolveCustomCmakeOptions.d.ts +1 -0
  126. package/dist/bindings/utils/resolveCustomCmakeOptions.js +47 -0
  127. package/dist/bindings/utils/resolveCustomCmakeOptions.js.map +1 -0
  128. package/dist/bindings/utils/testBindingBinary.d.ts +1 -0
  129. package/dist/bindings/utils/testBindingBinary.js +100 -0
  130. package/dist/bindings/utils/testBindingBinary.js.map +1 -0
  131. package/dist/bindings/utils/testCmakeBinary.d.ts +6 -0
  132. package/dist/bindings/utils/testCmakeBinary.js +32 -0
  133. package/dist/bindings/utils/testCmakeBinary.js.map +1 -0
  134. package/dist/chatWrappers/AlpacaChatWrapper.d.ts +2 -1
  135. package/dist/chatWrappers/AlpacaChatWrapper.js +9 -2
  136. package/dist/chatWrappers/AlpacaChatWrapper.js.map +1 -1
  137. package/dist/chatWrappers/ChatMLChatWrapper.d.ts +2 -9
  138. package/dist/chatWrappers/ChatMLChatWrapper.js +23 -21
  139. package/dist/chatWrappers/ChatMLChatWrapper.js.map +1 -1
  140. package/dist/chatWrappers/FalconChatWrapper.d.ts +4 -10
  141. package/dist/chatWrappers/FalconChatWrapper.js +38 -21
  142. package/dist/chatWrappers/FalconChatWrapper.js.map +1 -1
  143. package/dist/chatWrappers/FunctionaryChatWrapper.d.ts +8 -32
  144. package/dist/chatWrappers/FunctionaryChatWrapper.js +323 -118
  145. package/dist/chatWrappers/FunctionaryChatWrapper.js.map +1 -1
  146. package/dist/chatWrappers/GemmaChatWrapper.d.ts +7 -0
  147. package/dist/chatWrappers/GemmaChatWrapper.js +96 -0
  148. package/dist/chatWrappers/GemmaChatWrapper.js.map +1 -0
  149. package/dist/chatWrappers/GeneralChatWrapper.d.ts +4 -10
  150. package/dist/chatWrappers/GeneralChatWrapper.js +45 -22
  151. package/dist/chatWrappers/GeneralChatWrapper.js.map +1 -1
  152. package/dist/chatWrappers/Llama2ChatWrapper.d.ts +12 -0
  153. package/dist/chatWrappers/{LlamaChatWrapper.js → Llama2ChatWrapper.js} +38 -20
  154. package/dist/chatWrappers/Llama2ChatWrapper.js.map +1 -0
  155. package/dist/chatWrappers/Llama3ChatWrapper.d.ts +16 -0
  156. package/dist/chatWrappers/Llama3ChatWrapper.js +174 -0
  157. package/dist/chatWrappers/Llama3ChatWrapper.js.map +1 -0
  158. package/dist/chatWrappers/generic/JinjaTemplateChatWrapper.d.ts +67 -0
  159. package/dist/chatWrappers/generic/JinjaTemplateChatWrapper.js +371 -0
  160. package/dist/chatWrappers/generic/JinjaTemplateChatWrapper.js.map +1 -0
  161. package/dist/chatWrappers/generic/TemplateChatWrapper.d.ts +54 -0
  162. package/dist/chatWrappers/generic/TemplateChatWrapper.js +200 -0
  163. package/dist/chatWrappers/generic/TemplateChatWrapper.js.map +1 -0
  164. package/dist/chatWrappers/generic/utils/chatHistoryFunctionCallMessageTemplate.d.ts +23 -0
  165. package/dist/chatWrappers/generic/utils/chatHistoryFunctionCallMessageTemplate.js +45 -0
  166. package/dist/chatWrappers/generic/utils/chatHistoryFunctionCallMessageTemplate.js.map +1 -0
  167. package/dist/chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.d.ts +42 -0
  168. package/dist/chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.js +82 -0
  169. package/dist/chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.js.map +1 -0
  170. package/dist/chatWrappers/utils/isJinjaTemplateEquivalentToSpecializedChatWrapper.d.ts +4 -0
  171. package/dist/chatWrappers/utils/isJinjaTemplateEquivalentToSpecializedChatWrapper.js +210 -0
  172. package/dist/chatWrappers/utils/isJinjaTemplateEquivalentToSpecializedChatWrapper.js.map +1 -0
  173. package/dist/chatWrappers/utils/resolveChatWrapper.d.ts +69 -0
  174. package/dist/chatWrappers/utils/resolveChatWrapper.js +243 -0
  175. package/dist/chatWrappers/utils/resolveChatWrapper.js.map +1 -0
  176. package/dist/cli/cli.js +21 -7
  177. package/dist/cli/cli.js.map +1 -1
  178. package/dist/cli/commands/BuildCommand.d.ts +11 -4
  179. package/dist/cli/commands/BuildCommand.js +114 -41
  180. package/dist/cli/commands/BuildCommand.js.map +1 -1
  181. package/dist/cli/commands/ChatCommand.d.ts +18 -6
  182. package/dist/cli/commands/ChatCommand.js +300 -143
  183. package/dist/cli/commands/ChatCommand.js.map +1 -1
  184. package/dist/cli/commands/ClearCommand.d.ts +1 -1
  185. package/dist/cli/commands/ClearCommand.js +11 -12
  186. package/dist/cli/commands/ClearCommand.js.map +1 -1
  187. package/dist/cli/commands/CompleteCommand.d.ts +29 -0
  188. package/dist/cli/commands/CompleteCommand.js +365 -0
  189. package/dist/cli/commands/CompleteCommand.js.map +1 -0
  190. package/dist/cli/commands/DebugCommand.d.ts +7 -0
  191. package/dist/cli/commands/DebugCommand.js +54 -0
  192. package/dist/cli/commands/DebugCommand.js.map +1 -0
  193. package/dist/cli/commands/DownloadCommand.d.ts +7 -4
  194. package/dist/cli/commands/DownloadCommand.js +121 -70
  195. package/dist/cli/commands/DownloadCommand.js.map +1 -1
  196. package/dist/cli/commands/InfillCommand.d.ts +31 -0
  197. package/dist/cli/commands/InfillCommand.js +401 -0
  198. package/dist/cli/commands/InfillCommand.js.map +1 -0
  199. package/dist/cli/commands/InitCommand.d.ts +11 -0
  200. package/dist/cli/commands/InitCommand.js +195 -0
  201. package/dist/cli/commands/InitCommand.js.map +1 -0
  202. package/dist/cli/commands/OnPostInstallCommand.js +9 -10
  203. package/dist/cli/commands/OnPostInstallCommand.js.map +1 -1
  204. package/dist/cli/commands/PullCommand.d.ts +12 -0
  205. package/dist/cli/commands/PullCommand.js +117 -0
  206. package/dist/cli/commands/PullCommand.js.map +1 -0
  207. package/dist/cli/commands/inspect/InspectCommand.d.ts +4 -0
  208. package/dist/cli/commands/inspect/InspectCommand.js +19 -0
  209. package/dist/cli/commands/inspect/InspectCommand.js.map +1 -0
  210. package/dist/cli/commands/inspect/commands/InspectGgufCommand.d.ts +12 -0
  211. package/dist/cli/commands/inspect/commands/InspectGgufCommand.js +136 -0
  212. package/dist/cli/commands/inspect/commands/InspectGgufCommand.js.map +1 -0
  213. package/dist/cli/commands/inspect/commands/InspectGpuCommand.d.ts +4 -0
  214. package/dist/cli/commands/inspect/commands/InspectGpuCommand.js +179 -0
  215. package/dist/cli/commands/inspect/commands/InspectGpuCommand.js.map +1 -0
  216. package/dist/cli/commands/inspect/commands/InspectMeasureCommand.d.ts +17 -0
  217. package/dist/cli/commands/inspect/commands/InspectMeasureCommand.js +613 -0
  218. package/dist/cli/commands/inspect/commands/InspectMeasureCommand.js.map +1 -0
  219. package/dist/cli/projectTemplates.d.ts +7 -0
  220. package/dist/cli/projectTemplates.js +10 -0
  221. package/dist/cli/projectTemplates.js.map +1 -0
  222. package/dist/cli/recommendedModels.d.ts +2 -0
  223. package/dist/cli/recommendedModels.js +363 -0
  224. package/dist/cli/recommendedModels.js.map +1 -0
  225. package/dist/cli/startCreateCli.d.ts +2 -0
  226. package/dist/cli/startCreateCli.js +26 -0
  227. package/dist/cli/startCreateCli.js.map +1 -0
  228. package/dist/cli/utils/ConsoleInteraction.d.ts +23 -0
  229. package/dist/cli/utils/ConsoleInteraction.js +122 -0
  230. package/dist/cli/utils/ConsoleInteraction.js.map +1 -0
  231. package/dist/cli/utils/ConsoleTable.d.ts +23 -0
  232. package/dist/cli/utils/ConsoleTable.js +86 -0
  233. package/dist/cli/utils/ConsoleTable.js.map +1 -0
  234. package/dist/cli/utils/basicChooseFromListConsoleInteraction.d.ts +13 -0
  235. package/dist/cli/utils/basicChooseFromListConsoleInteraction.js +111 -0
  236. package/dist/cli/utils/basicChooseFromListConsoleInteraction.js.map +1 -0
  237. package/dist/cli/utils/consolePromptQuestion.d.ts +6 -0
  238. package/dist/cli/utils/consolePromptQuestion.js +82 -0
  239. package/dist/cli/utils/consolePromptQuestion.js.map +1 -0
  240. package/dist/cli/utils/getReadablePath.d.ts +1 -0
  241. package/dist/cli/utils/getReadablePath.js +14 -0
  242. package/dist/cli/utils/getReadablePath.js.map +1 -0
  243. package/dist/cli/utils/interactivelyAskForModel.d.ts +7 -0
  244. package/dist/cli/utils/interactivelyAskForModel.js +451 -0
  245. package/dist/cli/utils/interactivelyAskForModel.js.map +1 -0
  246. package/dist/cli/utils/logUsedGpuTypeOption.d.ts +2 -0
  247. package/dist/cli/utils/logUsedGpuTypeOption.js +9 -0
  248. package/dist/cli/utils/logUsedGpuTypeOption.js.map +1 -0
  249. package/dist/cli/utils/printCommonInfoLines.d.ts +9 -0
  250. package/dist/cli/utils/printCommonInfoLines.js +75 -0
  251. package/dist/cli/utils/printCommonInfoLines.js.map +1 -0
  252. package/dist/cli/utils/printInfoLine.d.ts +12 -0
  253. package/dist/cli/utils/printInfoLine.js +54 -0
  254. package/dist/cli/utils/printInfoLine.js.map +1 -0
  255. package/dist/cli/utils/projectTemplates.d.ts +19 -0
  256. package/dist/cli/utils/projectTemplates.js +47 -0
  257. package/dist/cli/utils/projectTemplates.js.map +1 -0
  258. package/dist/cli/utils/resolveCommandGgufPath.d.ts +4 -0
  259. package/dist/cli/utils/resolveCommandGgufPath.js +71 -0
  260. package/dist/cli/utils/resolveCommandGgufPath.js.map +1 -0
  261. package/dist/cli/utils/resolveHeaderFlag.d.ts +1 -0
  262. package/dist/cli/utils/resolveHeaderFlag.js +21 -0
  263. package/dist/cli/utils/resolveHeaderFlag.js.map +1 -0
  264. package/dist/cli/utils/resolveModelRecommendationFileOptions.d.ts +19 -0
  265. package/dist/cli/utils/resolveModelRecommendationFileOptions.js +7 -0
  266. package/dist/cli/utils/resolveModelRecommendationFileOptions.js.map +1 -0
  267. package/dist/cli/utils/splitAnsiToLines.d.ts +1 -0
  268. package/dist/cli/utils/splitAnsiToLines.js +32 -0
  269. package/dist/cli/utils/splitAnsiToLines.js.map +1 -0
  270. package/dist/cli/utils/withCliCommandDescriptionDocsUrl.d.ts +2 -0
  271. package/dist/cli/utils/withCliCommandDescriptionDocsUrl.js +23 -0
  272. package/dist/cli/utils/withCliCommandDescriptionDocsUrl.js.map +1 -0
  273. package/dist/commands.d.ts +1 -0
  274. package/dist/commands.js +3 -0
  275. package/dist/commands.js.map +1 -1
  276. package/dist/config.d.ts +38 -5
  277. package/dist/config.js +61 -16
  278. package/dist/config.js.map +1 -1
  279. package/dist/consts.d.ts +3 -0
  280. package/dist/consts.js +10 -0
  281. package/dist/consts.js.map +1 -0
  282. package/dist/{llamaEvaluator → evaluator}/LlamaChat/LlamaChat.d.ts +112 -39
  283. package/dist/evaluator/LlamaChat/LlamaChat.js +1512 -0
  284. package/dist/evaluator/LlamaChat/LlamaChat.js.map +1 -0
  285. package/dist/evaluator/LlamaChat/utils/FunctionCallNameGrammar.d.ts +11 -0
  286. package/dist/evaluator/LlamaChat/utils/FunctionCallNameGrammar.js +55 -0
  287. package/dist/evaluator/LlamaChat/utils/FunctionCallNameGrammar.js.map +1 -0
  288. package/dist/evaluator/LlamaChat/utils/FunctionCallParamsGrammar.d.ts +16 -0
  289. package/dist/evaluator/LlamaChat/utils/FunctionCallParamsGrammar.js +45 -0
  290. package/dist/evaluator/LlamaChat/utils/FunctionCallParamsGrammar.js.map +1 -0
  291. package/dist/evaluator/LlamaChat/utils/LlamaFunctionCallValidationError.d.ts +8 -0
  292. package/dist/evaluator/LlamaChat/utils/LlamaFunctionCallValidationError.js +12 -0
  293. package/dist/evaluator/LlamaChat/utils/LlamaFunctionCallValidationError.js.map +1 -0
  294. package/dist/{llamaEvaluator → evaluator}/LlamaChat/utils/contextShiftStrategies/eraseFirstResponseAndKeepFirstSystemChatContextShiftStrategy.js +42 -16
  295. package/dist/evaluator/LlamaChat/utils/contextShiftStrategies/eraseFirstResponseAndKeepFirstSystemChatContextShiftStrategy.js.map +1 -0
  296. package/dist/evaluator/LlamaChatSession/LlamaChatSession.d.ts +288 -0
  297. package/dist/evaluator/LlamaChatSession/LlamaChatSession.js +419 -0
  298. package/dist/evaluator/LlamaChatSession/LlamaChatSession.js.map +1 -0
  299. package/dist/evaluator/LlamaChatSession/utils/LlamaChatSessionPromptCompletionEngine.d.ts +39 -0
  300. package/dist/evaluator/LlamaChatSession/utils/LlamaChatSessionPromptCompletionEngine.js +186 -0
  301. package/dist/evaluator/LlamaChatSession/utils/LlamaChatSessionPromptCompletionEngine.js.map +1 -0
  302. package/dist/{llamaEvaluator → evaluator}/LlamaChatSession/utils/defineChatSessionFunction.d.ts +3 -0
  303. package/dist/{llamaEvaluator → evaluator}/LlamaChatSession/utils/defineChatSessionFunction.js +3 -0
  304. package/dist/evaluator/LlamaChatSession/utils/defineChatSessionFunction.js.map +1 -0
  305. package/dist/evaluator/LlamaCompletion.d.ts +143 -0
  306. package/dist/evaluator/LlamaCompletion.js +418 -0
  307. package/dist/evaluator/LlamaCompletion.js.map +1 -0
  308. package/dist/{llamaEvaluator → evaluator}/LlamaContext/LlamaContext.d.ts +41 -21
  309. package/dist/{llamaEvaluator → evaluator}/LlamaContext/LlamaContext.js +270 -81
  310. package/dist/evaluator/LlamaContext/LlamaContext.js.map +1 -0
  311. package/dist/evaluator/LlamaContext/types.d.ts +140 -0
  312. package/dist/evaluator/LlamaContext/types.js.map +1 -0
  313. package/dist/evaluator/LlamaContext/utils/batchItemsPrioritizationStrategies/firstInFirstOutStrategy.js.map +1 -0
  314. package/dist/evaluator/LlamaContext/utils/batchItemsPrioritizationStrategies/maximumParallelismStrategy.js.map +1 -0
  315. package/dist/evaluator/LlamaContext/utils/resolveBatchItemsPrioritizationStrategy.d.ts +2 -0
  316. package/dist/{llamaEvaluator/LlamaContext/utils/resolveBatchItemsPrioritizingStrategy.js → evaluator/LlamaContext/utils/resolveBatchItemsPrioritizationStrategy.js} +4 -4
  317. package/dist/evaluator/LlamaContext/utils/resolveBatchItemsPrioritizationStrategy.js.map +1 -0
  318. package/dist/evaluator/LlamaEmbeddingContext.d.ts +51 -0
  319. package/dist/evaluator/LlamaEmbeddingContext.js +73 -0
  320. package/dist/evaluator/LlamaEmbeddingContext.js.map +1 -0
  321. package/dist/{llamaEvaluator → evaluator}/LlamaGrammar.d.ts +10 -7
  322. package/dist/{llamaEvaluator → evaluator}/LlamaGrammar.js +14 -11
  323. package/dist/evaluator/LlamaGrammar.js.map +1 -0
  324. package/dist/{llamaEvaluator → evaluator}/LlamaGrammarEvaluationState.js +4 -4
  325. package/dist/evaluator/LlamaGrammarEvaluationState.js.map +1 -0
  326. package/dist/{llamaEvaluator → evaluator}/LlamaJsonSchemaGrammar.d.ts +2 -1
  327. package/dist/{llamaEvaluator → evaluator}/LlamaJsonSchemaGrammar.js +3 -3
  328. package/dist/evaluator/LlamaJsonSchemaGrammar.js.map +1 -0
  329. package/dist/evaluator/LlamaModel/LlamaModel.d.ts +236 -0
  330. package/dist/evaluator/LlamaModel/LlamaModel.js +679 -0
  331. package/dist/evaluator/LlamaModel/LlamaModel.js.map +1 -0
  332. package/dist/evaluator/LlamaModel/utils/TokenAttributes.d.ts +29 -0
  333. package/dist/evaluator/LlamaModel/utils/TokenAttributes.js +65 -0
  334. package/dist/evaluator/LlamaModel/utils/TokenAttributes.js.map +1 -0
  335. package/dist/evaluator/TokenBias.d.ts +22 -0
  336. package/dist/evaluator/TokenBias.js +33 -0
  337. package/dist/evaluator/TokenBias.js.map +1 -0
  338. package/dist/evaluator/TokenMeter.d.ts +54 -0
  339. package/dist/evaluator/TokenMeter.js +86 -0
  340. package/dist/evaluator/TokenMeter.js.map +1 -0
  341. package/dist/gguf/consts.d.ts +3 -0
  342. package/dist/gguf/consts.js +8 -0
  343. package/dist/gguf/consts.js.map +1 -0
  344. package/dist/gguf/errors/InvalidGgufMagicError.d.ts +3 -0
  345. package/dist/gguf/errors/InvalidGgufMagicError.js +6 -0
  346. package/dist/gguf/errors/InvalidGgufMagicError.js.map +1 -0
  347. package/dist/gguf/errors/UnsupportedGgufValueTypeError.d.ts +4 -0
  348. package/dist/gguf/errors/UnsupportedGgufValueTypeError.js +9 -0
  349. package/dist/gguf/errors/UnsupportedGgufValueTypeError.js.map +1 -0
  350. package/dist/gguf/fileReaders/GgufFileReader.d.ts +33 -0
  351. package/dist/gguf/fileReaders/GgufFileReader.js +76 -0
  352. package/dist/gguf/fileReaders/GgufFileReader.js.map +1 -0
  353. package/dist/gguf/fileReaders/GgufFsFileReader.d.ts +17 -0
  354. package/dist/gguf/fileReaders/GgufFsFileReader.js +46 -0
  355. package/dist/gguf/fileReaders/GgufFsFileReader.js.map +1 -0
  356. package/dist/gguf/fileReaders/GgufNetworkFetchFileReader.d.ts +22 -0
  357. package/dist/gguf/fileReaders/GgufNetworkFetchFileReader.js +63 -0
  358. package/dist/gguf/fileReaders/GgufNetworkFetchFileReader.js.map +1 -0
  359. package/dist/gguf/insights/GgufInsights.d.ts +48 -0
  360. package/dist/gguf/insights/GgufInsights.js +381 -0
  361. package/dist/gguf/insights/GgufInsights.js.map +1 -0
  362. package/dist/gguf/insights/GgufInsightsConfigurationResolver.d.ts +87 -0
  363. package/dist/gguf/insights/GgufInsightsConfigurationResolver.js +141 -0
  364. package/dist/gguf/insights/GgufInsightsConfigurationResolver.js.map +1 -0
  365. package/dist/gguf/insights/utils/resolveContextContextSizeOption.d.ts +18 -0
  366. package/dist/gguf/insights/utils/resolveContextContextSizeOption.js +76 -0
  367. package/dist/gguf/insights/utils/resolveContextContextSizeOption.js.map +1 -0
  368. package/dist/gguf/insights/utils/resolveModelGpuLayersOption.d.ts +14 -0
  369. package/dist/gguf/insights/utils/resolveModelGpuLayersOption.js +177 -0
  370. package/dist/gguf/insights/utils/resolveModelGpuLayersOption.js.map +1 -0
  371. package/dist/gguf/insights/utils/scoreLevels.d.ts +5 -0
  372. package/dist/gguf/insights/utils/scoreLevels.js +16 -0
  373. package/dist/gguf/insights/utils/scoreLevels.js.map +1 -0
  374. package/dist/gguf/parser/GgufV2Parser.d.ts +19 -0
  375. package/dist/gguf/parser/GgufV2Parser.js +115 -0
  376. package/dist/gguf/parser/GgufV2Parser.js.map +1 -0
  377. package/dist/gguf/parser/GgufV3Parser.d.ts +3 -0
  378. package/dist/gguf/parser/GgufV3Parser.js +4 -0
  379. package/dist/gguf/parser/GgufV3Parser.js.map +1 -0
  380. package/dist/gguf/parser/parseGguf.d.ts +8 -0
  381. package/dist/gguf/parser/parseGguf.js +63 -0
  382. package/dist/gguf/parser/parseGguf.js.map +1 -0
  383. package/dist/gguf/readGgufFileInfo.d.ts +33 -0
  384. package/dist/gguf/readGgufFileInfo.js +66 -0
  385. package/dist/gguf/readGgufFileInfo.js.map +1 -0
  386. package/dist/gguf/types/GgufFileInfoTypes.d.ts +84 -0
  387. package/dist/gguf/types/GgufFileInfoTypes.js +18 -0
  388. package/dist/gguf/types/GgufFileInfoTypes.js.map +1 -0
  389. package/dist/gguf/types/GgufMetadataTypes.d.ts +335 -0
  390. package/dist/gguf/types/GgufMetadataTypes.js +86 -0
  391. package/dist/gguf/types/GgufMetadataTypes.js.map +1 -0
  392. package/dist/gguf/types/GgufTensorInfoTypes.d.ts +37 -0
  393. package/dist/gguf/types/GgufTensorInfoTypes.js +33 -0
  394. package/dist/gguf/types/GgufTensorInfoTypes.js.map +1 -0
  395. package/dist/gguf/utils/GgufReadOffset.d.ts +6 -0
  396. package/dist/gguf/utils/GgufReadOffset.js +18 -0
  397. package/dist/gguf/utils/GgufReadOffset.js.map +1 -0
  398. package/dist/gguf/utils/convertMetadataKeyValueRecordToNestedObject.d.ts +5 -0
  399. package/dist/gguf/utils/convertMetadataKeyValueRecordToNestedObject.js +38 -0
  400. package/dist/gguf/utils/convertMetadataKeyValueRecordToNestedObject.js.map +1 -0
  401. package/dist/gguf/utils/getGgufFileTypeName.d.ts +4 -0
  402. package/dist/gguf/utils/getGgufFileTypeName.js +13 -0
  403. package/dist/gguf/utils/getGgufFileTypeName.js.map +1 -0
  404. package/dist/gguf/utils/getGgufMetadataArchitectureData.d.ts +3 -0
  405. package/dist/gguf/utils/getGgufMetadataArchitectureData.js +4 -0
  406. package/dist/gguf/utils/getGgufMetadataArchitectureData.js.map +1 -0
  407. package/dist/gguf/utils/normalizeGgufDownloadUrl.d.ts +1 -0
  408. package/dist/gguf/utils/normalizeGgufDownloadUrl.js +16 -0
  409. package/dist/gguf/utils/normalizeGgufDownloadUrl.js.map +1 -0
  410. package/dist/gguf/utils/resolveBinarySplitGgufPartUrls.d.ts +2 -0
  411. package/dist/gguf/utils/resolveBinarySplitGgufPartUrls.js +39 -0
  412. package/dist/gguf/utils/resolveBinarySplitGgufPartUrls.js.map +1 -0
  413. package/dist/gguf/utils/resolveSplitGgufParts.d.ts +7 -0
  414. package/dist/gguf/utils/resolveSplitGgufParts.js +55 -0
  415. package/dist/gguf/utils/resolveSplitGgufParts.js.map +1 -0
  416. package/dist/index.d.ts +41 -18
  417. package/dist/index.js +36 -15
  418. package/dist/index.js.map +1 -1
  419. package/dist/state.d.ts +4 -0
  420. package/dist/state.js +14 -0
  421. package/dist/state.js.map +1 -1
  422. package/dist/types.d.ts +116 -5
  423. package/dist/types.js.map +1 -1
  424. package/dist/utils/DisposeGuard.d.ts +13 -0
  425. package/dist/utils/DisposeGuard.js +120 -0
  426. package/dist/utils/DisposeGuard.js.map +1 -0
  427. package/dist/utils/InsufficientMemoryError.d.ts +3 -0
  428. package/dist/utils/InsufficientMemoryError.js +6 -0
  429. package/dist/utils/InsufficientMemoryError.js.map +1 -0
  430. package/dist/utils/LlamaText.d.ts +70 -26
  431. package/dist/utils/LlamaText.js +469 -157
  432. package/dist/utils/LlamaText.js.map +1 -1
  433. package/dist/utils/LruCache.d.ts +12 -0
  434. package/dist/utils/LruCache.js +44 -0
  435. package/dist/utils/LruCache.js.map +1 -0
  436. package/dist/utils/ReplHistory.js.map +1 -1
  437. package/dist/utils/StopGenerationDetector.d.ts +25 -9
  438. package/dist/utils/StopGenerationDetector.js +93 -22
  439. package/dist/utils/StopGenerationDetector.js.map +1 -1
  440. package/dist/utils/TokenStreamRegulator.d.ts +9 -4
  441. package/dist/utils/TokenStreamRegulator.js +81 -8
  442. package/dist/utils/TokenStreamRegulator.js.map +1 -1
  443. package/dist/utils/UnsupportedError.d.ts +2 -0
  444. package/dist/utils/UnsupportedError.js +7 -0
  445. package/dist/utils/UnsupportedError.js.map +1 -0
  446. package/dist/utils/appendUserMessageToChatHistory.js.map +1 -1
  447. package/dist/utils/clearTempFolder.js.map +1 -1
  448. package/dist/utils/cmake.js +38 -20
  449. package/dist/utils/cmake.js.map +1 -1
  450. package/dist/utils/createModelDownloader.d.ts +108 -0
  451. package/dist/utils/createModelDownloader.js +231 -0
  452. package/dist/utils/createModelDownloader.js.map +1 -0
  453. package/dist/utils/findBestOption.d.ts +4 -0
  454. package/dist/utils/findBestOption.js +15 -0
  455. package/dist/utils/findBestOption.js.map +1 -0
  456. package/dist/utils/findCharacterRemovalCountToFitChatHistoryInContext.d.ts +1 -0
  457. package/dist/utils/findCharacterRemovalCountToFitChatHistoryInContext.js +23 -12
  458. package/dist/utils/findCharacterRemovalCountToFitChatHistoryInContext.js.map +1 -1
  459. package/dist/utils/gbnfJson/GbnfGrammarGenerator.js.map +1 -1
  460. package/dist/utils/gbnfJson/getGbnfGrammarForGbnfJsonSchema.d.ts +5 -0
  461. package/dist/utils/gbnfJson/getGbnfGrammarForGbnfJsonSchema.js +11 -0
  462. package/dist/utils/gbnfJson/getGbnfGrammarForGbnfJsonSchema.js.map +1 -0
  463. package/dist/utils/gbnfJson/terminals/GbnfArray.d.ts +3 -1
  464. package/dist/utils/gbnfJson/terminals/GbnfArray.js +10 -5
  465. package/dist/utils/gbnfJson/terminals/GbnfArray.js.map +1 -1
  466. package/dist/utils/gbnfJson/terminals/GbnfBoolean.d.ts +1 -1
  467. package/dist/utils/gbnfJson/terminals/GbnfBoolean.js.map +1 -1
  468. package/dist/utils/gbnfJson/terminals/GbnfBooleanValue.js.map +1 -1
  469. package/dist/utils/gbnfJson/terminals/GbnfGrammar.js.map +1 -1
  470. package/dist/utils/gbnfJson/terminals/GbnfNull.d.ts +1 -1
  471. package/dist/utils/gbnfJson/terminals/GbnfNull.js.map +1 -1
  472. package/dist/utils/gbnfJson/terminals/GbnfNumber.d.ts +1 -1
  473. package/dist/utils/gbnfJson/terminals/GbnfNumber.js.map +1 -1
  474. package/dist/utils/gbnfJson/terminals/GbnfNumberValue.js.map +1 -1
  475. package/dist/utils/gbnfJson/terminals/GbnfObjectMap.d.ts +3 -1
  476. package/dist/utils/gbnfJson/terminals/GbnfObjectMap.js +9 -4
  477. package/dist/utils/gbnfJson/terminals/GbnfObjectMap.js.map +1 -1
  478. package/dist/utils/gbnfJson/terminals/GbnfOr.js.map +1 -1
  479. package/dist/utils/gbnfJson/terminals/GbnfRepetition.d.ts +9 -0
  480. package/dist/utils/gbnfJson/terminals/GbnfRepetition.js +37 -0
  481. package/dist/utils/gbnfJson/terminals/GbnfRepetition.js.map +1 -0
  482. package/dist/utils/gbnfJson/terminals/GbnfString.d.ts +1 -1
  483. package/dist/utils/gbnfJson/terminals/GbnfString.js +23 -5
  484. package/dist/utils/gbnfJson/terminals/GbnfString.js.map +1 -1
  485. package/dist/utils/gbnfJson/terminals/GbnfStringValue.js.map +1 -1
  486. package/dist/utils/gbnfJson/terminals/GbnfVerbatimText.js.map +1 -1
  487. package/dist/utils/gbnfJson/terminals/GbnfWhitespace.d.ts +7 -4
  488. package/dist/utils/gbnfJson/terminals/GbnfWhitespace.js +37 -9
  489. package/dist/utils/gbnfJson/terminals/GbnfWhitespace.js.map +1 -1
  490. package/dist/utils/gbnfJson/terminals/gbnfConsts.d.ts +5 -4
  491. package/dist/utils/gbnfJson/terminals/gbnfConsts.js +14 -3
  492. package/dist/utils/gbnfJson/terminals/gbnfConsts.js.map +1 -1
  493. package/dist/utils/gbnfJson/types.d.ts +3 -0
  494. package/dist/utils/gbnfJson/types.js.map +1 -1
  495. package/dist/utils/gbnfJson/utils/GbnfJsonScopeState.d.ts +10 -0
  496. package/dist/utils/gbnfJson/utils/GbnfJsonScopeState.js +15 -0
  497. package/dist/utils/gbnfJson/utils/GbnfJsonScopeState.js.map +1 -0
  498. package/dist/utils/gbnfJson/utils/getGbnfJsonTerminalForGbnfJsonSchema.d.ts +2 -1
  499. package/dist/utils/gbnfJson/utils/getGbnfJsonTerminalForGbnfJsonSchema.js +6 -5
  500. package/dist/utils/gbnfJson/utils/getGbnfJsonTerminalForGbnfJsonSchema.js.map +1 -1
  501. package/dist/utils/gbnfJson/utils/validateObjectAgainstGbnfSchema.js +2 -2
  502. package/dist/utils/gbnfJson/utils/validateObjectAgainstGbnfSchema.js.map +1 -1
  503. package/dist/utils/getBuildDefaults.d.ts +1 -2
  504. package/dist/utils/getBuildDefaults.js +2 -3
  505. package/dist/utils/getBuildDefaults.js.map +1 -1
  506. package/dist/utils/getConsoleLogPrefix.d.ts +1 -0
  507. package/dist/utils/getConsoleLogPrefix.js +10 -0
  508. package/dist/utils/getConsoleLogPrefix.js.map +1 -0
  509. package/dist/utils/getGrammarsFolder.d.ts +2 -1
  510. package/dist/utils/getGrammarsFolder.js +8 -7
  511. package/dist/utils/getGrammarsFolder.js.map +1 -1
  512. package/dist/utils/getModuleVersion.d.ts +1 -0
  513. package/dist/utils/getModuleVersion.js +13 -0
  514. package/dist/utils/getModuleVersion.js.map +1 -0
  515. package/dist/utils/getQueuedTokensBeforeStopTrigger.d.ts +6 -0
  516. package/dist/utils/getQueuedTokensBeforeStopTrigger.js +22 -0
  517. package/dist/utils/getQueuedTokensBeforeStopTrigger.js.map +1 -0
  518. package/dist/utils/getReadableContextSize.d.ts +1 -0
  519. package/dist/utils/getReadableContextSize.js +7 -0
  520. package/dist/utils/getReadableContextSize.js.map +1 -0
  521. package/dist/utils/getTypeScriptTypeStringForGbnfJsonSchema.js +15 -11
  522. package/dist/utils/getTypeScriptTypeStringForGbnfJsonSchema.js.map +1 -1
  523. package/dist/utils/gitReleaseBundles.js +73 -5
  524. package/dist/utils/gitReleaseBundles.js.map +1 -1
  525. package/dist/utils/hashString.d.ts +1 -0
  526. package/dist/utils/hashString.js +8 -0
  527. package/dist/utils/hashString.js.map +1 -0
  528. package/dist/utils/isLockfileActive.d.ts +4 -0
  529. package/dist/utils/isLockfileActive.js +12 -0
  530. package/dist/utils/isLockfileActive.js.map +1 -0
  531. package/dist/utils/isToken.d.ts +2 -0
  532. package/dist/utils/isToken.js +4 -0
  533. package/dist/utils/isToken.js.map +1 -0
  534. package/dist/utils/isUrl.d.ts +1 -0
  535. package/dist/utils/isUrl.js +15 -0
  536. package/dist/utils/isUrl.js.map +1 -0
  537. package/dist/utils/mergeUnionTypes.d.ts +10 -0
  538. package/dist/utils/mergeUnionTypes.js +2 -0
  539. package/dist/utils/mergeUnionTypes.js.map +1 -0
  540. package/dist/utils/parseModelFileName.d.ts +1 -0
  541. package/dist/utils/parseModelFileName.js +6 -1
  542. package/dist/utils/parseModelFileName.js.map +1 -1
  543. package/dist/utils/parseTextTemplate.d.ts +66 -0
  544. package/dist/utils/parseTextTemplate.js +116 -0
  545. package/dist/utils/parseTextTemplate.js.map +1 -0
  546. package/dist/utils/prettyPrintObject.d.ts +10 -0
  547. package/dist/utils/prettyPrintObject.js +84 -0
  548. package/dist/utils/prettyPrintObject.js.map +1 -0
  549. package/dist/utils/removeNullFields.d.ts +2 -1
  550. package/dist/utils/removeNullFields.js +8 -0
  551. package/dist/utils/removeNullFields.js.map +1 -1
  552. package/dist/utils/resolveGithubRelease.d.ts +2 -0
  553. package/dist/utils/resolveGithubRelease.js +36 -0
  554. package/dist/utils/resolveGithubRelease.js.map +1 -0
  555. package/dist/utils/runtime.d.ts +4 -0
  556. package/dist/utils/runtime.js +8 -0
  557. package/dist/utils/runtime.js.map +1 -0
  558. package/dist/utils/safeEventCallback.d.ts +6 -0
  559. package/dist/utils/safeEventCallback.js +29 -0
  560. package/dist/utils/safeEventCallback.js.map +1 -0
  561. package/dist/utils/spawnCommand.d.ts +11 -1
  562. package/dist/utils/spawnCommand.js +56 -6
  563. package/dist/utils/spawnCommand.js.map +1 -1
  564. package/dist/utils/tokenizeInput.d.ts +3 -0
  565. package/dist/utils/tokenizeInput.js +12 -0
  566. package/dist/utils/tokenizeInput.js.map +1 -0
  567. package/dist/utils/truncateTextAndRoundToWords.d.ts +2 -0
  568. package/dist/utils/truncateTextAndRoundToWords.js +30 -0
  569. package/dist/utils/truncateTextAndRoundToWords.js.map +1 -1
  570. package/dist/utils/utilTypes.d.ts +3 -0
  571. package/dist/utils/utilTypes.js +2 -0
  572. package/dist/utils/utilTypes.js.map +1 -0
  573. package/dist/utils/waitForLockfileRelease.d.ts +5 -0
  574. package/dist/utils/waitForLockfileRelease.js +20 -0
  575. package/dist/utils/waitForLockfileRelease.js.map +1 -0
  576. package/dist/utils/withLockfile.d.ts +7 -0
  577. package/dist/utils/withLockfile.js +44 -0
  578. package/dist/utils/withLockfile.js.map +1 -0
  579. package/dist/utils/withOra.d.ts +2 -0
  580. package/dist/utils/withOra.js +22 -6
  581. package/dist/utils/withOra.js.map +1 -1
  582. package/dist/utils/withProgressLog.d.ts +23 -0
  583. package/dist/utils/withProgressLog.js +211 -0
  584. package/dist/utils/withProgressLog.js.map +1 -0
  585. package/dist/utils/withStatusLogs.d.ts +2 -1
  586. package/dist/utils/withStatusLogs.js +12 -9
  587. package/dist/utils/withStatusLogs.js.map +1 -1
  588. package/dist/utils/wrapAbortSignal.d.ts +2 -0
  589. package/dist/utils/wrapAbortSignal.js +9 -0
  590. package/dist/utils/wrapAbortSignal.js.map +1 -0
  591. package/llama/.clang-format +1 -2
  592. package/llama/CMakeLists.txt +115 -4
  593. package/llama/addon.cpp +1300 -97
  594. package/llama/binariesGithubRelease.json +1 -1
  595. package/llama/gitRelease.bundle +0 -0
  596. package/llama/gpuInfo/cuda-gpu-info.cu +120 -0
  597. package/llama/gpuInfo/cuda-gpu-info.h +10 -0
  598. package/llama/gpuInfo/metal-gpu-info.h +8 -0
  599. package/llama/gpuInfo/metal-gpu-info.mm +30 -0
  600. package/llama/gpuInfo/vulkan-gpu-info.cpp +83 -0
  601. package/llama/gpuInfo/vulkan-gpu-info.h +9 -0
  602. package/llama/grammars/README.md +58 -5
  603. package/llama/grammars/json.gbnf +4 -4
  604. package/llama/grammars/json_arr.gbnf +4 -4
  605. package/llama/llama.cpp.info.json +4 -0
  606. package/llama/toolchains/win32.host-x64.target-arm64.cmake +41 -0
  607. package/package.json +78 -53
  608. package/templates/packed/electron-typescript-react.json +1 -0
  609. package/templates/packed/node-typescript.json +1 -0
  610. package/dist/AbortError.d.ts +0 -2
  611. package/dist/AbortError.js +0 -7
  612. package/dist/AbortError.js.map +0 -1
  613. package/dist/chatWrappers/LlamaChatWrapper.d.ts +0 -13
  614. package/dist/chatWrappers/LlamaChatWrapper.js.map +0 -1
  615. package/dist/chatWrappers/resolveChatWrapperBasedOnModel.d.ts +0 -13
  616. package/dist/chatWrappers/resolveChatWrapperBasedOnModel.js +0 -57
  617. package/dist/chatWrappers/resolveChatWrapperBasedOnModel.js.map +0 -1
  618. package/dist/llamaEvaluator/LlamaBins.d.ts +0 -18
  619. package/dist/llamaEvaluator/LlamaBins.js +0 -5
  620. package/dist/llamaEvaluator/LlamaBins.js.map +0 -1
  621. package/dist/llamaEvaluator/LlamaChat/LlamaChat.js +0 -704
  622. package/dist/llamaEvaluator/LlamaChat/LlamaChat.js.map +0 -1
  623. package/dist/llamaEvaluator/LlamaChat/utils/FunctionCallGrammar.d.ts +0 -21
  624. package/dist/llamaEvaluator/LlamaChat/utils/FunctionCallGrammar.js +0 -120
  625. package/dist/llamaEvaluator/LlamaChat/utils/FunctionCallGrammar.js.map +0 -1
  626. package/dist/llamaEvaluator/LlamaChat/utils/contextShiftStrategies/eraseFirstResponseAndKeepFirstSystemChatContextShiftStrategy.js.map +0 -1
  627. package/dist/llamaEvaluator/LlamaChatSession/LlamaChatSession.d.ts +0 -146
  628. package/dist/llamaEvaluator/LlamaChatSession/LlamaChatSession.js +0 -211
  629. package/dist/llamaEvaluator/LlamaChatSession/LlamaChatSession.js.map +0 -1
  630. package/dist/llamaEvaluator/LlamaChatSession/utils/defineChatSessionFunction.js.map +0 -1
  631. package/dist/llamaEvaluator/LlamaContext/LlamaContext.js.map +0 -1
  632. package/dist/llamaEvaluator/LlamaContext/types.d.ts +0 -82
  633. package/dist/llamaEvaluator/LlamaContext/types.js.map +0 -1
  634. package/dist/llamaEvaluator/LlamaContext/utils/batchItemsPrioritizingStrategies/firstInFirstOutStrategy.js.map +0 -1
  635. package/dist/llamaEvaluator/LlamaContext/utils/batchItemsPrioritizingStrategies/maximumParallelismStrategy.js.map +0 -1
  636. package/dist/llamaEvaluator/LlamaContext/utils/resolveBatchItemsPrioritizingStrategy.d.ts +0 -2
  637. package/dist/llamaEvaluator/LlamaContext/utils/resolveBatchItemsPrioritizingStrategy.js.map +0 -1
  638. package/dist/llamaEvaluator/LlamaEmbeddingContext.d.ts +0 -35
  639. package/dist/llamaEvaluator/LlamaEmbeddingContext.js +0 -73
  640. package/dist/llamaEvaluator/LlamaEmbeddingContext.js.map +0 -1
  641. package/dist/llamaEvaluator/LlamaGrammar.js.map +0 -1
  642. package/dist/llamaEvaluator/LlamaGrammarEvaluationState.js.map +0 -1
  643. package/dist/llamaEvaluator/LlamaJsonSchemaGrammar.js.map +0 -1
  644. package/dist/llamaEvaluator/LlamaModel.d.ts +0 -119
  645. package/dist/llamaEvaluator/LlamaModel.js +0 -322
  646. package/dist/llamaEvaluator/LlamaModel.js.map +0 -1
  647. package/dist/utils/binariesGithubRelease.js.map +0 -1
  648. package/dist/utils/clearLlamaBuild.d.ts +0 -1
  649. package/dist/utils/clearLlamaBuild.js +0 -12
  650. package/dist/utils/clearLlamaBuild.js.map +0 -1
  651. package/dist/utils/cloneLlamaCppRepo.d.ts +0 -2
  652. package/dist/utils/cloneLlamaCppRepo.js +0 -102
  653. package/dist/utils/cloneLlamaCppRepo.js.map +0 -1
  654. package/dist/utils/compileLLamaCpp.d.ts +0 -8
  655. package/dist/utils/compileLLamaCpp.js +0 -132
  656. package/dist/utils/compileLLamaCpp.js.map +0 -1
  657. package/dist/utils/getBin.js +0 -78
  658. package/dist/utils/getBin.js.map +0 -1
  659. package/dist/utils/getGbnfGrammarForGbnfJsonSchema.d.ts +0 -2
  660. package/dist/utils/getGbnfGrammarForGbnfJsonSchema.js +0 -9
  661. package/dist/utils/getGbnfGrammarForGbnfJsonSchema.js.map +0 -1
  662. package/dist/utils/getReleaseInfo.d.ts +0 -7
  663. package/dist/utils/getReleaseInfo.js +0 -30
  664. package/dist/utils/getReleaseInfo.js.map +0 -1
  665. package/dist/utils/parseModelTypeDescription.d.ts +0 -6
  666. package/dist/utils/parseModelTypeDescription.js +0 -9
  667. package/dist/utils/parseModelTypeDescription.js.map +0 -1
  668. package/dist/utils/resolveChatWrapper.d.ts +0 -4
  669. package/dist/utils/resolveChatWrapper.js +0 -16
  670. package/dist/utils/resolveChatWrapper.js.map +0 -1
  671. package/dist/utils/usedBinFlag.d.ts +0 -6
  672. package/dist/utils/usedBinFlag.js +0 -15
  673. package/dist/utils/usedBinFlag.js.map +0 -1
  674. package/llama/usedBin.json +0 -3
  675. package/llamaBins/linux-arm64/llama-addon.node +0 -0
  676. package/llamaBins/linux-armv7l/llama-addon.node +0 -0
  677. package/llamaBins/linux-x64/llama-addon.node +0 -0
  678. package/llamaBins/mac-arm64/llama-addon.node +0 -0
  679. package/llamaBins/mac-x64/llama-addon.node +0 -0
  680. package/llamaBins/win-x64/llama-addon.exp +0 -0
  681. package/llamaBins/win-x64/llama-addon.lib +0 -0
  682. package/llamaBins/win-x64/llama-addon.node +0 -0
  683. /package/dist/{utils → bindings/utils}/binariesGithubRelease.d.ts +0 -0
  684. /package/dist/{llamaEvaluator → evaluator}/LlamaChat/utils/contextShiftStrategies/eraseFirstResponseAndKeepFirstSystemChatContextShiftStrategy.d.ts +0 -0
  685. /package/dist/{llamaEvaluator → evaluator}/LlamaContext/types.js +0 -0
  686. /package/dist/{llamaEvaluator/LlamaContext/utils/batchItemsPrioritizingStrategies → evaluator/LlamaContext/utils/batchItemsPrioritizationStrategies}/firstInFirstOutStrategy.d.ts +0 -0
  687. /package/dist/{llamaEvaluator/LlamaContext/utils/batchItemsPrioritizingStrategies → evaluator/LlamaContext/utils/batchItemsPrioritizationStrategies}/firstInFirstOutStrategy.js +0 -0
  688. /package/dist/{llamaEvaluator/LlamaContext/utils/batchItemsPrioritizingStrategies → evaluator/LlamaContext/utils/batchItemsPrioritizationStrategies}/maximumParallelismStrategy.d.ts +0 -0
  689. /package/dist/{llamaEvaluator/LlamaContext/utils/batchItemsPrioritizingStrategies → evaluator/LlamaContext/utils/batchItemsPrioritizationStrategies}/maximumParallelismStrategy.js +0 -0
  690. /package/dist/{llamaEvaluator → evaluator}/LlamaGrammarEvaluationState.d.ts +0 -0
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <img alt="node-llama-cpp Logo" src="https://media.githubusercontent.com/media/withcatai/node-llama-cpp/master/assets/logo.roundEdges.png" width="360px" />
2
+ <img alt="node-llama-cpp Logo" src="https://raw.githubusercontent.com/withcatai/node-llama-cpp/master/assets/logo.roundEdges.png" width="360px" />
3
3
  <h1>node-llama-cpp</h1>
4
4
  <p>Run AI models locally on your machine</p>
5
5
  <sub>Pre-built bindings are provided with a fallback to building from source with cmake</sub>
@@ -15,12 +15,12 @@
15
15
 
16
16
  </div>
17
17
 
18
- ✨ New! [Try the beta of version `3.0.0`](https://github.com/withcatai/node-llama-cpp/pull/105) ✨
18
+ ✨ New! [Try the beta of version `3.0.0`](https://github.com/withcatai/node-llama-cpp/pull/105) ✨ (included: function calling, automatic chat wrapper detection, embedding support, and more)
19
19
 
20
20
  ## Features
21
21
  * Run a text generation model locally on your machine
22
- * Metal and CUDA support
23
- * Pre-built binaries are provided, with a fallback to building from source without `node-gyp` or Python
22
+ * Metal, CUDA and Vulkan support
23
+ * Pre-built binaries are provided, with a fallback to building from source _**without**_ `node-gyp` or Python
24
24
  * Chat with a model using a chat wrapper
25
25
  * Use the CLI to chat with a model without writing any code
26
26
  * Up-to-date with the latest version of `llama.cpp`. Download and compile the latest release with a single CLI command.
@@ -47,15 +47,18 @@ To disable this behavior set the environment variable `NODE_LLAMA_CPP_SKIP_DOWNL
47
47
  ```typescript
48
48
  import {fileURLToPath} from "url";
49
49
  import path from "path";
50
- import {LlamaModel, LlamaContext, LlamaChatSession} from "node-llama-cpp";
50
+ import {getLlama, LlamaChatSession} from "node-llama-cpp";
51
51
 
52
52
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
53
53
 
54
- const model = new LlamaModel({
55
- modelPath: path.join(__dirname, "models", "codellama-13b.Q3_K_M.gguf")
54
+ const llama = await getLlama();
55
+ const model = await llama.loadModel({
56
+ modelPath: path.join(__dirname, "models", "dolphin-2.1-mistral-7b.Q4_K_M.gguf")
57
+ });
58
+ const context = await model.createContext();
59
+ const session = new LlamaChatSession({
60
+ contextSequence: context.getSequence()
56
61
  });
57
- const context = new LlamaContext({model});
58
- const session = new LlamaChatSession({context});
59
62
 
60
63
 
61
64
  const q1 = "Hi there, how are you?";
@@ -65,7 +68,7 @@ const a1 = await session.prompt(q1);
65
68
  console.log("AI: " + a1);
66
69
 
67
70
 
68
- const q2 = "Summerize what you said";
71
+ const q2 = "Summarize what you said";
69
72
  console.log("User: " + q2);
70
73
 
71
74
  const a2 = await session.prompt(q2);
@@ -84,7 +87,7 @@ To contribute to `node-llama-cpp` read the [contribution guide](https://withcata
84
87
  <br />
85
88
 
86
89
  <div align="center" width="360">
87
- <img alt="Star please" src="https://media.githubusercontent.com/media/withcatai/node-llama-cpp/master/assets/star.please.roundEdges.png" width="360" margin="auto" />
90
+ <img alt="Star please" src="https://raw.githubusercontent.com/withcatai/node-llama-cpp/master/assets/star.please.roundEdges.png" width="360" margin="auto" />
88
91
  <br/>
89
92
  <p align="right">
90
93
  <i>If you like this repo, star it ✨</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"20.04"},"arch":"arm64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"20.04"},"arch":"armv7l","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"20.04"},"arch":"x64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
Binary file
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"20.04"},"arch":"x64","gpu":"cuda","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"linux","platformInfo":{"name":"Ubuntu","version":"20.04"},"arch":"x64","gpu":"vulkan","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"mac","platformInfo":{"name":"macOS","version":"22.6.0"},"arch":"arm64","gpu":"metal","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"mac","platformInfo":{"name":"macOS","version":"22.6.0"},"arch":"x64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
Binary file
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"win","platformInfo":{"name":"Windows","version":"10.0.20348"},"arch":"arm64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"win","platformInfo":{"name":"Windows","version":"10.0.17763"},"arch":"x64","gpu":false,"llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"win","platformInfo":{"name":"Windows","version":"10.0.17763"},"arch":"x64","gpu":"cuda","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
@@ -0,0 +1 @@
1
+ {"buildOptions":{"customCmakeOptions":{},"progressLogs":true,"platform":"win","platformInfo":{"name":"Windows","version":"10.0.17763"},"arch":"x64","gpu":"vulkan","llamaCpp":{"repo":"ggerganov/llama.cpp","release":"b3166"}}}
@@ -1,49 +1,18 @@
1
- import { ChatHistoryItem, ChatModelFunctions, ChatModelResponse } from "./types.js";
1
+ import { ChatHistoryItem, ChatModelFunctionCall, ChatModelFunctions, ChatModelResponse, ChatWrapperGenerateContextStateOptions, ChatWrapperGeneratedContextState, ChatWrapperSettings } from "./types.js";
2
2
  import { LlamaText } from "./utils/LlamaText.js";
3
- export type ChatWrapperSettings = {
4
- readonly functions: {
5
- readonly call: {
6
- readonly optionalPrefixSpace: boolean;
7
- readonly prefix: string;
8
- readonly paramsPrefix: string;
9
- readonly suffix: string;
10
- };
11
- readonly result: {
12
- readonly prefix: string;
13
- readonly suffix: string;
14
- };
15
- };
16
- };
17
3
  export declare abstract class ChatWrapper {
4
+ static defaultSettings: ChatWrapperSettings;
18
5
  abstract readonly wrapperName: string;
19
6
  readonly settings: ChatWrapperSettings;
20
- generateContextText(history: readonly ChatHistoryItem[], { availableFunctions, documentFunctionParams }?: {
21
- availableFunctions?: ChatModelFunctions;
22
- documentFunctionParams?: boolean;
23
- }): {
24
- contextText: LlamaText;
25
- stopGenerationTriggers: LlamaText[];
26
- ignoreStartText?: LlamaText[];
27
- functionCall?: {
28
- initiallyEngaged: boolean;
29
- disengageInitiallyEngaged: LlamaText[];
30
- };
31
- };
32
- generateFunctionCallAndResult(name: string, params: any, result: any): string;
33
- generateFunctionCall(name: string, params: any): string;
34
- generateFunctionCallResult(functionName: string, functionParams: any, result: any): string;
35
- generateModelResponseText(modelResponse: ChatModelResponse["response"]): string;
7
+ generateContextState({ chatHistory, availableFunctions, documentFunctionParams }: ChatWrapperGenerateContextStateOptions): ChatWrapperGeneratedContextState;
8
+ generateFunctionCallsAndResults(functionCalls: ChatModelFunctionCall[], useRawCall?: boolean): import("./utils/LlamaText.js")._LlamaText;
9
+ generateFunctionCall(name: string, params: any): LlamaText;
10
+ generateFunctionCallResult(functionName: string, functionParams: any, result: any): LlamaText;
11
+ generateModelResponseText(modelResponse: ChatModelResponse["response"], useRawCall?: boolean): LlamaText;
36
12
  generateAvailableFunctionsSystemText(availableFunctions: ChatModelFunctions, { documentParams }: {
37
13
  documentParams?: boolean;
38
- }): string;
14
+ }): LlamaText;
39
15
  addAvailableFunctionsSystemMessageToHistory(history: readonly ChatHistoryItem[], availableFunctions?: ChatModelFunctions, { documentParams }?: {
40
16
  documentParams?: boolean;
41
17
  }): readonly ChatHistoryItem[];
42
- /**
43
- * Functions that should be made available as part of the function calling grammar and are handled by the chat wrapper
44
- * for grammar purposes only
45
- */
46
- getInternalBuiltinFunctions({ initialFunctionCallEngaged }: {
47
- initialFunctionCallEngaged: boolean;
48
- }): ChatModelFunctions;
49
18
  }
@@ -1,99 +1,147 @@
1
- import { LlamaText } from "./utils/LlamaText.js";
2
- import { getTypeScriptTypeStringForGbnfJsonSchema } from "./utils/getTypeScriptTypeStringForGbnfJsonSchema.js";
1
+ import { LlamaText, SpecialTokensText } from "./utils/LlamaText.js";
2
+ import { ChatModelFunctionsDocumentationGenerator } from "./chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.js";
3
3
  export class ChatWrapper {
4
- settings = {
4
+ static defaultSettings = {
5
+ supportsSystemMessages: true,
5
6
  functions: {
6
7
  call: {
7
8
  optionalPrefixSpace: true,
8
- prefix: "[[call: ",
9
- paramsPrefix: "(",
10
- suffix: ")]]"
9
+ prefix: "||call: ",
10
+ paramsPrefix: LlamaText(new SpecialTokensText("(")),
11
+ suffix: LlamaText(new SpecialTokensText(")"))
11
12
  },
12
13
  result: {
13
- prefix: " [[result: ",
14
- suffix: "]]"
14
+ prefix: LlamaText(new SpecialTokensText("\n"), "||result: "),
15
+ suffix: LlamaText(new SpecialTokensText("\n"))
15
16
  }
16
17
  }
17
18
  };
18
- generateContextText(history, { availableFunctions, documentFunctionParams } = {}) {
19
- const historyWithFunctions = this.addAvailableFunctionsSystemMessageToHistory(history, availableFunctions, {
19
+ settings = ChatWrapper.defaultSettings;
20
+ generateContextState({ chatHistory, availableFunctions, documentFunctionParams }) {
21
+ const historyWithFunctions = this.addAvailableFunctionsSystemMessageToHistory(chatHistory, availableFunctions, {
20
22
  documentParams: documentFunctionParams
21
23
  });
22
24
  const texts = historyWithFunctions
23
25
  .map((item) => {
24
26
  if (item.type === "system")
25
- return LlamaText `system: ${item.text}`;
27
+ return LlamaText(["system: ", LlamaText.fromJSON(item.text)]);
26
28
  else if (item.type === "user")
27
- return LlamaText `user: ${item.text}`;
29
+ return LlamaText(["user: ", item.text]);
28
30
  else if (item.type === "model")
29
- return LlamaText `model: ${this.generateModelResponseText(item.response)}`;
31
+ return LlamaText(["model: ", this.generateModelResponseText(item.response)]);
30
32
  return item;
31
33
  });
32
34
  return {
33
- contextText: LlamaText(texts).joinValues("\n"),
35
+ contextText: LlamaText.joinValues("\n", texts),
34
36
  stopGenerationTriggers: []
35
37
  };
36
38
  }
37
- generateFunctionCallAndResult(name, params, result) {
38
- return this.generateFunctionCall(name, params) + this.generateFunctionCallResult(name, params, result);
39
+ generateFunctionCallsAndResults(functionCalls, useRawCall = true) {
40
+ const calls = [];
41
+ const results = [];
42
+ const res = [];
43
+ if (functionCalls.length === 0)
44
+ return LlamaText([]);
45
+ for (const functionCall of functionCalls) {
46
+ if (useRawCall && functionCall.rawCall != null)
47
+ calls.push(LlamaText.fromJSON(functionCall.rawCall));
48
+ else
49
+ calls.push(this.generateFunctionCall(functionCall.name, functionCall.params));
50
+ results.push(this.generateFunctionCallResult(functionCall.name, functionCall.params, functionCall.result));
51
+ }
52
+ if (this.settings.functions.parallelism == null) {
53
+ for (let i = 0; i < calls.length; i++) {
54
+ res.push(calls[i]);
55
+ res.push(results[i]);
56
+ }
57
+ return LlamaText(res);
58
+ }
59
+ res.push(LlamaText(this.settings.functions.parallelism.call.sectionPrefix ?? ""));
60
+ for (let i = 0; i < calls.length; i++) {
61
+ if (i > 0)
62
+ res.push(LlamaText(this.settings.functions.parallelism.call.betweenCalls ?? ""));
63
+ res.push(calls[i]);
64
+ }
65
+ res.push(LlamaText(this.settings.functions.parallelism.call.sectionSuffix ?? ""));
66
+ res.push(LlamaText(this.settings.functions.parallelism.result?.sectionPrefix ?? ""));
67
+ for (let i = 0; i < results.length; i++) {
68
+ if (i > 0)
69
+ res.push(LlamaText(this.settings.functions.parallelism.result?.betweenResults ?? ""));
70
+ res.push(results[i]);
71
+ }
72
+ res.push(LlamaText(this.settings.functions.parallelism.result?.sectionSuffix ?? ""));
73
+ return LlamaText(res);
39
74
  }
40
75
  generateFunctionCall(name, params) {
41
- return this.settings.functions.call.prefix +
42
- name +
43
- this.settings.functions.call.paramsPrefix +
76
+ return LlamaText([
77
+ this.settings.functions.call.prefix,
78
+ name,
79
+ this.settings.functions.call.paramsPrefix,
44
80
  (params === undefined
45
81
  ? ""
46
- : JSON.stringify(params)) +
47
- this.settings.functions.call.suffix;
82
+ : JSON.stringify(params)),
83
+ this.settings.functions.call.suffix
84
+ ]);
48
85
  }
49
86
  generateFunctionCallResult(functionName, functionParams, result) {
50
- const resolveParameters = (text) => text.replaceAll("{{functionName}}", functionName)
51
- .replaceAll("{{functionParams}}", functionParams === undefined ? "" : JSON.stringify(functionParams));
52
- return resolveParameters(this.settings.functions.result.prefix) +
87
+ function resolveParameters(text) {
88
+ return LlamaText(text)
89
+ .mapValues((value) => {
90
+ if (typeof value !== "string")
91
+ return value;
92
+ return value
93
+ .replaceAll("{{functionName}}", functionName)
94
+ .replaceAll("{{functionParams}}", functionParams === undefined ? "" : JSON.stringify(functionParams));
95
+ });
96
+ }
97
+ return LlamaText([
98
+ resolveParameters(this.settings.functions.result.prefix),
53
99
  (result === undefined
54
100
  ? "void"
55
- : JSON.stringify(result)) +
56
- resolveParameters(this.settings.functions.result.suffix);
101
+ : JSON.stringify(result)),
102
+ resolveParameters(this.settings.functions.result.suffix)
103
+ ]);
57
104
  }
58
- generateModelResponseText(modelResponse) {
59
- return modelResponse
60
- .map((item) => {
61
- if (typeof item === "string")
62
- return item;
63
- return item.raw ?? this.generateFunctionCallAndResult(item.name, item.params, item.result);
64
- })
65
- .join("\n");
105
+ generateModelResponseText(modelResponse, useRawCall = true) {
106
+ const res = [];
107
+ const pendingFunctionCalls = [];
108
+ const addFunctionCalls = () => {
109
+ if (pendingFunctionCalls.length === 0)
110
+ return;
111
+ res.push(this.generateFunctionCallsAndResults(pendingFunctionCalls, useRawCall));
112
+ pendingFunctionCalls.length = 0;
113
+ };
114
+ for (const response of modelResponse) {
115
+ if (typeof response === "string") {
116
+ addFunctionCalls();
117
+ res.push(LlamaText(response));
118
+ continue;
119
+ }
120
+ pendingFunctionCalls.push(response);
121
+ }
122
+ addFunctionCalls();
123
+ return LlamaText(res);
66
124
  }
67
125
  generateAvailableFunctionsSystemText(availableFunctions, { documentParams = true }) {
68
- const availableFunctionNames = Object.keys(availableFunctions ?? {});
69
- if (availableFunctionNames.length === 0)
70
- return "";
71
- return "The assistant calls the provided functions as needed to retrieve information instead of relying on things it already knows.\n" +
72
- "Provided functions:\n```\n" +
73
- availableFunctionNames
74
- .map((functionName) => {
75
- const functionDefinition = availableFunctions[functionName];
76
- let res = "";
77
- if (functionDefinition?.description != null && functionDefinition.description.trim() !== "")
78
- res += "// " + functionDefinition.description.split("\n").join("\n// ") + "\n";
79
- res += "function " + functionName + "(";
80
- if (documentParams && functionDefinition?.params != null)
81
- res += "params: " + getTypeScriptTypeStringForGbnfJsonSchema(functionDefinition.params);
82
- else if (!documentParams && functionDefinition?.params != null)
83
- res += "params";
84
- res += ");";
85
- return res;
86
- })
87
- .join("\n\n") +
88
- "\n```\n\n" +
89
- "Calling any of the provided functions can be done like this:\n" +
90
- this.settings.functions.call.prefix.trimStart() +
91
- "functionName" +
92
- this.settings.functions.call.paramsPrefix +
93
- '{ someKey: "someValue" }' +
94
- this.settings.functions.call.suffix + "\n\n" +
95
- "After calling a function the result will appear afterwards and be visible only to the assistant, so the assistant has to tell the user about it outside of the function call context.\n" +
96
- "The assistant calls the functions in advance before telling the user about the result";
126
+ const functionsDocumentationGenerator = new ChatModelFunctionsDocumentationGenerator(availableFunctions);
127
+ if (!functionsDocumentationGenerator.hasAnyFunctions)
128
+ return LlamaText([]);
129
+ return LlamaText.joinValues("\n", [
130
+ "The assistant calls the provided functions as needed to retrieve information instead of relying on existing knowledge.",
131
+ "To fulfill a request, the assistant calls relevant functions in advance when needed before responding to the request, and does not tell the user prior to calling a function.",
132
+ "Provided functions:",
133
+ "```typescript",
134
+ functionsDocumentationGenerator.getTypeScriptFunctionSignatures({ documentParams }),
135
+ "```",
136
+ "",
137
+ "Calling any of the provided functions can be done like this:",
138
+ this.generateFunctionCall("getSomeInfo", { someKey: "someValue" }),
139
+ "",
140
+ "Note that the || prefix is mandatory",
141
+ "The assistant does not inform the user about using functions and does not explain anything before calling a function.",
142
+ "After calling a function, the raw result appears afterwards and is not part of the conversation",
143
+ "To make information be part of the conversation, the assistant paraphrases and repeats the information without the function syntax."
144
+ ]);
97
145
  }
98
146
  addAvailableFunctionsSystemMessageToHistory(history, availableFunctions, { documentParams = true } = {}) {
99
147
  const availableFunctionNames = Object.keys(availableFunctions ?? {});
@@ -103,18 +151,13 @@ export class ChatWrapper {
103
151
  const firstNonSystemMessageIndex = res.findIndex((item) => item.type !== "system");
104
152
  res.splice(Math.max(0, firstNonSystemMessageIndex), 0, {
105
153
  type: "system",
106
- text: this.generateAvailableFunctionsSystemText(availableFunctions, { documentParams })
154
+ text: this.generateAvailableFunctionsSystemText(availableFunctions, { documentParams }).toJSON()
107
155
  });
108
156
  return res;
109
157
  }
110
- /**
111
- * Functions that should be made available as part of the function calling grammar and are handled by the chat wrapper
112
- * for grammar purposes only
113
- */
114
- getInternalBuiltinFunctions({ initialFunctionCallEngaged }) {
115
- if (initialFunctionCallEngaged)
116
- return {};
117
- return {};
158
+ /** @internal */
159
+ static _getOptionConfigurationsToTestIfCanSupersedeJinjaTemplate() {
160
+ return [{}];
118
161
  }
119
162
  }
120
163
  //# sourceMappingURL=ChatWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatWrapper.js","sourceRoot":"","sources":["../src/ChatWrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,wCAAwC,EAAC,MAAM,qDAAqD,CAAC;AAiB7G,MAAM,OAAgB,WAAW;IAGb,QAAQ,GAAwB;QAC5C,SAAS,EAAE;YACP,IAAI,EAAE;gBACF,mBAAmB,EAAE,IAAI;gBACzB,MAAM,EAAE,UAAU;gBAClB,YAAY,EAAE,GAAG;gBACjB,MAAM,EAAE,KAAK;aAChB;YACD,MAAM,EAAE;gBACJ,MAAM,EAAE,aAAa;gBACrB,MAAM,EAAE,IAAI;aACf;SACJ;KACJ,CAAC;IAEK,mBAAmB,CAAC,OAAmC,EAAE,EAAC,kBAA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CAAC;IAEM,2CAA2C,CAAC,OAAmC,EAAE,kBAAuC,EAAE,EAC7H,cAAc,GAAG,IAAI,KAGrB,EAAE;QACF,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;QAErE,IAAI,kBAAkB,IAAI,IAAI,IAAI,sBAAsB,CAAC,MAAM,KAAK,CAAC;YACjE,OAAO,OAAO,CAAC;QAEnB,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAE5B,MAAM,0BAA0B,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;QACnF,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC,EAAE,CAAC,EAAE;YACnD,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI,CAAC,oCAAoC,CAAC,kBAAkB,EAAE,EAAC,cAAc,EAAC,CAAC,CAAC,MAAM,EAAE;SACjG,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACf,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,yDAAyD;QACnE,OAAO,CAAC,EAAE,CAA6F,CAAC;IAC5G,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /** @internal */
2
+ import { _LlamaText } from "./utils/LlamaText.js";
3
+ /** @internal */
4
+ export * from "./index.js";
5
+ /** @internal */
6
+ export { _LlamaText as LlamaText };
7
+ //# sourceMappingURL=apiDocsIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiDocsIndex.js","sourceRoot":"","sources":["../src/apiDocsIndex.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EACH,UAAU,EACb,MAAM,sBAAsB,CAAC;AAE9B,gBAAgB;AAChB,cAAc,YAAY,CAAC;AAE3B,gBAAgB;AAChB,OAAO,EACH,UAAU,IAAI,SAAS,EAC1B,CAAC"}