rtemis.llm NEWS
0.8.8
- Compatible with S7 releases after 0.2.2: the namespace imports
data.table’s
:= and excludes S7’s, which removes the
import-replacement warning on load, and load, unload, and build hooks
use S7_on_load(), S7_on_unload(), and
S7_on_build() when S7 provides them, with
methods_register() for earlier S7 releases. The minimum S7
version is unchanged.
- Added
concurrency to llmapply(),
dmapply(), agentapply(), and
map(), with independent agent state per input, bounded
local workers, and batch_elapsed timing.
- Anthropic requests follow the rules of the configured Claude model,
including Claude Opus 5.5, Claude Sonnet 5.5 and Claude Haiku 5.5:
sampling parameters, thinking, effort, structured output and tool choice
are sent in the form the model accepts, and a value the model rejects
stops before the request. Structured output uses
output_config.format on models with structured
outputs.
- Added
think, effort and
fallbacks to config_Anthropic() and
create_Anthropic(). With
validate_model = TRUE, the config reads the model’s
capabilities from the Models API.
config_Anthropic() and create_Anthropic()
default to temperature = NULL, which leaves the temperature
to the model.
- An Anthropic response with
stop_reason
"refusal" raises an error of class
rtemis_llm_refusal; a response that stops at
max_tokens raises a warning.
- An OpenAI-compatible response with a
refusal, including
a refusal from Apple Foundation Models, raises an error of class
rtemis_llm_refusal; llmapply() and
map() record each refusal in the errors
attribute. HTTP errors from OpenAI-compatible chat requests have class
rtemis_llm_api_error and include the server’s error
message.
- License changed to BSD 3-clause.
- Hashing now uses ‘openssl’, replacing the ‘digest’ dependency.
- Added image input:
image_path on
generate() for LLMs and Agents, and on
llmapply() and agentapply(), sends local PNG,
JPEG, GIF, or WebP files to Ollama, OpenAI-compatible (including Apple
Foundation Models), and Anthropic-compatible backends. One prompt can be
applied over many images, and several images can be sent with each
prompt.
- Added
chat(): a multi-turn conversation in the R
console with a model name, an LLM, or an
Agent, with /image, /clear,
/help and /exit commands. Returns the
Agent with the conversation in its memory.
- Added decision models:
create_DecisionModel() with
config_OllamaDecision() or
config_OpenRouterDecision() fills a closed schema through
generate() and dmapply(), with a probability
per field from probabilities(), and answers typed questions
built with choice() and noul() through
decide(). as_questions() converts a closed
schema into those questions, is_decidable() reports whether
a schema can be filled this way, and
ollama_list_decision_models() lists the decision models on
an Ollama server.
llmapply(), agentapply() and
dmapply() results carry an elapsed attribute:
the wall time of each call, in seconds.
- Ollama LLMs append the output schema, as JSON Schema text, to the
system prompt of each request, as Ollama’s documentation recommends, so
the model sees field descriptions.
schema_in_prompt = FALSE
on config_Ollama() and create_Ollama() sends
the system prompt as written.
0.8.7
- Added
config_Apple() and create_Apple()
for Apple Foundation Models: Apple’s on-device model, served over the
OpenAI Chat Completions wire by the rtemis-afm bridge on
http://127.0.0.1:1977. AppleConfig is an
OpenAIConfig, so chat, structured output, tool calling,
agents, and batch generation work unchanged; no API key is resolved or
sent. config_Apple() reads the bridge’s
/health endpoint by default and stops with instructions
when the bridge is not running or the model is unavailable
(validate_model = FALSE skips the check).
apple_health() returns the served model, its availability,
and its context window; apple_check_available() performs
the check on its own.
0.8.6
- Added
items to field(): an
"array" field now says what it contains, as a type name
(items = "string"), a field() where the
elements carry their own description or enum, or a
schema() for an array of objects. Emitted as the JSON
Schema items key and passed through by all three backends,
so a list of values can be requested as a list instead of as one
delimited string the caller splits back apart.
- An
"array" field declared without items is
now an error rather than a schema that fails at request time: OpenAI’s
strict mode rejects an array with no element type, and a
constrained-decoding backend has nothing to constrain.
items on any other type is likewise refused.
field() refuses type = "object": a field
carries no properties, which OpenAI and Anthropic require of an object
schema. Declare an array of objects with type = "array" and
items = schema(...). tool_param() still
accepts "object".
validate_output() checks array elements against
items, where before an array field constrained only its
outer type.
0.8.5
- Structured responses are validated locally by default with a cached
Ajv validator.
validate_output = FALSE skips validation
while still requesting the schema.
on_validation_failure = "warn" retains invalid output and
emits an informational rtemis.core message, not an R warning;
"collect" is silent and "abort" raises an
error carrying the response and diagnostics. Batches validate per item
and summarize mismatches once at completion.
- Added standalone
validate_output() and the
validation_results() accessor. Reports preserve original
text, input positions/names, statuses, and diagnostics, including when
batch responses are extracted. Validation does not repair output.
- Agent final answers are validated before memory commit.
responses() recognizes histories returned by
generate(agent, ...) and extracts their final answer.
- Anthropic synthetic structured-output tool inputs are returned as
answer JSON, retaining raw content metadata and excluding the synthetic
tool from execution.
- Added
enum to field(): restrict a field to
a fixed set of permitted values. Emitted as the JSON Schema
enum key and passed through unchanged by all three
backends, so a backend with constrained decoding (Ollama) makes an
invalid value impossible rather than merely detectable.
- Added
on_error to llmapply(),
agentapply(), and map(), defaulting to
"na": a failed call now warns and yields NA
rather than discarding every result in the batch, and the result carries
an errors attribute (a data.frame of index and
message) for retrying just the failures. Pass
on_error = "abort" for the previous behavior of propagating
the first error.
responses() and reasoning() now accept
NULL elements, mapping them to
NA_character_.
- Added
num_ctx and keep_alive as per-call
Ollama options in generate().
- Added
logprobs and top_logprobs per-call
options for the Ollama and OpenAI-compatible backends, with new
logprobs() and token_probs() accessors.
token_probs() reads the probability of each candidate
answer straight off the model’s token distribution, which is better
calibrated than asking a model to emit a number. Anthropic does not
return log probabilities; its messages yield NULL rather
than an error.
- Per-call options passed to
generate()
(temperature, top_p, max_tokens,
stop, top_k, seed,
num_ctx, keep_alive, logprobs,
top_logprobs) are validated against each backend’s
documented bounds before a request is built, so an out-of-range or
wrong-typed value fails locally instead of on the server. Bounds follow
the backend: temperature accepts up to 2 on Ollama and
OpenAI-compatible backends and up to 1 on Anthropic, and
top_logprobs up to 20 on OpenAI. top_logprobs
requires logprobs = TRUE, which every backend that returns
alternatives needs in order to return them.
0.8.4
- Added
zero_data_retention to
config_OpenAI() and create_OpenAI() for
per-request OpenRouter ZDR routing.
- Added
think to config_Ollama(),
create_Ollama(), and generate() for Ollama
thinking control.