import * as plugins from './plugins.js'; /** Options of OpenAI's provider-executed web search, as the Responses API `web_search` tool takes them. */ export interface IOpenAiWebSearchToolOptions { /** * `true` lets a search read live pages; `false` answers from OpenAI's cached index, the mode Codex uses by * default. Unset leaves the choice to the backend. */ externalWebAccess?: boolean; /** Domains the search may use, or must not use. */ filters?: { allowedDomains?: string[]; blockedDomains?: string[]; }; /** How much of what it found the search puts into the model's context. */ searchContextSize?: 'low' | 'medium' | 'high'; /** Where results should be local to. */ userLocation?: { type: 'approximate'; country?: string; city?: string; region?: string; timezone?: string; }; } /** * OpenAI's web search, executed by the provider: the model searches and reads results on OpenAI's side and * the host fetches nothing, so no request of the host reaches the web. Add it to a run's tools under the name * `web_search`. It is a Responses API tool, so it works with `api: 'responses'` and the ChatGPT connections. */ export const createOpenAiWebSearchTool = (optionsArg: IOpenAiWebSearchToolOptions = {}): plugins.Tool => // a provider-defined tool only describes the search; creating it sends no request plugins.openai.tools.webSearch(optionsArg);