A stateless LLM backed by Apple's on-device Foundation Model through the rtemis-afm
bridge; see config_Apple for what the bridge is and how to start it.
Usage
create_Apple(
system_prompt = SYSTEM_PROMPT_DEFAULT,
temperature = TEMPERATURE_DEFAULT,
output_schema = NULL,
name = NULL,
model_name = APPLE_MODEL_DEFAULT,
base_url = APPLE_URL_DEFAULT,
timeout = APPLE_TIMEOUT_DEFAULT,
extra_headers = NULL,
extra_body = NULL,
validate_model = TRUE
)Arguments
- system_prompt
Character: The system prompt to use.
- temperature
Numeric [0, 2]: The temperature for the model.
- output_schema
Optional Schema: Output schema created using schema.
- name
Optional character: Name for the LLM object.
- 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.
Examples
# Requires a running rtemis-afm bridge
if (FALSE) { # \dontrun{
llm <- create_Apple(system_prompt = "You are a meticulous research assistant.")
generate(llm, "What is the capital of France?")
} # }