Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
76956dc
feat: AMD hardware API (#1797)
vansangpfiev Jan 14, 2025
bd9271c
Feat/check status python process (#1848)
nguyenhoangthuan99 Jan 14, 2025
0707069
fix: logger issue (#1858)
vansangpfiev Jan 15, 2025
68094d9
fix: ignore compute_cap if not present (#1866)
vansangpfiev Jan 17, 2025
e4e3e90
chore: clean default local engines (#1852)
vansangpfiev Jan 17, 2025
193946e
fix: add cpu usage (#1868)
vansangpfiev Jan 17, 2025
c6f86fd
chore: cleanup (#1849)
vansangpfiev Jan 17, 2025
26dcb7a
chore: correct-discord-message (#1872)
hiento09 Jan 17, 2025
a35a05f
devx: add devcontainer (#1854)
InNoobWeTrust Jan 17, 2025
6a77e82
added syntax highlighting and improved readability
ramonpzg Jan 19, 2025
2de30ca
added api docs line to key features
ramonpzg Jan 19, 2025
8da4791
general improvements on format and readability
ramonpzg Jan 19, 2025
df60e6b
Merge branch 'main' of https://github.com/janhq/cortex.cpp into chore…
sangjanai Jan 20, 2025
cab9407
Merge pull request #1873 from janhq/chore/sync-main-to-dev
vansangpfiev Jan 20, 2025
c3d0efa
chore: correct stop command description
sangjanai Jan 20, 2025
f090e0b
Merge pull request #1874 from janhq/chore/cli-docs
vansangpfiev Jan 20, 2025
3a1fd86
fixed general note reagarding RAM/model size
ramonpzg Jan 21, 2025
ef135a6
polished installation section and enhanced docker section
ramonpzg Jan 23, 2025
9f5a796
doc: improve "Build from Source" in README
tigercosmos Jan 23, 2025
c666840
polished wording and added results examples
ramonpzg Jan 27, 2025
90aa25f
added files and engines table
ramonpzg Jan 27, 2025
f1846a2
polished wording
ramonpzg Jan 27, 2025
aeaa1fb
polished wording
ramonpzg Jan 27, 2025
92906ac
polished configuration sections
ramonpzg Jan 27, 2025
2a73844
adding pictures
ramonpzg Jan 27, 2025
7bf084a
fixed format issue
ramonpzg Jan 27, 2025
8c7d71e
added local files to be ignored
ramonpzg Jan 28, 2025
c180239
fixed conflic on stop cortex server section
ramonpzg Jan 28, 2025
e0a3b0e
improved wording, tables, and the explanation of how to run models
ramonpzg Jan 28, 2025
53c32bf
improved readability, flow of explanations, and cleaned examples
ramonpzg Jan 31, 2025
6db5bd8
fixed wording, added structured outputs example, cleaned function cal…
ramonpzg Jan 31, 2025
4c73da0
polished wording and removed tensorrt-llm
ramonpzg Jan 31, 2025
e95b6c7
polished wording and removed tensorrt-llm mentions
ramonpzg Jan 31, 2025
a38fc81
added -d for detached mode
ramonpzg Jan 31, 2025
77a6294
polished barely anything
ramonpzg Jan 31, 2025
ab88347
added tutorial
ramonpzg Jan 31, 2025
f3024c3
removed tensorrt-llm and made general improvements to all docs
ramonpzg Jan 31, 2025
ebc0d34
Merge pull request #1891 from janhq/doc-improvs
ramonpzg Jan 31, 2025
58644f4
general improvements on format, readability and examples
ramonpzg Feb 3, 2025
8d6b772
Merge pull request #1886 from tigercosmos/improve_readme_0123
vansangpfiev Feb 3, 2025
596eb94
fix: permission issue for default drogon uploads folder (#1870)
vansangpfiev Feb 3, 2025
89e4285
revamped main README file with a more concise explanation on how to g…
ramonpzg Feb 3, 2025
4bcec4d
changed framing of cortex
ramonpzg Feb 3, 2025
7e7eba8
new main image
ramonpzg Feb 4, 2025
b21d964
removed active development warning
ramonpzg Feb 4, 2025
125a115
addressed conflicts and fixed images
ramonpzg Feb 4, 2025
42a6474
Merge pull request #1913 from janhq/function-calling-improvement
ramonpzg Feb 4, 2025
cdc7eda
chore: add ci qualitygate for external contributor (#1931)
hiento09 Feb 5, 2025
d05e8e4
fix: models.cc: symlinked model deletion shouldn't remove original fi…
ohaiibuzzle Feb 5, 2025
4132f2f
feat: QoL improvements for server when running standalone (#1925)
ohaiibuzzle Feb 8, 2025
32af9df
fix: correct gpu info list (#1944)
vansangpfiev Feb 10, 2025
7010a88
doc: update build from source (#1947)
gau-nernst Feb 10, 2025
ecbd2d0
chore: sync main to dev (#1945)
vansangpfiev Feb 10, 2025
f9364aa
fix: add metadata (#1875)
vansangpfiev Feb 10, 2025
76b1983
doc: Update build from source documentation (#1951)
gau-nernst Feb 11, 2025
eec21b5
chore: remove references to ONNX and TRT-LLM (#1961)
gau-nernst Feb 13, 2025
19eb7ea
fix: inherit current env vars when spawning subprocess on macos (#1964)
gau-nernst Feb 13, 2025
cd8938a
fix: add local e2e test (#1965)
vansangpfiev Feb 14, 2025
da69edf
fix: wrong check for printing log (#1968)
vansangpfiev Feb 14, 2025
c9f5d0e
feat: add inja example (#1969)
vansangpfiev Feb 14, 2025
8d6ea04
chore: remove `cortex-cpp-deps` (#1966)
gau-nernst Feb 15, 2025
bb6d60b
fix: remove all yml files when delete model (#1980)
vansangpfiev Feb 18, 2025
58c071c
chore: sync main to dev (#1978)
vansangpfiev Feb 18, 2025
6ffed73
Fix: Prevent Out-of-Bounds Reads in GGUF Parser
qnixsynapse Feb 19, 2025
7ff86d0
Merge pull request #1985 from janhq/fix/gguf_parser
qnixsynapse Feb 19, 2025
bf28b3a
Merge branch 'dev' of https://github.com/janhq/cortex.cpp into chore/…
sangjanai Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04

ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="none"

# Optionally install the cmake for vcpkg
COPY ./reinstall-cmake.sh /tmp/

RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \
chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \
fi \
&& rm -f /tmp/reinstall-cmake.sh

# [Optional] Uncomment this section to install additional vcpkg ports.
# RUN su vscode -c "${VCPKG_ROOT}/vcpkg install <your-port-name-here>"

# [Optional] Uncomment this section to install additional packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"hostRequirements": {
"cpus": 4,
"memory": "8gb",
"storage": "32gb"
},
"name": "C++",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": {},
"ghcr.io/sebst/devcontainer-features/pkgx:1": {},
"ghcr.io/devcontainers-extra/features/apt-packages:1": {
"clean_ppas": true,
"preserve_apt_list": true,
"packages": "build-essential linux-libc-dev",
"ppas": "ppa:deadsnakes/ppa"
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "git submodule update --init",
// Use 'postAttachCommand' to run commands after the container is attached.
"postAttachCommand": "pkgx install npx && npx -y runme run --filename README.md -t devcontainer -y"
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
59 changes: 59 additions & 0 deletions .devcontainer/reinstall-cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
set -e

CMAKE_VERSION=${1:-"none"}

if [ "${CMAKE_VERSION}" = "none" ]; then
echo "No CMake version specified, skipping CMake reinstallation"
exit 0
fi

# Cleanup temporary directory and associated files when exiting the script.
cleanup() {
EXIT_CODE=$?
set +e
if [[ -n "${TMP_DIR}" ]]; then
echo "Executing cleanup of tmp files"
rm -Rf "${TMP_DIR}"
fi
exit $EXIT_CODE
}
trap cleanup EXIT


echo "Installing CMake..."
apt-get -y purge --auto-remove cmake
mkdir -p /opt/cmake

architecture=$(dpkg --print-architecture)
case "${architecture}" in
arm64)
ARCH=aarch64 ;;
amd64)
ARCH=x86_64 ;;
*)
echo "Unsupported architecture ${architecture}."
exit 1
;;
esac

CMAKE_BINARY_NAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh"
CMAKE_CHECKSUM_NAME="cmake-${CMAKE_VERSION}-SHA-256.txt"
TMP_DIR=$(mktemp -d -t cmake-XXXXXXXXXX)

echo "${TMP_DIR}"
cd "${TMP_DIR}"

curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_BINARY_NAME}" -O
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_CHECKSUM_NAME}" -O

sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_NAME}"
sh "${TMP_DIR}/${CMAKE_BINARY_NAME}" --prefix=/opt/cmake --skip-license

ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
ln -s /opt/cmake/bin/ctest /usr/local/bin/ctest
4 changes: 2 additions & 2 deletions .github/workflows/beta-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ jobs:
- Network Installer: https://github.com/janhq/cortex.cpp/releases/download/v${{ env.VERSION }}/cortex-${{ env.VERSION }}-linux-amd64-network-installer.deb
- Local Installer: https://github.com/janhq/cortex.cpp/releases/download/v${{ env.VERSION }}/cortex-${{ env.VERSION }}-linux-amd64-local-installer.deb
- Binary: https://github.com/janhq/cortex.cpp/releases/download/v${{ env.VERSION }}/cortex-${{ env.VERSION }}-linux-amd64.tar.gz
- Linux amd64 Deb:
- Linux arm64 Deb:
- Network Installer: https://github.com/janhq/cortex.cpp/releases/download/v${{ env.VERSION }}/cortex-${{ env.VERSION }}-linux-arm64-network-installer.deb
- Local Installer: https://github.com/janhq/cortex.cpp/releases/download/v${{ env.VERSION }}/cortex-${{ env.VERSION }}-linux-arm64-local-installer.deb
- Binary: https://github.com/janhq/cortex.cpp/releases/download/v${{ env.VERSION }}/cortex-${{ env.VERSION }}-linux-arm64.tar.gz
- Docker: menloltd/cortex:beta-${{ env.VERSION }}
- Github Release: https://github.com/janhq/cortex.cpp/releases/tag/v${{ env.VERSION }}
- Github Release: https://github.com/janhq/cortex.cpp/releases/tag/v${{ env.VERSION }}
248 changes: 248 additions & 0 deletions .github/workflows/cortex-cpp-quality-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:

jobs:
build-and-test:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'workflow_dispatch'
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 60
strategy:
Expand Down Expand Up @@ -255,6 +256,7 @@ jobs:
AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"

build-docker-and-test:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-24-04-docker
steps:
- name: Getting the repo
Expand Down Expand Up @@ -309,3 +311,249 @@ jobs:
docker stop cortex
docker rm cortex
echo "y\n" | docker system prune -af

build-and-test-target-pr:
permissions:
contents: read
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: "linux"
name: "arm64"
runs-on: "ubuntu-2004-arm64"
cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
build-deps-cmake-flags: ""
ccache-dir: ""
- os: "linux"
name: "amd64"
runs-on: "ubuntu-20-04-cuda-12-0"
cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
build-deps-cmake-flags: ""
ccache-dir: ""
- os: "mac"
name: "amd64"
runs-on: "macos-selfhosted-12"
cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
build-deps-cmake-flags: ""
ccache-dir: ""
- os: "mac"
name: "arm64"
runs-on: "macos-selfhosted-12-arm64"
cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
build-deps-cmake-flags: ""
ccache-dir: ""
- os: "windows"
name: "amd64"
runs-on: "windows-cuda-12-0"
cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
build-deps-cmake-flags: "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
steps:
- name: Clone
id: checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: use python
continue-on-error: true
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install tools on Linux
if: runner.os == 'Linux'
run: |
python3 -m pip install awscli

- name: Install choco on Windows
if: runner.os == 'Windows'
run: |
choco install make pkgconfiglite ccache awscli 7zip ninja -y

- name: Configure vcpkg
if: runner.os != 'Linux'
run: |
cd engine
make configure-vcpkg

- name: Configure vcpkg linux amd64
if: runner.os != 'Linux'
run: |
cd engine
make configure-vcpkg

- name: Configure vcpkg linux arm64
if: runner.os == 'Linux'
run: |
cd engine
# Set env if arch is arm64
if [ "${{ matrix.name }}" == "arm64" ]; then
sudo apt install ninja-build pkg-config -y
export VCPKG_FORCE_SYSTEM_BINARIES=1
fi
make configure-vcpkg

- name: Build
if: runner.os != 'Linux'
run: |
cd engine
make build CMAKE_EXTRA_FLAGS="${{ matrix.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ matrix.build-deps-cmake-flags }}"

- name: Build
if: runner.os == 'Linux'
run: |
cd engine
if [ "${{ matrix.name }}" == "arm64" ]; then
export VCPKG_FORCE_SYSTEM_BINARIES=1
fi
make build CMAKE_EXTRA_FLAGS="${{ matrix.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ matrix.build-deps-cmake-flags }}"

- name: Run setup config
run: |
cd engine
echo "gitHubToken: ${{ secrets.GITHUB_TOKEN }}" > ~/.cortexrc
# ./build/cortex
cat ~/.cortexrc

- name: Run unit tests
run: |
cd engine
make run-unit-tests
env:
GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}

- name: Run setup config
run: |
cd engine
echo "apiServerPort: 3928" > ~/.cortexrc
echo "gitHubToken: ${{ secrets.GITHUB_TOKEN }}" > ~/.cortexrc
# ./build/cortex
cat ~/.cortexrc

- name: Run e2e tests
if: github.event_name != 'schedule' && runner.os != 'Windows' && github.event.pull_request.draft == false
run: |
cd engine
cp build/cortex build/cortex-nightly
cp build/cortex build/cortex-beta
python -m pip install --upgrade pip
python -m pip install -r e2e-test/requirements.txt
python e2e-test/main.py
rm build/cortex-nightly
rm build/cortex-beta
env:
GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}

- name: Run e2e tests
if: github.event_name != 'schedule' && runner.os == 'Windows' && github.event.pull_request.draft == false
run: |
cd engine
cp build/cortex.exe build/cortex-nightly.exe
cp build/cortex.exe build/cortex-beta.exe
python -m pip install --upgrade pip
python -m pip install -r e2e-test/requirements.txt
python e2e-test/main.py
rm build/cortex-nightly.exe
rm build/cortex-beta.exe
env:
GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}

- name: Run e2e tests
if: github.event_name == 'schedule' && runner.os != 'Windows' && github.event.pull_request.draft == false
run: |
cd engine
cp build/cortex build/cortex-nightly
cp build/cortex build/cortex-beta
python -m pip install --upgrade pip
python -m pip install -r e2e-test/requirements.txt
python e2e-test/cortex-llamacpp-e2e-nightly.py
rm build/cortex-nightly
rm build/cortex-beta
env:
GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}

- name: Run e2e tests
if: github.event_name == 'schedule' && runner.os == 'Windows' && github.event.pull_request.draft == false
run: |
cd engine
cp build/cortex.exe build/cortex-nightly.exe
cp build/cortex.exe build/cortex-beta.exe
python -m pip install --upgrade pip
python -m pip install -r e2e-test/requirements.txt
python e2e-test/cortex-llamacpp-e2e-nightly.py
rm build/cortex-nightly.exe
rm build/cortex-beta.exe
env:
GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}

- name: Pre-package
run: |
cd engine
make pre-package DESTINATION_BINARY_NAME="cortex"

- name: Package
run: |
cd engine
make package

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cortex-${{ matrix.os }}-${{ matrix.name }}
path: ./engine/cortex

build-docker-and-test-target-pr:
permissions:
contents: read
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-24-04-docker
steps:
- name: Getting the repo
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Run Docker
if: github.event_name != 'schedule'
run: |
docker build \
-t menloltd/cortex:test -f docker/Dockerfile .
docker run -it -d -p 3928:39281 --name cortex menloltd/cortex:test
sleep 20

- name: Run Docker
if: github.event_name == 'schedule'
run: |
latest_prerelease=$(curl -s https://api.github.com/repos/cortexcpp/cortex.cpp/releases | jq -r '.[] | select(.prerelease == true) | .tag_name' | head -n 1)
echo "cortex.llamacpp latest release: $latest_prerelease"
docker build \
--build-arg CORTEX_CPP_VERSION="${latest_prerelease}" \
-t menloltd/cortex:test -f docker/Dockerfile .
docker run -it -d -p 3928:39281 --name cortex menloltd/cortex:test
sleep 20

- name: use python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Run e2e tests
run: |
cd engine
python -m pip install --upgrade pip
python -m pip install -r e2e-test/requirements.txt
pytest e2e-test/test_api_docker.py

- name: Run Docker
continue-on-error: true
if: always()
run: |
docker logs cortex
docker stop cortex
docker rm cortex
echo "y\n" | docker system prune -af
Loading
Loading