Skip to contents

Execute an OpenAI request with optional built-in tools enabled (web search, file search, code interpreter, etc.). Returns AI-generated content with response metadata attached as attributes.

Usage

openai_with_tools(
  prompt,
  sys_prompt = NULL,
  tools = list(),
  ml = NULL,
  temp = 1,
  store = FALSE,
  max_tokens = NULL,
  timeout = 60
)

Arguments

prompt

User prompt text

sys_prompt

Optional system prompt

tools

List of tool configurations (use tool_* functions)

ml

Model to use (default: from config)

temp

Temperature setting

store

Whether to store for conversation continuation

max_tokens

Optional max_output_tokens cap (passthrough to [openai_responses()])

timeout

Request timeout in seconds (passthrough to [openai_responses()])

Value

Response content with metadata attributes