% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api_openai.R
\name{openai_deep_research}
\alias{openai_deep_research}
\title{Submit a Deep Research Request to OpenAI}
\usage{
openai_deep_research(
  .llm,
  .model = "o4-mini-deep-research",
  .background = FALSE,
  .reasoning_effort = "medium",
  .json_schema = NULL,
  .max_output_tokens = NULL,
  .timeout = 1800,
  .max_tries = 3
)
}
\arguments{
\item{.llm}{An \code{LLMMessage} object containing the research question.}

\item{.model}{The deep research model to use (default: \code{"o4-mini-deep-research"}).}

\item{.background}{Logical; if \code{TRUE}, returns a \code{tidyllm_research_job} immediately
without waiting for completion (default: \code{FALSE}).}

\item{.reasoning_effort}{Reasoning level for the model: \code{"low"}, \code{"medium"} (default),
or \code{"high"}.}

\item{.json_schema}{A tidyllm schema for structured JSON output (optional).}

\item{.max_output_tokens}{Maximum tokens to generate (default: \code{NULL} for model default).}

\item{.timeout}{Seconds to wait in blocking mode before giving up (default: \code{1800}).}

\item{.max_tries}{Maximum retries per HTTP request (default: \code{3}).}
}
\value{
If \code{.background = FALSE}, an updated \code{LLMMessage} with the research reply.
If \code{.background = TRUE}, a \code{tidyllm_research_job} for use with \code{check_job()}/\code{fetch_job()}.
}
\description{
Sends a research request to OpenAI using the deep research models
(\code{o3-deep-research} or \code{o4-mini-deep-research}) via the Responses API with
\code{background: true}. The model autonomously searches the web and synthesises
a long-form answer, which can take 5-30 minutes.
}
