Skip to contents

A specialized AgentDriver for local execution of Open source models via the ollama CLI. Ideal for air-gapped or privacy-sensitive workflows.

Value

An OllamaDriver object.

Details

Setup: Ensure the ollama server is running locally. You can specify the binary path via options(HydraR.ollama_path = "...").

Super class

HydraR::AgentDriver -> OllamaDriver

Public fields

model

String. Default model.

Methods

Inherited methods


Method new()

Initialize OllamaDriver

Usage

OllamaDriver$new(
  id = "ollama",
  model = "llama3.2",
  validation_mode = "warning",
  working_dir = NULL
)

Arguments

id

Unique identifier.

model

String. Default model.

validation_mode

String. "warning" or "strict".

working_dir

String. Optional. Path to isolated Git worktree. Format CLI Options for Ollama


Method format_cli_opts()

Usage

OllamaDriver$format_cli_opts(cli_opts = list())

Arguments

cli_opts

List.

Returns

Character vector. Call the LLM


Method call()

Usage

OllamaDriver$call(
  prompt,
  model = NULL,
  system_prompt = NULL,
  cli_opts = list(),
  ...
)

Arguments

prompt

String.

model

String override.

system_prompt

String. Optional system prompt.

cli_opts

List.

...

Additional arguments.

Returns

String. Cleaned result.


Method clone()

The objects of this class are cloneable with this method.

Usage

OllamaDriver$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # \dontrun{
# 1. Use llama3.2 locally via Ollama
driver <- OllamaDriver$new(model = "llama3.2")

# 2. Call with high-precision sampling and large context window
# Ideal for summarizing long bioinformatics documents.
response <- driver$call(
  prompt = "Summarize the technical specifications for the 'samtools' format.",
  cli_opts = list(
    num_ctx = 32768,
    temperature = 0.1,
    repeat_penalty = 1.2,
    seed = 42
  )
)
} # }