Skip to contents

Create a STORM configuration

Usage

tempest_config(
  models = NULL,
  params = NULL,
  chat_fn = NULL,
  embed_fn = NULL,
  ragnar_store = NULL,
  search_provider = "native",
  cache_dir = NULL,
  cache_enabled = TRUE,
  cache_ttl = Inf,
  max_search_results = 8,
  max_search_queries_per_turn = 3,
  retrieve_top_k = 25,
  max_sources = 24,
  user_agent = "tempest (R; +https://github.com/JamesHWade/tempest)",
  max_active_experts = 5L,
  citation_policy = "source_attributed",
  min_support_score = 0.7,
  on_unsupported_claim = "flag"
)

Arguments

models

Named list of model identifiers for each role, or a single string to use for all roles.

params

Additional parameters passed to chat creation. Explicit values override the role defaults used by Tempest's built-in OpenAI clients.

chat_fn

Custom chat factory function. Should accept role, model, system_prompt, and echo arguments and return an ellmer-compatible Chat object. Use this for custom providers like chat_company().

embed_fn

Embedding function for RAG. Should accept a character vector and return a matrix of embeddings. Use ragnar::embed_openai(), ragnar::embed_ollama(), or a custom function. If provided, a ragnar store is automatically created.

ragnar_store

A pre-built ragnar store. If NULL and embed_fn is provided, a store is created automatically with the tempest metadata schema.

search_provider

Search provider: "native" (use provider's built-in web search when available), "wikipedia", "you", "bing", "serper", "brave", "duckduckgo", "tavily", "searxng", "google", or "azure_ai_search". Default is "native" which uses OpenAI, Anthropic, or Google's native web search capabilities when available, falling back to "wikipedia".

cache_dir

Path to cache directory.

cache_enabled

Whether retriever search/fetch calls should read from and write to the on-disk cache.

cache_ttl

Maximum cache age in seconds. Defaults to Inf, which keeps cached search/fetch entries valid until explicitly cleared.

max_search_results

Maximum search results to return.

max_search_queries_per_turn

Maximum decomposed queries per research turn.

retrieve_top_k

Maximum facts/chunks retrieved for each section.

max_sources

Maximum sources to keep.

user_agent

User agent string for HTTP requests.

max_active_experts

Maximum number of active expert agents in Co-STORM.

citation_policy

Report citation-rendering and unsupported-claim handling policy: one of "none", "source_attributed", "claim_verified", or "strict". Product publication always runs exact claim verification.

min_support_score

Minimum support score in [0, 1] for a claim to be considered supported.

on_unsupported_claim

Action for unsupported claims: one of "flag", "drop", "revise", or "keep_with_warning". drop removes the complete unsupported assertion; revise replaces it with a revision notice.

Value

A TempestConfig S7 object.

Default chat

When both models and chat_fn are NULL, tempest_config() consults the tempest.chat R option. Set it to a provider/model string accepted by ellmer::chat() or an ellmer Chat object. String values are used for every role. Chat objects are cloned for every role, retain their provider settings and system instructions, and receive the appropriate Tempest role prompt. When the option is unset, Tempest creates its built-in OpenAI clients with ellmer::chat_openai(). If the installed ellmer carries the ChatGPT subscription-authentication port (chat_openai(auth = ), tidyverse/ellmer#1067), the clients are created with auth = "codex" and reuse the file-backed subscription managed by Codex CLI, so no OPENAI_API_KEY is needed. With released ellmer, which lacks that argument, the clients use ellmer's standard API-key authentication (OPENAI_API_KEY), and Tempest says so once per session. Explicit models and chat_fn arguments take precedence over the option.

Examples

cfg <- tempest_config()
cfg <- tempest_config(search_provider = "wikipedia")