Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a43fad1
llama.cpp: version bump b10969 (#18446)
dhiltgen Sep 15, 2026
6a0ee48
cmd: launch the MLX runner without the engine dispatcher
jessegross Sep 16, 2026
bef41f7
tokenizer, ml: remove dead code
jessegross Sep 16, 2026
2e036e7
mlx, mlxrunner: move the MLX engine out of x/
jessegross Sep 16, 2026
04b450a
mlxrunner, cmd, server: fold three small packages into their users
jessegross Sep 16, 2026
d27fde6
mlxrunner: read model manifests through the manifest package
jessegross Sep 16, 2026
7343e22
mlxrunner: lay out nn one layer kind per file
jessegross Sep 16, 2026
66c3238
mlxrunner: lay out model by contract, checkpoint and construction
jessegross Sep 16, 2026
28a9f8c
docs: fix cloud retirements settings link (#18496)
hoyyeva Sep 16, 2026
6b8bef2
app: clarify Claude connection dialog (#18498)
hoyyeva Sep 16, 2026
5ed8dde
app: add Apps deep link (#18497)
hoyyeva Sep 17, 2026
ec3cc23
mlxrunner: Release freed KV buffers during speculative decode
jessegross Sep 17, 2026
7fa8a02
cli: add first-run onboarding shared with the desktop app (#18495)
hoyyeva Sep 17, 2026
35bdad6
docs: clarify integrations overview and add assistant icons (#18511)
hoyyeva Sep 17, 2026
dfabde4
x/transfer, server: tighten redirect handling for registry requests (…
pdevine Sep 17, 2026
5113242
ci: harden release artifact uploads (#18516)
dhiltgen Sep 17, 2026
2c73164
nemotron_h: add MLX vision support (#17714)
dhiltgen Sep 17, 2026
4f6f739
tests: fix metadata deletion test flake (#18493)
dhiltgen Sep 17, 2026
9a44d9d
app: keep closed macOS windows from reopening on activation (#18518)
hoyyeva Sep 18, 2026
d0c8cdb
api: expose model thinking levels and defaults (#18473)
ParthSareen Sep 18, 2026
6383a0f
server: allow registry cross-host redirects among allowlisted hosts (…
pdevine Sep 19, 2026
6ae5088
server: fix getExistingName canonicalizing model name parts independe…
rick-github Sep 22, 2026
a9d8953
parsers: report the strings that end a response's thinking
jessegross Sep 14, 2026
1ce2b68
mlxrunner: constrain a format after the thinking in one generation
jessegross Sep 14, 2026
2ff052b
llm: apply a format after the thinking in one llama-server request
jessegross Sep 15, 2026
5a0ff31
server: apply structured outputs in a single pass on thinking models
jessegross Sep 14, 2026
ac34390
app: avoid System Events for ChatGPT/Codex detection (#18601)
hoyyeva Sep 22, 2026
13e0247
llama.cpp: version update (#18577)
dhiltgen Sep 22, 2026
421d74d
MLX: version bump (#18576)
dhiltgen Sep 23, 2026
b8c3d1f
mlx: select Gemma 4 image resolution dynamically (#18603)
dhiltgen Sep 23, 2026
c0f8da3
mlx: speed up Qwen 3.8 prompt processing (#18550)
dhiltgen Sep 23, 2026
c173758
docs: document thinking control discovery (#18501)
ParthSareen Sep 23, 2026
b9cd4b1
xgrammar: add standalone CMake project for native library (#18611)
dhiltgen Sep 23, 2026
e41a8b9
responses: preserve injective namespace tool identity
pd95 Sep 23, 2026
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
  •  
  •  
  •  
13 changes: 0 additions & 13 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,9 @@ llama/**/*.cuh linguist-vendored
llama/**/*.m linguist-vendored
llama/**/*.metal linguist-vendored

ml/backend/**/*.c linguist-vendored
ml/backend/**/*.h linguist-vendored
ml/backend/**/*.cpp linguist-vendored
ml/backend/**/*.hpp linguist-vendored
ml/backend/**/*.cu linguist-vendored
ml/backend/**/*.cuh linguist-vendored
ml/backend/**/*.m linguist-vendored
ml/backend/**/*.metal linguist-vendored
ml/backend/**/*.comp linguist-vendored
ml/backend/**/*.glsl linguist-vendored
ml/backend/**/CMakeLists.txt linguist-vendored

app/webview linguist-vendored

llama/build-info.cpp linguist-generated
ml/backend/ggml/ggml/src/ggml-metal/ggml-metal-embed.s linguist-generated

* text=auto
*.go text eol=lf
8 changes: 3 additions & 5 deletions .github/scripts/prepare_mlx_darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# The payload also depends on Ollama's payload build rules (cmake glue and
# carried mlx/compat patches) and the xgrammar native wrapper
# (x/mlxrunner/xgrammar/native). Rule drift rebuilds the whole payload from
# (mlxrunner/xgrammar/native). Rule drift rebuilds the whole payload from
# source; wrapper-only drift rebuilds just libollama_xgrammar.dylib.
#
# If no release matches the MLX pins (e.g. right after a pin bump), the
Expand Down Expand Up @@ -52,17 +52,15 @@ read_pin() {
tr -d '[:space:]' <"$1"
}

# Native wrapper sources compiled into libollama_xgrammar.dylib — keep in
# sync with the ollama_xgrammar target in cmake/mlx/CMakeLists.txt.
xgrammar_native_dir=x/mlxrunner/xgrammar/native
xgrammar_native_dir=mlxrunner/xgrammar/native

# Payload build rules beyond the MLX_VERSION/MLX_C_VERSION pins.
payload_rule_files=(
"cmake/local.cmake"
"cmake/apply-git-patches.cmake"
"cmake/mlx/CMakeLists.txt"
"cmake/mlx/CMakePresets.json"
"x/mlxrunner/mlx/CMakeLists.txt"
"mlx/CMakeLists.txt"
)

# Build-rule inputs: the rule files plus carried MLX/MLX-C patch content.
Expand Down
54 changes: 45 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,10 @@ jobs:
runs-on: ubuntu-latest
environment: release
needs: [darwin-build, windows-app, docker-build-push]
concurrency:
group: release-publish
queue: max
cancel-in-progress: false
permissions:
contents: write
env:
Expand Down Expand Up @@ -784,28 +788,59 @@ jobs:
- name: Generate checksum file
run: find . -type f -not -name 'sha256sum.txt' | xargs sha256sum | tee sha256sum.txt
working-directory: dist
- name: Create or update Release for tag
- name: Publish release artifacts
shell: bash
run: |
RELEASE_VERSION="$(echo ${GITHUB_REF_NAME} | cut -f1 -d-)"
retry() {
local attempt
for attempt in 1 2 3; do
if "$@"; then
return 0
fi
if [ "$attempt" -lt 3 ]; then
echo "::warning::Attempt $attempt failed; retrying in $((attempt * 15))s: $*"
sleep "$((attempt * 15))"
fi
done
echo "::error::Failed after 3 attempts: $*"
return 1
}

delete_assets() {
local assets asset
# Re-list on each attempt: a failed DELETE may still have removed the asset.
assets=$(gh api --paginate "repos/${GITHUB_REPOSITORY}/releases/$1/assets" --jq '.[].url') || return 1
while IFS= read -r asset; do
[ -z "$asset" ] && continue
gh api --method DELETE "$asset" || return 1
done <<< "$assets"
}

RELEASE_VERSION="${GITHUB_REF_NAME%%-*}"
echo "Looking for existing release for ${RELEASE_VERSION}"
OLD_TAG=$(gh release ls --json name,tagName | jq -r ".[] | select(.name == \"${RELEASE_VERSION}\") | .tagName")
OLD_TAG=$(gh release ls --json name,tagName | jq -r --arg version "$RELEASE_VERSION" '.[] | select(.name == $version) | .tagName')
if [ -n "$OLD_TAG" ]; then
RELEASE_ID=$(gh release view "$OLD_TAG" --json databaseId --jq .databaseId)
echo "Deleting old assets from ${OLD_TAG}"
retry delete_assets "$RELEASE_ID"
echo "Updating release ${RELEASE_VERSION} to point to new tag ${GITHUB_REF_NAME}"
gh release edit ${OLD_TAG} --tag ${GITHUB_REF_NAME}
gh release edit "$OLD_TAG" --tag "$GITHUB_REF_NAME"
else
echo "Creating new release ${RELEASE_VERSION} pointing to tag ${GITHUB_REF_NAME}"
gh release create ${GITHUB_REF_NAME} \
--title ${RELEASE_VERSION} \
gh release create "$GITHUB_REF_NAME" \
--title "$RELEASE_VERSION" \
--draft \
--generate-notes \
--prerelease
fi
- name: Upload release artifacts
run: |

shopt -s nullglob
pids=()
for payload in dist/*.txt dist/*.zip dist/*.tgz dist/*.tar.zst dist/*.exe dist/*.dmg dist/*.ps1 dist/*.sh ; do
# Publish the checksum manifest only after every payload has succeeded.
[ "$payload" = dist/sha256sum.txt ] && continue
echo "Uploading $payload"
gh release upload ${GITHUB_REF_NAME} $payload --clobber &
retry gh release upload "$GITHUB_REF_NAME" "$payload" --clobber &
pids+=($!)
sleep 1
done
Expand All @@ -821,4 +856,5 @@ jobs:
echo "One or more uploads failed"
exit 1
fi
retry gh release upload "$GITHUB_REF_NAME" dist/sha256sum.txt --clobber
echo "done"
75 changes: 75 additions & 0 deletions .github/workflows/test-xgrammar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: test-xgrammar

on:
pull_request:
paths:
- 'cmake/mlx/CMakeLists.txt'
- 'mlxrunner/xgrammar/**'
- '.github/workflows/test-xgrammar.yaml'

permissions:
contents: read

jobs:
standalone:
runs-on: macos-latest
env:
CGO_ENABLED: '1'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Cache MLX Darwin release payload
uses: actions/cache@v4
with:
path: .cache/mlx-darwin-release
key: mlx-darwin-${{ hashFiles('MLX_VERSION', 'MLX_C_VERSION', 'cmake/local.cmake', 'cmake/apply-git-patches.cmake', 'cmake/mlx/CMakeLists.txt', 'cmake/mlx/CMakePresets.json', 'mlx/CMakeLists.txt', 'mlx/compat/**', 'mlxrunner/xgrammar/native/**') }}
- name: Prepare MLX Darwin release payload
run: .github/scripts/prepare_mlx_darwin.sh
- name: Install pinned xgrammar into a prefix
run: |
set -euo pipefail
version="$(sed -n 's/^set(XGRAMMAR_VERSION \(.*\))$/\1/p' cmake/mlx/CMakeLists.txt)"
[ -n "${version}" ] || { echo "XGRAMMAR_VERSION not found in cmake/mlx/CMakeLists.txt" >&2; exit 1; }
echo "XGRAMMAR_VERSION=${version}" >>"${GITHUB_ENV}"
src="${RUNNER_TEMP}/xgrammar-src"
build="${RUNNER_TEMP}/xgrammar-build"
git clone --depth 1 --branch "${version}" --recurse-submodules --shallow-submodules \
https://github.com/mlc-ai/xgrammar.git "${src}"
# xgrammar's cmake/config.cmake overrides -D options unless the build dir has its own.
mkdir -p "${build}"
echo 'set(XGRAMMAR_BUILD_PYTHON_BINDINGS OFF)' >"${build}/config.cmake"
cmake -S "${src}" -B "${build}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${RUNNER_TEMP}/xgrammar-prefix"
cmake --build "${build}" --parallel
cmake --install "${build}"
- name: Build xgrammar library against installed xgrammar
run: |
set -euo pipefail
cmake -S mlxrunner/xgrammar/native -B build/xgrammar-standalone \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/xgrammar-prefix" \
-DXGRAMMAR_VERSION="${XGRAMMAR_VERSION}"
cmake --build build/xgrammar-standalone
- name: Verify only the ollama_xgrammar API is exported
run: |
set -euo pipefail
lib=build/xgrammar-standalone/libollama_xgrammar.dylib
if nm -gU "${lib}" | awk '{print $3}' | grep -v '^_ollama_xgrammar_'; then
echo "unexpected exported symbols in ${lib}" >&2
exit 1
fi
- name: Replace the payload's xgrammar library
run: |
set -euo pipefail
for variant in build/lib/ollama/mlx_metal_v*; do
cp -f build/xgrammar-standalone/libollama_xgrammar.dylib "${variant}/"
done
- name: go test
run: |
set -euo pipefail
# The tests skip when the library is missing; treat a skip as failure.
go test -count=1 -v ./mlxrunner/xgrammar/... | tee "${RUNNER_TEMP}/xgrammar-test.log"
if grep -- '--- SKIP' "${RUNNER_TEMP}/xgrammar-test.log"; then
exit 1
fi
23 changes: 10 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ jobs:
'LLAMA_CPP_VERSION' \
'MLX_VERSION' \
'MLX_C_VERSION' \
'llama/llama.cpp/**/*' \
'ml/backend/ggml/ggml/**/*' \
'x/imagegen/mlx/**' \
'x/imagegen/mlx/**/*' \
'x/mlxrunner/xgrammar/native/**' \
'x/mlxrunner/xgrammar/native/**/*' \
'mlx/CMakeLists.txt' \
'mlx/compat/**' \
'mlx/compat/**/*' \
'mlxrunner/xgrammar/native/**' \
'mlxrunner/xgrammar/native/**/*' \
'.github/**/*') | tee -a $GITHUB_OUTPUT
echo app_changed=$(changed 'app/**' 'app/**/*') | tee -a $GITHUB_OUTPUT
echo go_mod_changed=$(changed 'go.mod') | tee -a $GITHUB_OUTPUT
Expand Down Expand Up @@ -419,7 +418,7 @@ jobs:
with:
path: .cache/mlx-darwin-release
# Key on every payload input so a source-built payload survives pushes.
key: mlx-darwin-${{ hashFiles('MLX_VERSION', 'MLX_C_VERSION', 'cmake/local.cmake', 'cmake/apply-git-patches.cmake', 'cmake/mlx/CMakeLists.txt', 'cmake/mlx/CMakePresets.json', 'x/mlxrunner/mlx/CMakeLists.txt', 'mlx/compat/**', 'x/mlxrunner/xgrammar/native/**') }}
key: mlx-darwin-${{ hashFiles('MLX_VERSION', 'MLX_C_VERSION', 'cmake/local.cmake', 'cmake/apply-git-patches.cmake', 'cmake/mlx/CMakeLists.txt', 'cmake/mlx/CMakePresets.json', 'mlx/CMakeLists.txt', 'mlx/compat/**', 'mlxrunner/xgrammar/native/**') }}
- name: Prepare MLX Darwin release payload
if: ${{ startsWith(matrix.os, 'macos') }}
run: .github/scripts/prepare_mlx_darwin.sh
Expand All @@ -439,11 +438,9 @@ jobs:
cmake -S . -B build/mlx-generate -DOLLAMA_MLX_BACKENDS=cuda_v13
cmake --build build/mlx-generate --target ollama-mlx-generate-wrappers
git diff --exit-code -- \
x/imagegen/mlx/mlx.h \
x/imagegen/mlx/mlx.c \
x/mlxrunner/mlx/generated.h \
x/mlxrunner/mlx/generated.c \
x/mlxrunner/mlx/include/mlx/c
mlx/generated.h \
mlx/generated.c \
mlx/include/mlx/c
- name: Run go generate
run: go generate ./...

Expand Down Expand Up @@ -486,7 +483,7 @@ jobs:
with:
path: .cache/mlx-darwin-release
# Key on every payload input so a source-built payload survives pushes.
key: mlx-darwin-${{ hashFiles('MLX_VERSION', 'MLX_C_VERSION', 'cmake/local.cmake', 'cmake/apply-git-patches.cmake', 'cmake/mlx/CMakeLists.txt', 'cmake/mlx/CMakePresets.json', 'x/mlxrunner/mlx/CMakeLists.txt', 'mlx/compat/**', 'x/mlxrunner/xgrammar/native/**') }}
key: mlx-darwin-${{ hashFiles('MLX_VERSION', 'MLX_C_VERSION', 'cmake/local.cmake', 'cmake/apply-git-patches.cmake', 'cmake/mlx/CMakeLists.txt', 'cmake/mlx/CMakePresets.json', 'mlx/CMakeLists.txt', 'mlx/compat/**', 'mlxrunner/xgrammar/native/**') }}
- name: Prepare MLX Darwin release payload
if: ${{ startsWith(matrix.os, 'macos') }}
run: .github/scripts/prepare_mlx_darwin.sh
Expand Down
5 changes: 5 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ linters:
files:
- $all
- "!$test"
- "!**/mlx/mlxtest/*.go"
deny:
- pkg: github.com/ollama/ollama/internal/testutil
desc: test helpers may only be imported by test files
- pkg: github.com/ollama/ollama/mlx/mlxtest
desc: test helpers may only be imported by test files
- pkg: github.com/ollama/ollama/mlx/mlxthread/mlxthreadtest
desc: test helpers may only be imported by test files
govet:
disable:
- unusedresult
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,8 @@ ENV CGO_LDFLAGS="-L/usr/local/cuda-13/lib64 -L/usr/local/cuda-13/targets/x86_64-
WORKDIR /go/src/github.com/ollama/ollama
COPY CMakeLists.txt CMakePresets.json .
COPY cmake cmake
COPY mlx/compat mlx/compat
COPY x/mlxrunner/mlx x/mlxrunner/mlx
COPY x/mlxrunner/xgrammar/native x/mlxrunner/xgrammar/native
COPY mlx mlx
COPY mlxrunner/xgrammar/native mlxrunner/xgrammar/native
COPY go.mod go.sum .
COPY MLX_VERSION MLX_C_VERSION .
RUN curl -fsSL https://golang.org/dl/go$(awk '/^go/ { print $2 }' go.mod).linux-$(case $(uname -m) in x86_64) echo amd64 ;; aarch64) echo arm64 ;; esac).tar.gz | tar xz -C /usr/local
Expand Down
2 changes: 1 addition & 1 deletion LLAMA_CPP_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b10864
b11081
2 changes: 1 addition & 1 deletion MLX_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d9add9d11f3154111a4c85f267ec2fd307ecd18e
59d600b5e64c238427d0f8d897ab7c682ef4d3d2
31 changes: 18 additions & 13 deletions anthropic/anthropic.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/ollama/ollama/auth"
internalcloud "github.com/ollama/ollama/internal/cloud"
"github.com/ollama/ollama/logutil"
"github.com/ollama/ollama/types/model"
)

// Error types matching Anthropic API
Expand Down Expand Up @@ -317,8 +318,9 @@ type StreamErrorEvent struct {
Error Error `json:"error"`
}

// FromMessagesRequest converts an Anthropic MessagesRequest to an Ollama api.ChatRequest
func FromMessagesRequest(r MessagesRequest) (*api.ChatRequest, error) {
// FromMessagesRequest converts an Anthropic MessagesRequest to an Ollama api.ChatRequest.
// An optional thinking descriptor preserves model-defined effort names for rendering.
func FromMessagesRequest(r MessagesRequest, thinking ...*model.Thinking) (*api.ChatRequest, error) {
logutil.Trace("anthropic: converting request", "req", TraceMessagesRequest(r))

var messages []api.Message
Expand Down Expand Up @@ -402,24 +404,27 @@ func FromMessagesRequest(r MessagesRequest) (*api.ChatRequest, error) {
}

var think *api.ThinkValue
normalizedEffort := ""
if r.OutputConfig != nil {
normalizedEffort = strings.ToLower(strings.TrimSpace(r.OutputConfig.Effort))
if normalizedEffort == "xhigh" {
normalizedEffort = "high"
}
}

if r.Thinking != nil && r.Thinking.Type == "enabled" {
think = &api.ThinkValue{Value: true}
}
if r.Thinking != nil && r.Thinking.Type == "disabled" {
think = &api.ThinkValue{Value: false}
}
if think == nil && r.OutputConfig != nil {
switch normalizedEffort {
case "high", "medium", "low", "max":
think = &api.ThinkValue{Value: normalizedEffort}
effort := r.OutputConfig.Effort
if len(thinking) > 0 && thinking[0].Valid() {
if effort != "" {
think = &api.ThinkValue{Value: effort}
}
} else {
effort = strings.ToLower(strings.TrimSpace(effort))
if effort == "xhigh" {
effort = "high"
}
legacyThink := &api.ThinkValue{Value: effort}
if api.ValidateLegacyThinking(legacyThink) == nil {
think = legacyThink
}
}
}

Expand Down
Loading