Creates an AppleConfig object which can be passed to create_agent().
Usage
config_Apple(
temperature = TEMPERATURE_DEFAULT,
model_name = APPLE_MODEL_DEFAULT,
base_url = APPLE_URL_DEFAULT,
timeout = APPLE_TIMEOUT_DEFAULT,
extra_headers = NULL,
extra_body = NULL,
validate_model = TRUE
)Arguments
- temperature
Numeric [0, 2]: The temperature for the model.
- model_name
Character: The model id the bridge serves;
"afm"unless the bridge says otherwise.- base_url
Character: Base URL of the bridge's OpenAI-compatible wire.
- timeout
Numeric (0, Inf): Request timeout in seconds.
- extra_headers
Optional list: Additional HTTP headers.
- extra_body
Optional list: Additional request body fields.
- validate_model
Logical: Whether to check the bridge's
/healthendpoint now with apple_check_available, so that a bridge that is not running or a model that is not available fails here with a message saying what to do, rather than at the first request.
Details
Apple's on-device Foundation Model (the model behind Apple Intelligence) is reached
through the rtemis-afm bridge, which serves it over the OpenAI Chat Completions wire
on http://127.0.0.1:1977. Install and start the bridge with
curl -fsSL https://live.rtemis.org/afm.sh | sh (or
brew install rtemis-org/tap/rtemis-afm, then rtemis-afm). It needs an Apple silicon
Mac, macOS 27 or later, and Apple Intelligence turned on. No API key is used or sent.
The model supports chat, structured output, and tool calling, with an 8,192-token
context window on macOS 27.0; a prompt that does not fit is refused by the bridge with
a context_length_exceeded error.
Examples
# Requires a running rtemis-afm bridge
if (FALSE) { # \dontrun{
cfg <- config_Apple(temperature = 0.2)
agent <- create_agent(cfg, system_prompt = "You are a concise assistant.")
} # }
# Build the configuration without contacting the bridge:
cfg <- config_Apple(validate_model = FALSE)