Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
34b2753
feat: move `download`, `build` and `clear` commands to be subcommands…
giladgd Jun 22, 2024
d7e6c0c
docs: move CLI docs to their own category
giladgd Jun 22, 2024
679e5b5
fix: bugs
giladgd Jun 22, 2024
89fd54e
fix: change `autoDisposeSequence` default to `false`
giladgd Jun 22, 2024
a0aaebd
fix: switch the branch used in scripts to `master`
giladgd Jun 22, 2024
b1bcab3
docs: home page
giladgd Jun 22, 2024
ddb6d7d
docs: add GitHub Discussions link and enable detailed search by default
giladgd Jun 22, 2024
9ea811c
docs: improve design
giladgd Jun 22, 2024
a054806
fix: don't preload prompt in the `chat` command when using `--printTi…
giladgd Jun 22, 2024
16d6ca3
chore: merge fixes
giladgd Jun 24, 2024
6c6b59e
docs: improve design
giladgd Jul 5, 2024
249bb2f
chore: merge
giladgd Jul 5, 2024
ce5f3c8
fix: Llama 3 Instruct function calling
giladgd Jul 6, 2024
1749ab9
fix: typo
giladgd Jul 6, 2024
0b7bfc1
build: only create a GitHub discussion on major or minor releases
giladgd Jul 10, 2024
64b4eff
docs: create og template
giladgd Jul 11, 2024
f6b3c9c
feat(docs): hero release badge, git changelog, blog, og image, bug fixes
giladgd Jul 15, 2024
6373c77
build(CI): resolve next version before release, update documentation …
giladgd Jul 15, 2024
9f920a0
style: lint fixes
giladgd Jul 15, 2024
88d951a
chore: skip redundant CI step
giladgd Jul 27, 2024
2ee925c
chore: update modules
giladgd Aug 3, 2024
86a7417
chore: update issue template to ask for model link
giladgd Aug 3, 2024
dbde3fe
fix: theme transition adaptation to motion reduction preference
giladgd Aug 3, 2024
7023575
build: missing CI scripts
giladgd Aug 3, 2024
3f48140
style: more strict type checking
giladgd Aug 3, 2024
0f7c10c
style: more strict type checking
giladgd Aug 3, 2024
6b45d61
docs: git changelog configuration
giladgd Aug 3, 2024
49ebacd
fix: Llama 3.1 chat wrapper standard chat history
giladgd Aug 3, 2024
b8b8e85
style: more strict type checking
giladgd Aug 3, 2024
29ad8c8
style: lint
giladgd Aug 3, 2024
d74e53c
feat: docs home show animation
giladgd Aug 6, 2024
5bf4726
feat: abort generation in CLI commands
giladgd Aug 7, 2024
b0ad08a
feat: `inspect estimate` command
giladgd Aug 7, 2024
cd6edb1
feat: `HF_TOKEN` support for reading GGUF file metadata
giladgd Aug 7, 2024
ff9675d
feat: Mistral chat wrapper
giladgd Aug 10, 2024
d1b36db
feat: improve Llama 3.1 chat template detection
giladgd Aug 10, 2024
2ae0607
feat(docs): smooth theme switching
giladgd Aug 10, 2024
f3c20e5
feat(`TemplateChatWrapper`): custom history template for each message…
giladgd Aug 11, 2024
5b07cb6
feat: failed context creation automatic remedy
giladgd Aug 18, 2024
0650946
fix(`inspect measure` command): bugs
giladgd Aug 18, 2024
daa872e
docs: Docker
giladgd Aug 29, 2024
a9e5fb0
docs: Embedding
giladgd Aug 29, 2024
cdcbaef
docs: Batching
giladgd Sep 1, 2024
8c5354a
docs: Objects Lifecycle
giladgd Sep 1, 2024
384a421
fix: text completion
giladgd Sep 1, 2024
0c36e52
fix: text completion
giladgd Sep 1, 2024
2f9910b
feat: make `LlamaEmbedding` an object
giladgd Sep 1, 2024
80d2524
fix: more indicative errors
giladgd Sep 2, 2024
d93df27
fix: types
giladgd Sep 2, 2024
1c13437
docs: Token Bias
giladgd Sep 2, 2024
6de923a
docs: improve Objects Lifecycle
giladgd Sep 2, 2024
b584e53
docs: External Chat State
giladgd Sep 2, 2024
516a9aa
feat: simplify `TokenBias`
giladgd Sep 2, 2024
82a3450
chore: remove unused field from `TokenMeter`
giladgd Sep 2, 2024
9b36768
feat: better `threads` default value
giladgd Sep 2, 2024
bc479fa
feat: improve types and type documentations
giladgd Sep 2, 2024
c91322b
feat: iterate all tokenizer tokens
giladgd Sep 2, 2024
46f4c88
feat: more helpful `inspect gpu` command
giladgd Sep 2, 2024
612dda2
feat: `--gpuLayers max` and `--contextSize max` flag support for `ins…
giladgd Sep 2, 2024
f342d7f
docs: new documentation
giladgd Sep 3, 2024
7a5e036
test: improve tests
giladgd Sep 3, 2024
d680e3b
fix: link
giladgd Sep 3, 2024
e1838dd
fix: update `.gitignore`
giladgd Sep 3, 2024
1a2b5e2
fix: docs theme
giladgd Sep 3, 2024
c754185
fix: build
giladgd Sep 3, 2024
bc4e123
fix: disable blank issues
giladgd Sep 3, 2024
9600058
feat(docs): comments section
giladgd Sep 6, 2024
2613df5
feat(docs): new URL, new logo, improved comments section, blog cover …
giladgd Sep 9, 2024
cc24b19
feat: combine model downloaders
giladgd Sep 9, 2024
26be11d
feat(docs): Downloading Models
giladgd Sep 9, 2024
6a13aa7
feat: adapt to `llama.cpp` sampling refactor, move `seed` option to t…
giladgd Sep 12, 2024
dfdfda6
feat: Functionary v3
giladgd Sep 13, 2024
4d80fdc
test: fix tests
giladgd Sep 13, 2024
db724b1
docs: download cover images
giladgd Sep 15, 2024
1c2dfa3
docs: improve style
giladgd Sep 15, 2024
e723245
docs: small improvements
giladgd Sep 15, 2024
b490d19
docs: bug fixes
giladgd Sep 15, 2024
6864e7a
fix: adapt to `llama.cpp` breaking changes
giladgd Sep 15, 2024
374ffde
docs: improve function documentation
giladgd Sep 15, 2024
b20b0e6
feat: extract all prebuilt binaries to external modules
giladgd Sep 15, 2024
048ff49
feat(electron example template): update badge, scroll anchoring, tabl…
giladgd Sep 15, 2024
480e4e2
chore: update modules
giladgd Sep 15, 2024
8f695ca
feat: simplify compatibility detection
giladgd Sep 15, 2024
e4d89e4
chore: update models list
giladgd Sep 15, 2024
ae3af1f
fix: CI config
giladgd Sep 15, 2024
cf825e7
fix: CI config
giladgd Sep 15, 2024
e08e56e
fix: CI config
giladgd Sep 15, 2024
c457ac8
docs: fix dead link
giladgd Sep 15, 2024
8d98a7e
fix: CI config
giladgd Sep 16, 2024
8808960
fix: adapt to `llama.cpp` breaking changes
giladgd Sep 16, 2024
5756619
fix: docs
giladgd Sep 16, 2024
285c9b5
fix: `FunctionaryChatWrapper`
giladgd Sep 16, 2024
7ee9a08
fix: missing include
giladgd Sep 16, 2024
2539b33
test: fix tests
giladgd Sep 16, 2024
9341c1c
fix: CI config
giladgd Sep 16, 2024
f42e2d5
test: fix tests
giladgd Sep 16, 2024
963b650
fix: more stable Jinja template matching
giladgd Sep 16, 2024
b16e9d6
chore: update modules
giladgd Sep 16, 2024
c49321d
chore: update types
giladgd Sep 16, 2024
a024506
fix: CI config
giladgd Sep 17, 2024
afbd970
fix: CI config
giladgd Sep 17, 2024
e320fe5
fix: bugs
giladgd Sep 17, 2024
a99702e
fix: improve performance of parallel evaluation from multiple context…
giladgd Sep 18, 2024
a525b30
fix: bug
giladgd Sep 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .config/typedoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ h6:not(.tsd-anchor-link, .tsd-returns-title) > a:hover:before {
margin-top: 16px;
}

img[src$="assets/logo.roundEdges.png"],
img[src$="assets/logo.png"] {
img[src$="assets/logo.v3.roundEdges.png"],
img[src$="assets/logo.v3.png"] {
box-shadow: 0px 4px 12px 0px rgb(0 0 0 / 16%), 0px 8px 64px 0px rgb(0 0 0 / 24%);
border-radius: 14px;
}
Expand Down
9 changes: 6 additions & 3 deletions .config/typedoc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["../src/index.ts"],
"entryPoints": ["../src/apiDocsIndex.ts"],
"out": "../docs/api",
"tsconfig": "../tsconfig.json",
"customCss": "./typedoc.css",
Expand All @@ -11,7 +11,7 @@
"githubPages": true,
"hideGenerator": true,
"jsDocCompatibility": true,
"htmlLang": "en",
"lang": "en",
"plugin": ["typedoc-plugin-markdown", "typedoc-vitepress-theme", "typedoc-plugin-mdn-links"],
"hideBreadcrumbs": true,
"hidePageHeader": true,
Expand All @@ -23,7 +23,10 @@
"propertiesFormat": "list",
"enumMembersFormat": "table",
"typeDeclarationFormat": "list",
"classPropertiesFormat": "list",
"interfacePropertiesFormat": "list",
"sort": ["source-order"],
"docsRoot": "../docs",
"intentionallyNotExported": ["MergeOptionalUnionTypes", "GbnfJsonSchemaToTSType", "_LlamaText"]
"intentionallyNotExported": ["MergeOptionalUnionTypes", "GbnfJsonSchemaToTSType", "_LlamaText"],
"useHTMLEncodedBrackets": true
}
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ body:
Your bug can be investigated much faster if your code can be run without any dependencies other than `node-llama-cpp`.
Issues without reproduction steps or code examples may be closed as not actionable.
Please try to provide a Minimal, Complete, and Verifiable example ([link](http://stackoverflow.com/help/mcve)).
Please include a link to the model file you used if possible.
Also, please enable enable debug logs by using `getLlama({debug: true})` to get more information.
placeholder: >-
Please try to provide a Minimal, Complete, and Verifiable example.
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
blank_issues_enabled: false
contact_links:
- name: 🤔 Questions, General Support, and Help
url: https://github.com/withcatai/node-llama-cpp/discussions
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
- [ ] This pull request links relevant issues as `Fixes #0000`
- [ ] There are new or updated unit tests validating the change
- [ ] Documentation has been updated to reflect this change
- [ ] The new commits and pull request title follow conventions explained in [pull request guidelines](https://withcatai.github.io/node-llama-cpp/guide/contributing) (PRs that do not follow this convention will not be merged)
- [ ] The new commits and pull request title follow conventions explained in [pull request guidelines](https://node-llama-cpp.withcat.ai/guide/contributing) (PRs that do not follow this convention will not be merged)
185 changes: 156 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,23 @@ jobs:
- name: Download latest llama.cpp release
env:
CI: true
run: node ./dist/cli/cli.js download --release b3543 --skipBuild --noBundle --noUsageExample --updateBinariesReleaseMetadataAndSaveGitBundle
run: node ./dist/cli/cli.js source download --release latest --skipBuild --noBundle --noUsageExample --updateBinariesReleaseMetadataAndSaveGitBundle
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "build"
path: "dist"
- name: Upload packed templates artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "build-templates"
path: "templates/packed"
- name: Upload llama.cpp artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "llama.cpp"
path: |
llama/binariesGithubRelease.json
Expand Down Expand Up @@ -145,7 +148,7 @@ jobs:
- name: Setup & Build
id: build
shell: bash
timeout-minutes: 80
timeout-minutes: 160
env:
ARTIFACT_NAME: ${{ matrix.config.artifact }}
run: |
Expand Down Expand Up @@ -193,7 +196,7 @@ jobs:
async function buildBinary(arch, flags = [], nodeTarget = nodeVersion) {
console.log(`Building ${arch} for node ${nodeTarget} with flags`, flags);

await $`node ./dist/cli/cli.js build --ciMode --noUsageExample --arch ${arch} --nodeTarget ${nodeVersion} ${flags}`;
await $`node ./dist/cli/cli.js source build --ciMode --noUsageExample --arch ${arch} --nodeTarget ${nodeVersion} ${flags}`;
}

// build binaries
Expand Down Expand Up @@ -229,12 +232,12 @@ jobs:

EOF

- name: Cache UPX
id: cache-upx
uses: actions/cache@v4
with:
path: "upxInstallations/**"
key: cache-upx-${{ runner.os }}-${{ github.workflow }}
# - name: Cache UPX
# id: cache-upx
# uses: actions/cache@v4
# with:
# path: "upxInstallations/**"
# key: cache-upx-${{ runner.os }}-${{ github.workflow }}

# - name: Compress CUDA binary on Windows
# if: matrix.config.name == 'Windows for x64'
Expand Down Expand Up @@ -280,9 +283,48 @@ jobs:
- name: Publish artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "bins-${{ matrix.config.artifact }}"
path: "bins/*"

resolve-next-release:
name: Resolve next release
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta')
runs-on: ubuntu-latest
permissions:
pages: read
id-token: write
contents: read
issues: read
pull-requests: read
discussions: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install modules
run: npm ci
- name: Resolve next release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx --no vite-node ./scripts/resolveNextReleaseVersion.ts --saveReleaseToFile ./semanticReleaseDryRunReleaseResult.json --saveVersionToFile ./resolvedNextVersion.txt
- name: Save next version output
run: echo "next-version=$(cat ./resolvedNextVersion.txt)" >> $GITHUB_ENV
- name: Update job summary
run: |
if [ "$(cat ./resolvedNextVersion.txt)" == "false" ]; then
echo "Next release version: `N/A`" >> $GITHUB_STEP_SUMMARY
else
echo "Next release version: `$(cat ./resolvedNextVersion.txt)`" >> $GITHUB_STEP_SUMMARY
fi
- name: Upload resolved release artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "resolved-next-release"
path: "./semanticReleaseDryRunReleaseResult.json"

standalone-tests:
name: Standalone tests
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -315,7 +357,7 @@ jobs:
run: npm ci

- name: Build binary
run: node ./dist/cli/cli.js build --noUsageExample
run: node ./dist/cli/cli.js source build --noUsageExample

- name: Run standalone tests
run: npm run test:standalone
Expand Down Expand Up @@ -354,7 +396,7 @@ jobs:
run: npm ci

- name: Build binary
run: node ./dist/cli/cli.js build --noUsageExample
run: node ./dist/cli/cli.js source build --noUsageExample

- name: Cache models
id: cache-test-models
Expand All @@ -371,7 +413,7 @@ jobs:

release:
name: Release
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta')
if: needs.resolve-next-release.outputs.next-version != '' && needs.resolve-next-release.outputs.next-version != 'false'
runs-on: ubuntu-latest
concurrency: release-${{ github.ref }}
environment:
Expand All @@ -385,6 +427,7 @@ jobs:
pull-requests: write
discussions: write
needs:
- resolve-next-release
- build
- build-binaries
outputs:
Expand Down Expand Up @@ -430,13 +473,16 @@ jobs:
run: npx --no vite-node ./scripts/prepareStandalonePrebuiltBinaryModules.ts
- name: Add "postinstall" script to package.json
run: npm run addPostinstallScript
- name: Move semanticReleaseDryRunReleaseResult.json artifact
run: mv artifacts/resolved-next-release/semanticReleaseDryRunReleaseResult.json ./semanticReleaseDryRunReleaseResult.json
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_RELEASE_REF: ${{ github.ref }}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > ~/.npmrc
export DRY_RUN_RESULT="$(cat ./semanticReleaseDryRunReleaseResult.json)"

npx semantic-release
- name: Set npm package url to GITHUB_OUTPUT
Expand Down Expand Up @@ -479,24 +525,20 @@ jobs:
else
npm publish
fi
- name: Generate docs with updated version
if: steps.set-npm-url.outputs.npm-url != '' && github.ref == 'refs/heads/master'
env:
DOCS_URL_BASE: "/node-llama-cpp/"
run: |
export DOCS_PACKAGE_VERSION=$(cat .semanticRelease.npmPackage.deployedVersion.txt)
npm run docs:build
- name: Upload docs to GitHub Pages
if: steps.set-npm-url.outputs.npm-url != '' && github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v3
with:
name: pages-docs
path: docs-site
- name: Deploy docs to GitHub Pages
if: steps.set-npm-url.outputs.npm-url != '' && github.ref == 'refs/heads/master'
uses: actions/deploy-pages@v4

auto-approve-documentation-website-deployment:
name: Auto-approve documentation website deployment
runs-on: ubuntu-latest
continue-on-error: true
needs:
- release
steps:
- name: Approve documentation website deployment
uses: activescott/[email protected]
with:
artifact_name: pages-docs
github_token: ${{ secrets.AUTO_APPROVAL_GITHUB_TOKEN }}
environment_allow_list: "Documentation website"
actor_allow_list: giladgd

build-electron-example:
name: Build & release Electron app example - ${{ matrix.config.name }}
Expand Down Expand Up @@ -555,6 +597,7 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: "electron-app-example-${{ matrix.config.name }}"
path: "./electron-app-example/release"

Expand All @@ -572,3 +615,87 @@ jobs:
done

shopt -u nullglob

update-documentation-website:
name: Update documentation website
if: |
always() &&
github.event_name == 'push' &&
(github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta') &&
needs.build.result == 'success' &&
needs.resolve-next-release.result == 'success' &&
needs.resolve-next-release.outputs.next-version != '' && (
needs.resolve-next-release.outputs.next-version == 'false' ||
needs.release.result == 'skipped' || (
needs.release.result == 'success' &&
needs.release.outputs.package-version != ''
)
)
runs-on: ubuntu-latest
concurrency: update-documentation-website-${{ github.ref }}
environment:
name: Documentation website
# url: "https://node-llama-cpp.withcat.ai"
needs:
- build
- resolve-next-release
- release
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install modules
run: npm ci
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: |
mv artifacts/build dist/

cp -r artifacts/llama.cpp/llama.cpp llama/llama.cpp

rm -f ./llama/binariesGithubRelease.json
mv artifacts/llama.cpp/binariesGithubRelease.json ./llama/binariesGithubRelease.json

rm -f ./llama/llama.cpp.info.json
mv artifacts/llama.cpp/llama.cpp.info.json ./llama/llama.cpp.info.json
- name: Resolve docs version
env:
RELEASE_VERSION: ${{ needs.release.outputs.package-version || needs.resolve-next-release.outputs.next-version }}
run: |
if [ "$RELEASE_VERSION" == "false" ]; then
npx --no vite-node ./scripts/resolveLatestReleaseVersion.ts --saveVersionToFile ./docsVersion.txt
else
echo "$RELEASE_VERSION" > ./docsVersion.txt
fi
- name: Generate docs with updated version
env:
DOCS_URL_BASE: "/"
run: |
export DOCS_PACKAGE_VERSION="$(cat ./docsVersion.txt)"
echo "Package version: $DOCS_PACKAGE_VERSION"

npm run docs:build
- name: Upload docs
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
retention-days: 2
name: "docs-site"
path: docs-site
# - name: Upload docs to GitHub Pages
# uses: actions/upload-pages-artifact@v3
# with:
# name: pages-docs
# path: docs-site
# - name: Deploy docs to GitHub Pages
# uses: actions/deploy-pages@v4
# with:
# artifact_name: pages-docs
# - name: Update feed
# run: |
# curl -X POST "https://pubsubhubbub.appspot.com/" -H "Content-Type: application/x-www-form-urlencoded" --data-urlencode "hub.mode=publish" --data-urlencode "hub.url=https://node-llama-cpp.withcat.ai/blog/feed.atom"
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ jobs:
node-version: "20"
- name: Install modules
run: npm ci
- name: Build
run: npm run build
- name: Download latest llama.cpp release
env:
CI: true
run: node ./dist/cli/cli.js source download --release latest --skipBuild --noBundle --noUsageExample --updateBinariesReleaseMetadataAndSaveGitBundle
- name: Compile docs
run: npm run docs:build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ node_modules
/.vitepress/.cache
/test/.models
/test/temp
/temp
/coverage

/llama/compile_commands.json
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx --no -- commitlint --edit "$1"
commitlint --edit "$1"
Loading
Loading