Files
Adolfo Reyna 2e6d6d24ce feat: Apple on-device LLM (ANE) polish replaces Ollama as primary
- apple-llm-polish binary (120KB Swift, FoundationModels): --check
  now reports available:true after Apple Intelligence enabled,
  ping OK, line polish 258-388ms ANE vs Ollama 3-8s CPU
- engine_apple_llm.py: AppleLLM class with persistent pipe,
  thread reader, polish_line() + polish_paragraph(), JSONL protocol
  {id,mode,text,prev1,prev2,context} -> {id,text,ok,ms}
- engine_llm.py: try Apple ANE first (permissiveContentTransformations,
  temp 0.1 line / 0.2 para), log provider=apple apple_ms, fallback
  to Ollama on guardrail/timeout. Fixes missing LLM log — now
  logs provider=apple with ms.
- main_v3.py: --apple-llm / --no-apple-llm flag (on by default)
- Verified: direct polish 258ms, last log provider=apple ms=498,
  speech binary still 240KB with 31 word-by-word drafts

Co-authored-by: internal-model
2026-07-13 21:31:24 -04:00

23 lines
829 B
Bash
Executable File

#!/bin/bash
set -e
cd "$(dirname "$0")"
SDK="/Library/Developer/CommandLineTools/SDKs/MacOSX26.5.sdk"
if [ ! -d "$SDK" ]; then SDK="/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk"; fi
mkdir -p .build/release
echo "Compiling apple-llm-polish with swiftc..."
swiftc -O -parse-as-library -target arm64-apple-macosx26.0 -sdk "$SDK" \
Sources/AppleLLMPolish/main.swift -o .build/release/apple-llm-polish \
-framework Foundation -framework FoundationModels
echo "Built: .build/release/apple-llm-polish"
ls -lh .build/release/apple-llm-polish
# check
echo "=== check ==="
.build/release/apple-llm-polish --check 2>&1 | head -20
echo "Copying to root copies..."
cp .build/release/apple-llm-polish ../apple-llm-polish 2>/dev/null || true
cp .build/release/apple-llm-polish ./apple-llm-polish 2>/dev/null || true
echo "Done"