Skip to main content

LLM plugin for Apple Foundation Models (Apple Intelligence)

Project description

llm-apple

LLM plugin for Apple Foundation Models (Apple Intelligence)

This plugin exposes Apple's on-device Foundation Models through the llm CLI tool.

Requirements

Installation

pip install llm # if llm is not already installed
llm install llm-apple

Usage

Basic usage:

llm -m apple "What is the capital of France?"

With streaming:

llm -m apple "Tell me a story" --stream

With options:

llm -m apple "Write a poem" -o temperature 1.5 -o max_tokens 500

With system instructions:

llm -m apple "What is Python?" --system "You are a helpful programming tutor"

Conversations

The plugin supports conversations, maintaining context across multiple prompts:

# Start a conversation
llm -m apple "My name is Alice" --save conversation1

# Continue the conversation
llm -m apple "What is my name?" --continue conversation1

Available Options

  • temperature (float, 0.0-2.0, default: 1.0): Controls randomness in generation
    • 0.0 = deterministic
    • 2.0 = very random
  • max_tokens (int, default: 1024): Maximum tokens to generate

System prompts can be provided using llm's built-in --system or -s flag.

Availability

The plugin checks Apple Intelligence availability on startup. If Apple Intelligence is not available, you'll see an error message with details on why.

Common reasons:

  • Device not eligible (requires Apple Silicon)
  • Apple Intelligence not enabled in Settings
  • Model not ready (downloading or initializing)

Examples

Creative writing with higher temperature:

llm -m apple "Write a creative story about a robot" -o temperature 1.8

Factual query with lower temperature:

llm -m apple "Explain quantum computing" -o temperature 0.3

With system prompt for career guidance:

llm -m apple "Should I learn Python or JavaScript?" \
  --system "You are a career counselor specializing in tech"

Development

Running Tests

# Run tests
uv run pytest

# Run tests with coverage
uv run pytest --cov=llm_apple --cov-report=html --cov-report=term

The tests use mocks to simulate the Apple Foundation Models API, so they can run on any platform without requiring actual Apple Intelligence hardware.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_apple-0.1.2.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_apple-0.1.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file llm_apple-0.1.2.tar.gz.

File metadata

  • Download URL: llm_apple-0.1.2.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_apple-0.1.2.tar.gz
Algorithm Hash digest
SHA256 45d3a3ce4e1f280cc8ec13b6cabaac90d6c78a8637268b50c62c1eb6f8e8c871
MD5 777c6f4818cc56b8794f32fbfc2fcfae
BLAKE2b-256 dbe54e15f2aa6aa151163b2b028c2ec68dec5a6c28707af89320ed1fd30d53a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_apple-0.1.2.tar.gz:

Publisher: publish-to-pypi.yml on btucker/llm-apple

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_apple-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: llm_apple-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_apple-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9cd811a74871a407500c30694d5db67bdbdfe3110f41913fff657358917e2822
MD5 90c9ce23223ff8d0b04f7bf1bd32596d
BLAKE2b-256 c74b5dc7b63170243827d2e767059c0aefecf4e32865d078cd408cf6e519072a

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_apple-0.1.2-py3-none-any.whl:

Publisher: publish-to-pypi.yml on btucker/llm-apple

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page