openai_file_search_tool: OpenAI built-in file_search tool

View source: R/openai_tools.R

openai_file_search_toolR Documentation

OpenAI built-in file_search tool

Description

Configure the Responses API's hosted RAG over one or more vector stores you've uploaded to OpenAI.

Usage

openai_file_search_tool(
  vector_store_ids,
  max_num_results = NULL,
  ranking_options = NULL
)

Arguments

vector_store_ids

Character vector of vector-store IDs to search. Required, non-empty.

max_num_results

Optional integer cap on how many chunks the model sees per call.

ranking_options

Optional named list for advanced ranking config (e.g. list(ranker = "auto", score_threshold = 0.5)).

Value

A plain list ready to drop into tools = list(...).

Examples

## Not run: 
generate_text(
  model,
  "What does the design doc say about caching?",
  tools = list(openai_file_search_tool(c("vs_abc123")))
)

## End(Not run)

aisdk documentation built on May 29, 2026, 9:07 a.m.