@pipedog/openai 0.0.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ // Copyright (c) 2024-2026, Daily
2
+ // Copyright (c) 2026, pipedog contributors
3
+ // SPDX-License-Identifier: BSD-2-Clause
4
+ //
5
+ // Ported from pipecat: src/pipecat/services/openai/responses/__init__.py
6
+ // Upstream's package __init__ is empty: import the submodules directly.
7
+ export {};
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,448 @@
1
+ import type { BaseLLMAdapter } from "@pipedog/core/adapters/base_llm_adapter";
2
+ import { type OpenAINotGiven } from "@pipedog/core/adapters/services/open_ai_adapter";
3
+ import { type Frame, FunctionCallFromLLM } from "@pipedog/core/frames/frames";
4
+ import type { LLMContext } from "@pipedog/core/processors/aggregators/llm_context";
5
+ import type { FrameDirection } from "@pipedog/core/processors/frame_processor";
6
+ import { LLMService, type LLMServiceOptions, WebsocketLLMService, type WebsocketLLMServiceOptions } from "@pipedog/core/services/llm_service";
7
+ import { LLMSettings, type LLMSettingsOptions } from "@pipedog/core/services/settings";
8
+ import { type Ctor } from "@pipedog/core/utils/mixin";
9
+ import { type NotGiven } from "@pipedog/core/utils/types";
10
+ import OpenAI from "openai";
11
+ import { OpenAIResponsesLLMAdapter, type OpenAIResponsesLLMInvocationParams } from "../open_ai_responses_adapter.ts";
12
+ type Dict = Record<string, any>;
13
+ type ResponsesAdapter = OpenAIResponsesLLMAdapter & BaseLLMAdapter;
14
+ /** Base for errors that should trigger a retry in `_processContext`. */
15
+ export declare class _RetryableError extends Error {
16
+ name: string;
17
+ }
18
+ /** Server could not find the previous response (connection-local cache miss). */
19
+ export declare class _PreviousResponseNotFoundError extends _RetryableError {
20
+ name: string;
21
+ }
22
+ /** WebSocket connection hit the 60-minute server-side limit. */
23
+ export declare class _ConnectionLimitReachedError extends _RetryableError {
24
+ name: string;
25
+ }
26
+ /** Response did not begin producing output within the retry timeout. */
27
+ export declare class _ResponseTimeoutError extends _RetryableError {
28
+ name: string;
29
+ }
30
+ export interface OpenAIResponsesReasoningConfigOptions {
31
+ /** How much reasoning effort the model applies. */
32
+ effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | string | null;
33
+ /** Verbosity of the reasoning summary to return. */
34
+ summary?: "auto" | "concise" | "detailed" | string | null;
35
+ /** Reasoning mode for models that offer one: "standard" or "pro". */
36
+ mode?: "standard" | "pro" | string | null;
37
+ }
38
+ /**
39
+ * Reasoning configuration for reasoning-capable OpenAI Responses models.
40
+ *
41
+ * Only reasoning-capable models use this — the mainline gpt series from gpt-5
42
+ * onward and the o-series. The service's default model, `gpt-4.1`, does not
43
+ * reason, so this config has no effect there; select a reasoning-capable model
44
+ * to use it. See OpenAI's reasoning guide
45
+ * (https://platform.openai.com/docs/guides/reasoning) and model list
46
+ * (https://platform.openai.com/docs/models) to choose one and to check which
47
+ * effort levels it accepts.
48
+ *
49
+ * Reasoning models use internal reasoning tokens before producing a response.
50
+ * This controls how much reasoning they do and whether a human-readable
51
+ * summary of it is returned.
52
+ *
53
+ * - `effort`: how much reasoning effort the model applies. `null` (the
54
+ * default) leaves the field unset, so the model's own default applies;
55
+ * `"none"` disables reasoning for latency-sensitive use and `"max"` applies
56
+ * the model's deepest reasoning. At lower efforts (e.g. `"low"`) the model
57
+ * reasons only when a turn calls for it, so simple prompts may produce no
58
+ * summary at all.
59
+ * - `summary`: verbosity of the reasoning summary to return. `null` (the
60
+ * default) requests no summary. Any summary is surfaced via thought frames
61
+ * (the `on_assistant_thought` event); the encrypted reasoning itself is
62
+ * preserved across turns regardless of this setting.
63
+ * - `mode`: reasoning mode for models that offer one, such as the gpt-5.6
64
+ * series: `"standard"` or the slower, more thorough `"pro"`. `null` (the
65
+ * default) leaves the field unset, so the model's own default applies.
66
+ * `effort` selects the reasoning intensity within the chosen mode.
67
+ */
68
+ export declare class OpenAIResponsesReasoningConfig {
69
+ effort: string | null;
70
+ summary: string | null;
71
+ mode: string | null;
72
+ constructor(options?: OpenAIResponsesReasoningConfigOptions);
73
+ /**
74
+ * The config as a dict of its wire fields (pydantic's `model_dump`).
75
+ *
76
+ * @param options.excludeNone Leave out fields whose value is `null`.
77
+ */
78
+ modelDump(options?: {
79
+ excludeNone?: boolean;
80
+ }): Record<string, string | null>;
81
+ }
82
+ export interface OpenAIResponsesLLMSettingsOptions extends LLMSettingsOptions {
83
+ /** Maximum completion tokens to generate. */
84
+ maxCompletionTokens?: number | NotGiven | OpenAINotGiven;
85
+ /** Reasoning configuration for reasoning-capable models. */
86
+ reasoning?: OpenAIResponsesReasoningConfig | null | NotGiven;
87
+ }
88
+ /**
89
+ * Settings for OpenAI Responses API LLM services.
90
+ *
91
+ * - `maxCompletionTokens`: maximum completion tokens to generate.
92
+ * - `reasoning`: reasoning configuration for reasoning-capable models. `null`
93
+ * (the default) leaves reasoning unconfigured: the service then sends the
94
+ * lowest effort OpenAI documents for the model, for the fastest responses,
95
+ * and logs what it sent. Models Pipecat doesn't list, and any model when
96
+ * `useProviderThinkingDefault` is set, run at OpenAI's default. The default
97
+ * model, `gpt-4.1`, does not reason.
98
+ *
99
+ * The inherited `temperature` and `topP` fields also hold the OpenAI SDK's
100
+ * sentinel (`OPENAI_NOT_GIVEN`), which the service stores so these fields
101
+ * can be passed through unchanged to the client.
102
+ */
103
+ export declare class OpenAIResponsesLLMSettings extends LLMSettings {
104
+ maxCompletionTokens: number | NotGiven | OpenAINotGiven;
105
+ reasoning: OpenAIResponsesReasoningConfig | null | NotGiven;
106
+ constructor(options?: OpenAIResponsesLLMSettingsOptions);
107
+ }
108
+ /** Whether the model is an o-series reasoning model (o1, o3, o4-mini, ...). */
109
+ export declare function _isOSeries(model: string): boolean;
110
+ export declare const _THINKING_DEFAULTS: Readonly<Record<string, string>>;
111
+ /**
112
+ * The name a model id refers to, the key it's looked up by in
113
+ * `_THINKING_DEFAULTS`.
114
+ *
115
+ * A dated snapshot (`gpt-5-2025-08-07`) gets its model's entry.
116
+ */
117
+ export declare function _modelName(model: string): string;
118
+ /**
119
+ * Classify whether an OpenAI model supports reasoning.
120
+ *
121
+ * Assumes that future (beyond gpt-5.x) mainline gpt series models will also
122
+ * support reasoning. This can be revisited if OpenAI changes their model
123
+ * lineup or reasoning support in the future.
124
+ *
125
+ * @param model The model name (e.g. `"gpt-5.4"`, `"o3"`, `"gpt-4.1"`).
126
+ * @returns `true` for reasoning-capable models — the o-series and the
127
+ * mainline gpt series from gpt-5 onward. `false` for models known *not* to
128
+ * reason: gpt-4.x and earlier, and the `gpt-5-chat` non-reasoning variant.
129
+ * `null` when the model is unrecognized and we can't tell either way.
130
+ */
131
+ export declare function _modelSupportsReasoning(model: string): boolean | null;
132
+ /** Options for creating the AsyncOpenAI client. */
133
+ export interface OpenAIResponsesClientOptions {
134
+ /** OpenAI API key. */
135
+ apiKey?: string | null;
136
+ /** Custom base URL for the API. */
137
+ baseUrl?: string | null;
138
+ /** OpenAI organization ID. */
139
+ organization?: string | null;
140
+ /** OpenAI project ID. */
141
+ project?: string | null;
142
+ /** Additional HTTP headers. */
143
+ defaultHeaders?: Record<string, string> | null;
144
+ }
145
+ export interface BaseOpenAIResponsesLLMServiceOptions extends LLMServiceOptions, OpenAIResponsesClientOptions {
146
+ /**
147
+ * Service tier to use: "auto", "default", "flex", "scale", "fast",
148
+ * "priority" or "ultrafast". "fast" is OpenAI's low-latency tier, the name
149
+ * that replaced "priority"; both values are accepted. "ultrafast" is the
150
+ * access-controlled Ultrafast Processing tier, which shortens the time
151
+ * between output tokens on the models that offer it.
152
+ */
153
+ serviceTier?: string | null;
154
+ /** Runtime-updatable settings. */
155
+ settings?: OpenAIResponsesLLMSettings | null;
156
+ /**
157
+ * How long an inference may go without producing output before it is
158
+ * abandoned and re-issued, when `retryOnTimeout` is set. Defaults to 5.0
159
+ * seconds.
160
+ */
161
+ retryTimeoutSecs?: number | null;
162
+ /**
163
+ * Whether to re-issue the request once if the first attempt produces no
164
+ * output within `retryTimeoutSecs`. The retry is unbounded.
165
+ */
166
+ retryOnTimeout?: boolean | null;
167
+ }
168
+ /** Accumulated data for one function call: name, call_id and arguments. */
169
+ export interface ResponsesFunctionCallData {
170
+ name: string;
171
+ call_id: string;
172
+ arguments: string;
173
+ }
174
+ /** Members a class gets from `BaseOpenAIResponsesLLMServiceMixin`. */
175
+ export interface BaseOpenAIResponsesLLMServiceMembers {
176
+ _apiKey: string | null;
177
+ _serviceTier: string | null;
178
+ _retryTimeoutSecs: number | null;
179
+ _retryOnTimeout: boolean | null;
180
+ _reasoningUnsupportedWarnedFor: string | null;
181
+ _client: OpenAI;
182
+ _fullModelName: string | null;
183
+ _createClient(options?: OpenAIResponsesClientOptions): OpenAI;
184
+ canGenerateMetrics(): boolean;
185
+ _buildResponseParams(invocationParams: OpenAIResponsesLLMInvocationParams): Dict;
186
+ runInference(context: LLMContext, options?: {
187
+ maxTokens?: number | null;
188
+ systemInstruction?: string | null;
189
+ responseSchema?: Record<string, unknown> | null;
190
+ }): Promise<string | null>;
191
+ _processFunctionCalls(context: LLMContext, functionCalls: Map<string, ResponsesFunctionCallData>): FunctionCallFromLLM[];
192
+ _maybeApplyThinkingDefault(params: Dict): void;
193
+ _warnIfReasoningUnsupported(): void;
194
+ _appendReasoningMessage(itemId: string | null, summary: Dict[], encryptedContent: string | null): Promise<void>;
195
+ }
196
+ /** Static members a class gets from `BaseOpenAIResponsesLLMServiceMixin`. */
197
+ export interface BaseOpenAIResponsesLLMServiceStatics {
198
+ Settings: typeof OpenAIResponsesLLMSettings;
199
+ ReasoningConfig: typeof OpenAIResponsesReasoningConfig;
200
+ supportsResponseSchema: boolean;
201
+ modelSupportsResponseSchema(model: string): boolean;
202
+ }
203
+ /**
204
+ * Shared base for HTTP and WebSocket OpenAI Responses API services.
205
+ *
206
+ * Contains settings, adapter reference, HTTP client creation, parameter
207
+ * building, `runInference`, and metrics support. Subclasses implement
208
+ * `processFrame` and `_processContext` for their transport.
209
+ *
210
+ * A mixin over an `LLMService` base: upstream's
211
+ * `class OpenAIResponsesLLMService(_BaseOpenAIResponsesLLMService, WebsocketLLMService)`
212
+ * is `class OpenAIResponsesLLMService extends BaseOpenAIResponsesLLMServiceMixin(WebsocketLLMService)`.
213
+ */
214
+ export declare const BaseOpenAIResponsesLLMServiceMixin: import("@pipedog/core/utils/mixin").Mixin<<B extends Ctor>(base: B) => B & Ctor<BaseOpenAIResponsesLLMServiceMembers> & BaseOpenAIResponsesLLMServiceStatics, BaseOpenAIResponsesLLMServiceMembers>;
215
+ declare const _BaseOpenAIResponsesLLMService_base: typeof LLMService & Ctor<BaseOpenAIResponsesLLMServiceMembers> & BaseOpenAIResponsesLLMServiceStatics;
216
+ /**
217
+ * Shared base for HTTP and WebSocket OpenAI Responses API services, as a
218
+ * plain class over `LLMService` (see `BaseOpenAIResponsesLLMServiceMixin`).
219
+ */
220
+ export declare class _BaseOpenAIResponsesLLMService extends _BaseOpenAIResponsesLLMService_base<ResponsesAdapter> {
221
+ protected _settings: OpenAIResponsesLLMSettings;
222
+ constructor(options?: BaseOpenAIResponsesLLMServiceOptions);
223
+ }
224
+ export interface OpenAIResponsesLLMServiceOptions extends BaseOpenAIResponsesLLMServiceOptions, WebsocketLLMServiceOptions {
225
+ /** Runtime-updatable settings. */
226
+ settings?: OpenAIResponsesLLMSettings | null;
227
+ /** WebSocket endpoint URL. Defaults to `wss://api.openai.com/v1/responses`. */
228
+ wsUrl?: string;
229
+ }
230
+ declare const OpenAIResponsesLLMService_base: typeof WebsocketLLMService & Ctor<BaseOpenAIResponsesLLMServiceMembers> & BaseOpenAIResponsesLLMServiceStatics;
231
+ /**
232
+ * OpenAI Responses API LLM service using WebSocket transport.
233
+ *
234
+ * Maintains a persistent WebSocket connection to
235
+ * `wss://api.openai.com/v1/responses` for lower-latency inference, especially
236
+ * beneficial for tool-call-heavy workflows. Automatically uses
237
+ * `previous_response_id` to send only incremental context when possible, and
238
+ * falls back to full context on reconnection or cache miss.
239
+ *
240
+ * The `previous_response_id` optimization works with `store=false` (the
241
+ * default) because WebSocket mode uses a connection-local in-memory cache —
242
+ * no conversations are stored on OpenAI's servers. This is why the HTTP
243
+ * variant (`OpenAIResponsesHttpLLMService`) does not offer this optimization
244
+ * by default (or at all, yet): over HTTP, `previous_response_id` requires
245
+ * `store=true`, which enables OpenAI-side 30-day conversation storage.
246
+ *
247
+ * This is the recommended variant for real-time / conversational use.
248
+ *
249
+ * @example
250
+ * const llm = new OpenAIResponsesLLMService({
251
+ * apiKey: getEnv("OPENAI_API_KEY"),
252
+ * settings: new OpenAIResponsesLLMService.Settings({
253
+ * systemInstruction: "You are a helpful assistant.",
254
+ * }),
255
+ * });
256
+ */
257
+ export declare class OpenAIResponsesLLMService extends OpenAIResponsesLLMService_base<ResponsesAdapter> {
258
+ protected _settings: OpenAIResponsesLLMSettings;
259
+ protected _wsUrl: string;
260
+ protected _previousResponseId: string | null;
261
+ protected _previousInputHash: string | null;
262
+ protected _previousInputLength: number | null;
263
+ protected _previousResponseOutput: Dict[] | null;
264
+ protected _currentResponseId: string | null;
265
+ protected _cancelPendingResponse: boolean;
266
+ protected _needsDrain: boolean;
267
+ /**
268
+ * Initialize the WebSocket-based OpenAI Responses API LLM service.
269
+ *
270
+ * @param options.wsUrl WebSocket endpoint URL. Defaults to
271
+ * `wss://api.openai.com/v1/responses`.
272
+ * Other options are passed to the base class (apiKey, baseUrl,
273
+ * organization, project, defaultHeaders, serviceTier, settings, etc.).
274
+ */
275
+ constructor(options?: OpenAIResponsesLLMServiceOptions);
276
+ /** Establish the WebSocket connection. */
277
+ _connectWebsocket(): Promise<void>;
278
+ /** Close the WebSocket connection and clear state. */
279
+ _disconnectWebsocket(): Promise<void>;
280
+ /** Release resources at teardown. */
281
+ cleanup(): Promise<void>;
282
+ /**
283
+ * Compute a deterministic hash of input items for comparison.
284
+ *
285
+ * @param items List of Responses API input items.
286
+ * @returns Hex digest of the SHA-256 hash.
287
+ */
288
+ static _hashInputItems(items: unknown[]): Promise<string>;
289
+ /**
290
+ * Try to use previous_response_id to send only new input items.
291
+ *
292
+ * If the prefix of `fullInput` matches the stored hash from the previous
293
+ * inference call, only new items are sent along with
294
+ * `previous_response_id`. Otherwise the full input is sent.
295
+ *
296
+ * @param params The response params dict (modified in place).
297
+ * @param fullInput The complete input items list from the adapter.
298
+ * @returns The (possibly modified) params dict.
299
+ */
300
+ protected _applyPreviousResponseOptimization(params: Dict, fullInput: Dict[]): Promise<Dict>;
301
+ /**
302
+ * Check whether `items` begins with entries that match `responseOutput`.
303
+ *
304
+ * When using `previous_response_id`, the server already knows its own
305
+ * output. After confirming that the input prefix matches what we
306
+ * previously sent, this method checks whether the items immediately
307
+ * following that prefix correspond to the server's response output. If
308
+ * they do, those items can be skipped so we send only the truly new items
309
+ * (user messages, tool results, etc.).
310
+ *
311
+ * For messages, the comparison checks role and text content (extracting
312
+ * text from the output's `output_text` content parts and comparing against
313
+ * the input's content). For function calls, it matches by `call_id`. This
314
+ * avoids requiring exact format equality while still confirming the items
315
+ * represent the same data. If the match fails for any reason, the caller
316
+ * falls back to sending the full context.
317
+ *
318
+ * @param items The input items following the matched prefix.
319
+ * @param responseOutput Raw `output` array from the previous
320
+ * `response.completed` event.
321
+ * @returns True if the leading items correspond to the response output.
322
+ */
323
+ static _startsWithResponseOutput(items: Dict[], responseOutput: Dict[]): boolean;
324
+ /**
325
+ * Store state for the next call's previous_response_id optimization.
326
+ *
327
+ * @param responseId The response ID returned by the server.
328
+ * @param fullInput The complete input items list that was sent.
329
+ * @param responseOutput Raw `output` array from the `response.completed`
330
+ * event, stored for loose comparison on the next call.
331
+ */
332
+ protected _storePreviousResponseState(responseId: string, fullInput: Dict[], responseOutput: Dict[]): Promise<void>;
333
+ /** Clear stored previous_response_id state. */
334
+ protected _clearPreviousResponseState(): void;
335
+ /** Clear response cancellation tracking state. */
336
+ protected _clearCancellationState(): void;
337
+ /**
338
+ * Drain events from a cancelled response before starting a new one.
339
+ *
340
+ * After a cancellation, the WebSocket may still have in-flight events from
341
+ * the cancelled response. We must drain them before sending a new
342
+ * `response.create` — we can't simply filter them inline because the API
343
+ * doesn't provide a reliable way to correlate events to a specific
344
+ * response (e.g. delta events carry neither a `response_id` nor any
345
+ * intermediary identifier that could be traced back to one).
346
+ *
347
+ * This method reads and discards events until a terminal event
348
+ * (`response.completed`, `response.failed`, or `response.incomplete`)
349
+ * arrives, ensuring the connection is clean. If draining times out or the
350
+ * connection drops, clears cancellation state and returns —
351
+ * `_ensureConnected` will handle reconnection before the next inference.
352
+ */
353
+ protected _drainCancelledResponse(): Promise<void>;
354
+ /**
355
+ * Process frames for LLM completion requests.
356
+ *
357
+ * @param frame The frame to process.
358
+ * @param direction The direction of frame processing.
359
+ */
360
+ processFrame(frame: Frame, direction: FrameDirection): Promise<void>;
361
+ /**
362
+ * Run inference over WebSocket with retry and previous_response_id.
363
+ *
364
+ * Tries once with the `previous_response_id` optimization. On a retriable
365
+ * error (cache miss, connection limit, connection drop, or — when
366
+ * `retryOnTimeout` is set — a response that produces no output in time),
367
+ * clears state and retries once with the full context and no timeout.
368
+ * Transport-level `ConnectionClosed` errors are handled transparently by
369
+ * `_wsSend`/`_wsRecv` (auto-reconnect → `WebsocketReconnectedError`).
370
+ *
371
+ * Traced with `tracedLlm` (see the static block).
372
+ *
373
+ * @param context The LLM context containing conversation history.
374
+ */
375
+ protected _processContext(context: LLMContext): Promise<void>;
376
+ /** Report the token usage of a response received over the WebSocket. */
377
+ protected _reportEventUsage(usage: Dict | null | undefined): Promise<void>;
378
+ /**
379
+ * Receive and process WebSocket events until the response completes.
380
+ *
381
+ * @param context The LLM context for the current inference.
382
+ * @param fullInput The complete input items list (for storing state on
383
+ * success).
384
+ * @param outputTimeoutSecs How long to wait for the response to start
385
+ * producing output before raising `_ResponseTimeoutError`. Once the first
386
+ * output event arrives the wait becomes unbounded, since by then content
387
+ * is already on its way downstream and re-issuing would duplicate it.
388
+ * null waits indefinitely throughout.
389
+ * @throws _PreviousResponseNotFoundError Server couldn't find previous response.
390
+ * @throws _ConnectionLimitReachedError 60-minute connection limit reached.
391
+ * @throws _ResponseTimeoutError Response produced no output in time.
392
+ * @throws WebsocketReconnectedError Connection was lost and auto-recovered.
393
+ * @throws ConnectionClosed Connection was lost and could not be recovered.
394
+ */
395
+ protected _receiveResponseEvents(context: LLMContext, fullInput: Dict[], outputTimeoutSecs?: number | null): Promise<void>;
396
+ }
397
+ /** A streamed Responses API event (`openai.types.responses.ResponseStreamEvent`). */
398
+ export type ResponseStreamEvent = OpenAI.Responses.ResponseStreamEvent;
399
+ /** A Responses API usage (`openai.types.responses.ResponseUsage`). */
400
+ export type ResponseUsage = OpenAI.Responses.ResponseUsage;
401
+ /** The async stream of events returned by a streaming Responses API call. */
402
+ export type ResponseStream = AsyncIterable<ResponseStreamEvent> & {
403
+ controller?: AbortController;
404
+ };
405
+ /**
406
+ * OpenAI Responses API LLM service using HTTP streaming transport.
407
+ *
408
+ * Uses server-sent events (SSE) via the OpenAI SDK for streaming inference.
409
+ * Each `_processContext` call opens a new HTTP connection.
410
+ *
411
+ * Unlike the WebSocket variant, this service does not use
412
+ * `previous_response_id` for incremental context delivery by default (or at
413
+ * all, yet). Over HTTP, `previous_response_id` requires `store=true`, which
414
+ * enables OpenAI-side 30-day conversation storage — a privacy/compliance
415
+ * tradeoff that many users won't want. The WebSocket variant avoids this
416
+ * because its `previous_response_id` uses a connection-local in-memory cache
417
+ * that works with `store=false` (nothing is stored long-term).
418
+ *
419
+ * @example
420
+ * const llm = new OpenAIResponsesHttpLLMService({
421
+ * apiKey: getEnv("OPENAI_API_KEY"),
422
+ * settings: new OpenAIResponsesHttpLLMService.Settings({
423
+ * systemInstruction: "You are a helpful assistant.",
424
+ * }),
425
+ * });
426
+ */
427
+ export declare class OpenAIResponsesHttpLLMService extends _BaseOpenAIResponsesLLMService {
428
+ /**
429
+ * Process frames for LLM completion requests.
430
+ *
431
+ * @param frame The frame to process.
432
+ * @param direction The direction of frame processing.
433
+ */
434
+ processFrame(frame: Frame, direction: FrameDirection): Promise<void>;
435
+ /** Report a response's token usage, if it carries any. */
436
+ protected _reportUsage(usage: ResponseUsage | null | undefined): Promise<void>;
437
+ /**
438
+ * Open a streaming Responses API request, retrying once on timeout.
439
+ *
440
+ * @param params Parameters for the Responses API call.
441
+ * @returns Async stream of response events.
442
+ */
443
+ protected _createStream(params: Dict): Promise<ResponseStream>;
444
+ /** Traced with `tracedLlm` (see the static block). */
445
+ protected _processContext(context: LLMContext): Promise<void>;
446
+ }
447
+ export {};
448
+ //# sourceMappingURL=llm.d.ts.map