import type { TLlmProvider } from "../../lib/llm/types.js"; import { type TOpenAiFetch } from "./types.js"; export type TCreateOpenAiResponsesProviderOptions = { apiKey: string; /** Override the default `https://api.openai.com/v1/responses`. */ baseUrl?: string; /** * Injectable `fetch`. Defaults to `globalThis.fetch`. Tests inject * mocks; runtimes without a global `fetch` (older Node) inject a * polyfill. */ fetch?: TOpenAiFetch; /** * Cap on the number of round-trips the function-tool agent loop * can take before throwing `ToolLoopExhaustedError`. Defaults to * 6. Built-in tools (`web_search` / `file_search` / `mcp`) don't * count against this cap — they run server-side. */ maxToolCallRounds?: number; /** * Stream the foreground response over SSE and accumulate to the * terminal envelope inside the provider. Defaults to **`true`** — * gives connection-drop resilience. No data-retention implications * (unlike `backgroundMode`). * Set `false` to restore the blocking `response.json()` path. */ stream?: boolean; /** * Run long reasoning calls in OpenAI **background mode** * (submit-then-poll) so the result does not depend on a * continuously-held connection. Defaults to **`false`**. * * Background mode requires `store: true`, which retains the * response server-side (~10 min, for polling) and is **NOT * ZDR-compatible**. Enable only where that data-retention posture * is acceptable. V1 supports the **no-tools path only**: a request * that sets `backgroundMode` and carries `tools` throws * `NonRetryableLlmError`. */ backgroundMode?: boolean; /** * Combine OpenAI **background mode** with **live SSE streaming**: * the request is submitted with `{ background: true, stream: true, * store: true }` so it keeps generating server-side even if the * connection drops, and the SSE stream is consumed live while it * runs. This is independent of the `stream` option (foreground- * only streaming) and `backgroundMode` (poll-only). * * When `true`, `backgroundMode` is ignored for this provider * instance. `stream` is also ignored (SSE is always used in this * mode). V1 supports the **no-tools path only**: a request that * sets `backgroundStreamMode` and carries `tools` throws * `NonRetryableLlmError`. * * The response id is surfaced immediately from the submit POST * body (before any SSE bytes), making it available for durable * persistence by the caller. Defaults to **`false`**. */ backgroundStreamMode?: boolean; /** * Poll interval (ms) for the background submit-then-poll loop. * Defaults to 2000. Ignored unless `backgroundMode` is `true`. */ backgroundPollIntervalMs?: number; }; export declare function createOpenAiResponsesProvider(options: TCreateOpenAiResponsesProviderOptions): TLlmProvider; //# sourceMappingURL=provider.d.ts.map