Skip to content

Commit

Permalink
feat: function calling (#139)
Browse files Browse the repository at this point in the history
* feat: function calling support
* feat: stateless `LlamaChat`
* feat: improve chat wrapper
* feat: `LlamaText` util
* test: add basic model-dependent tests
* fix: threads parameter
* fix: disable Metal for `x64` arch by default
  • Loading branch information
giladgd authored Jan 19, 2024
1 parent 4757af8 commit 5fcdf9b
Show file tree
Hide file tree
Showing 73 changed files with 6,456 additions and 2,652 deletions.
3 changes: 2 additions & 1 deletion .config/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"useCodeBlocks": true,
"expandObjects": true,
"parametersFormat": "table",
"hideInPageTOC": true
"hideInPageTOC": true,
"docsRoot": "../docs"
}
54 changes: 52 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,19 @@ jobs:
await $`mkdir -p llamaBins`;
for (const arch of arches) {
const additionalFlags = [];
let buildNodeVersion = nodeVersion;
if (process.env.ARTIFACT_NAME === "win" && arch === "arm64") {
buildNodeVersion = windowsOnArmNodeVersion;
} else if (process.env.ARTIFACT_NAME === "mac" && arch === "x64") {
additionalFlags.push("--no-metal");
}
console.log(`Building ${arch} for node ${buildNodeVersion}`);
const binName = `${process.env.ARTIFACT_NAME}-${arch}`;
await $`node ./dist/cli/cli.js build --arch ${arch} --nodeTarget ${buildNodeVersion}`;
const binName = `${process.env.ARTIFACT_NAME}-${arch}`;
await $`node ./dist/cli/cli.js build --arch ${arch} --nodeTarget ${buildNodeVersion} ${additionalFlags}`;
await $`mv ./llama/build/Release ${"./llamaBins/" + binName}`;
}
Expand Down Expand Up @@ -237,6 +240,53 @@ jobs:
- name: Run standalone tests
run: npm run test:standalone

model-dependent-tests:
name: Model dependent tests
runs-on: macos-13
needs:
- build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "20"

- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build
path: dist

- name: Download llama.cpp artifact
uses: actions/download-artifact@v3
with:
name: llama.cpp
path: llama/llama.cpp

- name: Install dependencies on macOS
run: |
brew install cmake ninja
alias make=cmake
- name: Install modules
run: npm ci

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

- name: Cache models
id: cache-test-models
uses: actions/cache@v3
with:
path: "test/.models/**.gguf"
key: cache-test-models-${{ runner.os }}-${{ github.workflow }}

- name: Download models or ensure all models are downloaded
run: npm run dev:setup:downloadAllTestModels

- name: Run model dependent tests
run: npm run test:modelDependent

release:
name: Release
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ node_modules
/.env
/.eslintcache
/.vitepress/.cache
/test/.models
/coverage

/llama/compile_commands.json
Expand Down
Loading

0 comments on commit 5fcdf9b

Please sign in to comment.