| LanguageModelV1 | R Documentation |
Abstract interface for language models. All LLM providers must implement this class.
Uses do_ prefix for internal methods to prevent direct usage by end-users.
specification_versionThe version of this specification.
providerThe provider identifier (e.g., "openai").
model_idThe model identifier (e.g., "gpt-4o").
capabilitiesModel capability flags.
new()Initialize the model with provider and model ID.
LanguageModelV1$new(provider, model_id, capabilities = list())
providerProvider name.
model_idModel ID.
capabilitiesOptional list of capability flags.
has_capability()Check if the model has a specific capability.
LanguageModelV1$has_capability(cap)
capCapability name.
Logical.
generate()Public generation method.
LanguageModelV1$generate(...)
...Call options passed to do_generate().
A GenerateResult object.
stream()Public streaming method.
LanguageModelV1$stream(callback, ...)
callbackCallback invoked with (text, done).
...Call options passed to do_stream().
A GenerateResult object.
do_generate()Generate text (non-streaming). Abstract method.
LanguageModelV1$do_generate(params)
paramsA list of call options.
A GenerateResult object.
do_stream()Generate text (streaming). Abstract method.
LanguageModelV1$do_stream(params, callback)
paramsA list of call options.
callbackCallback invoked with (text, done).
A GenerateResult object.
format_tool_result()Format a tool execution result for the provider API.
LanguageModelV1$format_tool_result(tool_call_id, tool_name, result_content)
tool_call_idThe tool call identifier.
tool_nameThe tool name.
result_contentThe tool execution result.
A provider-specific tool result message.
get_history_format()Get the message history format used by this model.
LanguageModelV1$get_history_format()
A character string such as "openai" or "anthropic".
clone()The objects of this class are cloneable with this method.
LanguageModelV1$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.