These functions help construct and explain get_diver_data() calls (from the certedb package) using the active LLM. Each call uses an isolated chat context so the main conversation history is not affected.

  • llm_diver_query() generates a get_diver_data() call from a natural language description.

  • llm_diver_explain() explains an existing get_diver_data() call in plain Dutch.

The LLM is primed with a static schema hint describing known Diver column names and conventions. When the exact column name is uncertain, the generated code includes a comment noting the assumption.

llm_diver_query(
  description,
  table = NULL,
  columns_hint = NULL,
  new = FALSE,
  ...
)

llm_diver_explain(query, new = FALSE, ...)

Arguments

description

Natural language description of the data to retrieve, e.g. "All E. coli urine cultures from 2024 in Groningen".

table

Optional hint for the Diver table to query.

columns_hint

Optional character vector of known column names to assist the LLM in forming the query.

new

Logical. If TRUE, re-initiates the LLM before the task call. Default is FALSE.

...

Additional arguments passed to initiate_llm().

query

An existing get_diver_data() call as a character string, to be explained.

Value

A character string: the generated R code (llm_diver_query()) or the Dutch explanation (llm_diver_explain()).