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.1.tar.gz (7.8 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.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_apple-0.1.1.tar.gz
  • Upload date:
  • Size: 7.8 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.1.tar.gz
Algorithm Hash digest
SHA256 fb8ef92f9cc57c9b58b9f5635f1dde42cedc801e5d83a200909d15e40044a7be
MD5 10b56ff18e9779c688924d5b53a9a492
BLAKE2b-256 24c032af651ae64f6798ac9ff2977ee58631f8593eccbc7b2affdd9aecfbb3c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_apple-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: llm_apple-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 88167bd0a31f465e02dc9ef50bc9da5f75dfb235893fe72ca382e308e58604fc
MD5 a8880d6c077a0c036ceae479892bf12f
BLAKE2b-256 a2a365350a5b18c7f43798d80f0ad276c73780748fc12d6a63e1ea879bc793a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_apple-0.1.1-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