@ai-sdk/openai 2.0.37 → 2.0.39

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.
@@ -1,4 +1,5 @@
1
1
  import { LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2CallOptions, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
2
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
3
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
4
  import { z } from 'zod/v4';
4
5
 
@@ -247,4 +248,214 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
247
248
  }, z.core.$strip>;
248
249
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
249
250
 
250
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
251
+ declare const codeInterpreterInputSchema: z.ZodObject<{
252
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
253
+ containerId: z.ZodString;
254
+ }, z.core.$strip>;
255
+ declare const codeInterpreterOutputSchema: z.ZodObject<{
256
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
257
+ type: z.ZodLiteral<"logs">;
258
+ logs: z.ZodString;
259
+ }, z.core.$strip>, z.ZodObject<{
260
+ type: z.ZodLiteral<"image">;
261
+ url: z.ZodString;
262
+ }, z.core.$strip>]>>>>;
263
+ }, z.core.$strip>;
264
+ declare const codeInterpreterArgsSchema: z.ZodObject<{
265
+ container: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
266
+ fileIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
267
+ }, z.core.$strip>]>>;
268
+ }, z.core.$strip>;
269
+ type CodeInterpreterArgs = {
270
+ /**
271
+ * The code interpreter container.
272
+ * Can be a container ID
273
+ * or an object that specifies uploaded file IDs to make available to your code.
274
+ */
275
+ container?: string | {
276
+ fileIds?: string[];
277
+ };
278
+ };
279
+ declare const codeInterpreterToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
280
+ /**
281
+ * The code to run, or null if not available.
282
+ */
283
+ code?: string | null;
284
+ /**
285
+ * The ID of the container used to run the code.
286
+ */
287
+ containerId: string;
288
+ }, {
289
+ /**
290
+ * The outputs generated by the code interpreter, such as logs or images.
291
+ * Can be null if no outputs are available.
292
+ */
293
+ outputs?: Array<{
294
+ type: "logs";
295
+ /**
296
+ * The logs output from the code interpreter.
297
+ */
298
+ logs: string;
299
+ } | {
300
+ type: "image";
301
+ /**
302
+ * The URL of the image output from the code interpreter.
303
+ */
304
+ url: string;
305
+ }> | null;
306
+ }, CodeInterpreterArgs>;
307
+ declare const codeInterpreter: (args?: CodeInterpreterArgs) => _ai_sdk_provider_utils.Tool<{
308
+ /**
309
+ * The code to run, or null if not available.
310
+ */
311
+ code?: string | null;
312
+ /**
313
+ * The ID of the container used to run the code.
314
+ */
315
+ containerId: string;
316
+ }, {
317
+ /**
318
+ * The outputs generated by the code interpreter, such as logs or images.
319
+ * Can be null if no outputs are available.
320
+ */
321
+ outputs?: Array<{
322
+ type: "logs";
323
+ /**
324
+ * The logs output from the code interpreter.
325
+ */
326
+ logs: string;
327
+ } | {
328
+ type: "image";
329
+ /**
330
+ * The URL of the image output from the code interpreter.
331
+ */
332
+ url: string;
333
+ }> | null;
334
+ }>;
335
+
336
+ /**
337
+ * A filter used to compare a specified attribute key to a given value using a defined comparison operation.
338
+ */
339
+ type OpenAIResponsesFileSearchToolComparisonFilter = {
340
+ /**
341
+ * The key to compare against the value.
342
+ */
343
+ key: string;
344
+ /**
345
+ * Specifies the comparison operator: eq, ne, gt, gte, lt, lte.
346
+ */
347
+ type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
348
+ /**
349
+ * The value to compare against the attribute key; supports string, number, or boolean types.
350
+ */
351
+ value: string | number | boolean;
352
+ };
353
+ /**
354
+ * Combine multiple filters using and or or.
355
+ */
356
+ type OpenAIResponsesFileSearchToolCompoundFilter = {
357
+ /**
358
+ * Type of operation: and or or.
359
+ */
360
+ type: 'and' | 'or';
361
+ /**
362
+ * Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.
363
+ */
364
+ filters: Array<OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter>;
365
+ };
366
+
367
+ declare const fileSearchArgsSchema: z.ZodObject<{
368
+ vectorStoreIds: z.ZodArray<z.ZodString>;
369
+ maxNumResults: z.ZodOptional<z.ZodNumber>;
370
+ ranking: z.ZodOptional<z.ZodObject<{
371
+ ranker: z.ZodOptional<z.ZodString>;
372
+ scoreThreshold: z.ZodOptional<z.ZodNumber>;
373
+ }, z.core.$strip>>;
374
+ filters: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
375
+ key: z.ZodString;
376
+ type: z.ZodEnum<{
377
+ lt: "lt";
378
+ ne: "ne";
379
+ eq: "eq";
380
+ gt: "gt";
381
+ gte: "gte";
382
+ lte: "lte";
383
+ }>;
384
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
385
+ }, z.core.$strip>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>]>>;
386
+ }, z.core.$strip>;
387
+ declare const fileSearchOutputSchema: z.ZodObject<{
388
+ queries: z.ZodArray<z.ZodString>;
389
+ results: z.ZodNullable<z.ZodArray<z.ZodObject<{
390
+ attributes: z.ZodRecord<z.ZodString, z.ZodUnknown>;
391
+ fileId: z.ZodString;
392
+ filename: z.ZodString;
393
+ score: z.ZodNumber;
394
+ text: z.ZodString;
395
+ }, z.core.$strip>>>;
396
+ }, z.core.$strip>;
397
+ declare const fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
398
+ /**
399
+ * The search query to execute.
400
+ */
401
+ queries: string[];
402
+ /**
403
+ * The results of the file search tool call.
404
+ */
405
+ results: null | {
406
+ /**
407
+ * Set of 16 key-value pairs that can be attached to an object.
408
+ * This can be useful for storing additional information about the object
409
+ * in a structured format, and querying for objects via API or the dashboard.
410
+ * Keys are strings with a maximum length of 64 characters.
411
+ * Values are strings with a maximum length of 512 characters, booleans, or numbers.
412
+ */
413
+ attributes: Record<string, unknown>;
414
+ /**
415
+ * The unique ID of the file.
416
+ */
417
+ fileId: string;
418
+ /**
419
+ * The name of the file.
420
+ */
421
+ filename: string;
422
+ /**
423
+ * The relevance score of the file - a value between 0 and 1.
424
+ */
425
+ score: number;
426
+ /**
427
+ * The text that was retrieved from the file.
428
+ */
429
+ text: string;
430
+ }[];
431
+ }, {
432
+ /**
433
+ * List of vector store IDs to search through.
434
+ */
435
+ vectorStoreIds: string[];
436
+ /**
437
+ * Maximum number of search results to return. Defaults to 10.
438
+ */
439
+ maxNumResults?: number;
440
+ /**
441
+ * Ranking options for the search.
442
+ */
443
+ ranking?: {
444
+ /**
445
+ * The ranker to use for the file search.
446
+ */
447
+ ranker?: string;
448
+ /**
449
+ * The score threshold for the file search, a number between 0 and 1.
450
+ * Numbers closer to 1 will attempt to return only the most relevant results,
451
+ * but may return fewer results.
452
+ */
453
+ scoreThreshold?: number;
454
+ };
455
+ /**
456
+ * A filter to apply.
457
+ */
458
+ filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
459
+ }>;
460
+
461
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
@@ -1,4 +1,5 @@
1
1
  import { LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2CallOptions, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
2
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
3
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
4
  import { z } from 'zod/v4';
4
5
 
@@ -247,4 +248,214 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
247
248
  }, z.core.$strip>;
248
249
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
249
250
 
250
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
251
+ declare const codeInterpreterInputSchema: z.ZodObject<{
252
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
253
+ containerId: z.ZodString;
254
+ }, z.core.$strip>;
255
+ declare const codeInterpreterOutputSchema: z.ZodObject<{
256
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
257
+ type: z.ZodLiteral<"logs">;
258
+ logs: z.ZodString;
259
+ }, z.core.$strip>, z.ZodObject<{
260
+ type: z.ZodLiteral<"image">;
261
+ url: z.ZodString;
262
+ }, z.core.$strip>]>>>>;
263
+ }, z.core.$strip>;
264
+ declare const codeInterpreterArgsSchema: z.ZodObject<{
265
+ container: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
266
+ fileIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
267
+ }, z.core.$strip>]>>;
268
+ }, z.core.$strip>;
269
+ type CodeInterpreterArgs = {
270
+ /**
271
+ * The code interpreter container.
272
+ * Can be a container ID
273
+ * or an object that specifies uploaded file IDs to make available to your code.
274
+ */
275
+ container?: string | {
276
+ fileIds?: string[];
277
+ };
278
+ };
279
+ declare const codeInterpreterToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
280
+ /**
281
+ * The code to run, or null if not available.
282
+ */
283
+ code?: string | null;
284
+ /**
285
+ * The ID of the container used to run the code.
286
+ */
287
+ containerId: string;
288
+ }, {
289
+ /**
290
+ * The outputs generated by the code interpreter, such as logs or images.
291
+ * Can be null if no outputs are available.
292
+ */
293
+ outputs?: Array<{
294
+ type: "logs";
295
+ /**
296
+ * The logs output from the code interpreter.
297
+ */
298
+ logs: string;
299
+ } | {
300
+ type: "image";
301
+ /**
302
+ * The URL of the image output from the code interpreter.
303
+ */
304
+ url: string;
305
+ }> | null;
306
+ }, CodeInterpreterArgs>;
307
+ declare const codeInterpreter: (args?: CodeInterpreterArgs) => _ai_sdk_provider_utils.Tool<{
308
+ /**
309
+ * The code to run, or null if not available.
310
+ */
311
+ code?: string | null;
312
+ /**
313
+ * The ID of the container used to run the code.
314
+ */
315
+ containerId: string;
316
+ }, {
317
+ /**
318
+ * The outputs generated by the code interpreter, such as logs or images.
319
+ * Can be null if no outputs are available.
320
+ */
321
+ outputs?: Array<{
322
+ type: "logs";
323
+ /**
324
+ * The logs output from the code interpreter.
325
+ */
326
+ logs: string;
327
+ } | {
328
+ type: "image";
329
+ /**
330
+ * The URL of the image output from the code interpreter.
331
+ */
332
+ url: string;
333
+ }> | null;
334
+ }>;
335
+
336
+ /**
337
+ * A filter used to compare a specified attribute key to a given value using a defined comparison operation.
338
+ */
339
+ type OpenAIResponsesFileSearchToolComparisonFilter = {
340
+ /**
341
+ * The key to compare against the value.
342
+ */
343
+ key: string;
344
+ /**
345
+ * Specifies the comparison operator: eq, ne, gt, gte, lt, lte.
346
+ */
347
+ type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
348
+ /**
349
+ * The value to compare against the attribute key; supports string, number, or boolean types.
350
+ */
351
+ value: string | number | boolean;
352
+ };
353
+ /**
354
+ * Combine multiple filters using and or or.
355
+ */
356
+ type OpenAIResponsesFileSearchToolCompoundFilter = {
357
+ /**
358
+ * Type of operation: and or or.
359
+ */
360
+ type: 'and' | 'or';
361
+ /**
362
+ * Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.
363
+ */
364
+ filters: Array<OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter>;
365
+ };
366
+
367
+ declare const fileSearchArgsSchema: z.ZodObject<{
368
+ vectorStoreIds: z.ZodArray<z.ZodString>;
369
+ maxNumResults: z.ZodOptional<z.ZodNumber>;
370
+ ranking: z.ZodOptional<z.ZodObject<{
371
+ ranker: z.ZodOptional<z.ZodString>;
372
+ scoreThreshold: z.ZodOptional<z.ZodNumber>;
373
+ }, z.core.$strip>>;
374
+ filters: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
375
+ key: z.ZodString;
376
+ type: z.ZodEnum<{
377
+ lt: "lt";
378
+ ne: "ne";
379
+ eq: "eq";
380
+ gt: "gt";
381
+ gte: "gte";
382
+ lte: "lte";
383
+ }>;
384
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
385
+ }, z.core.$strip>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>]>>;
386
+ }, z.core.$strip>;
387
+ declare const fileSearchOutputSchema: z.ZodObject<{
388
+ queries: z.ZodArray<z.ZodString>;
389
+ results: z.ZodNullable<z.ZodArray<z.ZodObject<{
390
+ attributes: z.ZodRecord<z.ZodString, z.ZodUnknown>;
391
+ fileId: z.ZodString;
392
+ filename: z.ZodString;
393
+ score: z.ZodNumber;
394
+ text: z.ZodString;
395
+ }, z.core.$strip>>>;
396
+ }, z.core.$strip>;
397
+ declare const fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
398
+ /**
399
+ * The search query to execute.
400
+ */
401
+ queries: string[];
402
+ /**
403
+ * The results of the file search tool call.
404
+ */
405
+ results: null | {
406
+ /**
407
+ * Set of 16 key-value pairs that can be attached to an object.
408
+ * This can be useful for storing additional information about the object
409
+ * in a structured format, and querying for objects via API or the dashboard.
410
+ * Keys are strings with a maximum length of 64 characters.
411
+ * Values are strings with a maximum length of 512 characters, booleans, or numbers.
412
+ */
413
+ attributes: Record<string, unknown>;
414
+ /**
415
+ * The unique ID of the file.
416
+ */
417
+ fileId: string;
418
+ /**
419
+ * The name of the file.
420
+ */
421
+ filename: string;
422
+ /**
423
+ * The relevance score of the file - a value between 0 and 1.
424
+ */
425
+ score: number;
426
+ /**
427
+ * The text that was retrieved from the file.
428
+ */
429
+ text: string;
430
+ }[];
431
+ }, {
432
+ /**
433
+ * List of vector store IDs to search through.
434
+ */
435
+ vectorStoreIds: string[];
436
+ /**
437
+ * Maximum number of search results to return. Defaults to 10.
438
+ */
439
+ maxNumResults?: number;
440
+ /**
441
+ * Ranking options for the search.
442
+ */
443
+ ranking?: {
444
+ /**
445
+ * The ranker to use for the file search.
446
+ */
447
+ ranker?: string;
448
+ /**
449
+ * The score threshold for the file search, a number between 0 and 1.
450
+ * Numbers closer to 1 will attempt to return only the most relevant results,
451
+ * but may return fewer results.
452
+ */
453
+ scoreThreshold?: number;
454
+ };
455
+ /**
456
+ * A filter to apply.
457
+ */
458
+ filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
459
+ }>;
460
+
461
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
@@ -27,6 +27,14 @@ __export(internal_exports, {
27
27
  OpenAIResponsesLanguageModel: () => OpenAIResponsesLanguageModel,
28
28
  OpenAISpeechModel: () => OpenAISpeechModel,
29
29
  OpenAITranscriptionModel: () => OpenAITranscriptionModel,
30
+ codeInterpreter: () => codeInterpreter,
31
+ codeInterpreterArgsSchema: () => codeInterpreterArgsSchema,
32
+ codeInterpreterInputSchema: () => codeInterpreterInputSchema,
33
+ codeInterpreterOutputSchema: () => codeInterpreterOutputSchema,
34
+ codeInterpreterToolFactory: () => codeInterpreterToolFactory,
35
+ fileSearch: () => fileSearch,
36
+ fileSearchArgsSchema: () => fileSearchArgsSchema,
37
+ fileSearchOutputSchema: () => fileSearchOutputSchema,
30
38
  hasDefaultResponseFormat: () => hasDefaultResponseFormat,
31
39
  modelMaxImagesPerCall: () => modelMaxImagesPerCall,
32
40
  openAITranscriptionProviderOptions: () => openAITranscriptionProviderOptions,
@@ -2137,6 +2145,7 @@ async function convertToOpenAIResponsesInput({
2137
2145
  });
2138
2146
  break;
2139
2147
  }
2148
+ // assistant tool result parts are from provider-executed tools:
2140
2149
  case "tool-result": {
2141
2150
  if (store) {
2142
2151
  input.push({ type: "item_reference", id: part.toolCallId });
@@ -2289,6 +2298,9 @@ var codeInterpreterToolFactory = (0, import_provider_utils10.createProviderDefin
2289
2298
  inputSchema: codeInterpreterInputSchema,
2290
2299
  outputSchema: codeInterpreterOutputSchema
2291
2300
  });
2301
+ var codeInterpreter = (args = {}) => {
2302
+ return codeInterpreterToolFactory(args);
2303
+ };
2292
2304
 
2293
2305
  // src/tool/file-search.ts
2294
2306
  var import_provider_utils11 = require("@ai-sdk/provider-utils");
@@ -3256,6 +3268,24 @@ var OpenAIResponsesLanguageModel = class {
3256
3268
  id: value.item.id,
3257
3269
  toolName: "computer_use"
3258
3270
  });
3271
+ } else if (value.item.type === "code_interpreter_call") {
3272
+ ongoingToolCalls[value.output_index] = {
3273
+ toolName: "code_interpreter",
3274
+ toolCallId: value.item.id,
3275
+ codeInterpreter: {
3276
+ containerId: value.item.container_id
3277
+ }
3278
+ };
3279
+ controller.enqueue({
3280
+ type: "tool-input-start",
3281
+ id: value.item.id,
3282
+ toolName: "code_interpreter"
3283
+ });
3284
+ controller.enqueue({
3285
+ type: "tool-input-delta",
3286
+ id: value.item.id,
3287
+ delta: `{"containerId":"${value.item.container_id}","code":"`
3288
+ });
3259
3289
  } else if (value.item.type === "file_search_call") {
3260
3290
  controller.enqueue({
3261
3291
  type: "tool-call",
@@ -3379,16 +3409,7 @@ var OpenAIResponsesLanguageModel = class {
3379
3409
  providerExecuted: true
3380
3410
  });
3381
3411
  } else if (value.item.type === "code_interpreter_call") {
3382
- controller.enqueue({
3383
- type: "tool-call",
3384
- toolCallId: value.item.id,
3385
- toolName: "code_interpreter",
3386
- input: JSON.stringify({
3387
- code: value.item.code,
3388
- containerId: value.item.container_id
3389
- }),
3390
- providerExecuted: true
3391
- });
3412
+ ongoingToolCalls[value.output_index] = void 0;
3392
3413
  controller.enqueue({
3393
3414
  type: "tool-result",
3394
3415
  toolCallId: value.item.id,
@@ -3438,6 +3459,40 @@ var OpenAIResponsesLanguageModel = class {
3438
3459
  delta: value.delta
3439
3460
  });
3440
3461
  }
3462
+ } else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
3463
+ const toolCall = ongoingToolCalls[value.output_index];
3464
+ if (toolCall != null) {
3465
+ controller.enqueue({
3466
+ type: "tool-input-delta",
3467
+ id: toolCall.toolCallId,
3468
+ // The delta is code, which is embedding in a JSON string.
3469
+ // To escape it, we use JSON.stringify and slice to remove the outer quotes.
3470
+ delta: JSON.stringify(value.delta).slice(1, -1)
3471
+ });
3472
+ }
3473
+ } else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
3474
+ const toolCall = ongoingToolCalls[value.output_index];
3475
+ if (toolCall != null) {
3476
+ controller.enqueue({
3477
+ type: "tool-input-delta",
3478
+ id: toolCall.toolCallId,
3479
+ delta: '"}'
3480
+ });
3481
+ controller.enqueue({
3482
+ type: "tool-input-end",
3483
+ id: toolCall.toolCallId
3484
+ });
3485
+ controller.enqueue({
3486
+ type: "tool-call",
3487
+ toolCallId: toolCall.toolCallId,
3488
+ toolName: "code_interpreter",
3489
+ input: JSON.stringify({
3490
+ code: value.code,
3491
+ containerId: toolCall.codeInterpreter.containerId
3492
+ }),
3493
+ providerExecuted: true
3494
+ });
3495
+ }
3441
3496
  } else if (isResponseCreatedChunk(value)) {
3442
3497
  responseId = value.response.id;
3443
3498
  controller.enqueue({
@@ -3621,6 +3676,19 @@ var responseOutputItemAddedSchema = import_v418.z.object({
3621
3676
  import_v418.z.object({
3622
3677
  type: import_v418.z.literal("image_generation_call"),
3623
3678
  id: import_v418.z.string()
3679
+ }),
3680
+ import_v418.z.object({
3681
+ type: import_v418.z.literal("code_interpreter_call"),
3682
+ id: import_v418.z.string(),
3683
+ container_id: import_v418.z.string(),
3684
+ code: import_v418.z.string().nullable(),
3685
+ outputs: import_v418.z.array(
3686
+ import_v418.z.discriminatedUnion("type", [
3687
+ import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
3688
+ import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
3689
+ ])
3690
+ ).nullable(),
3691
+ status: import_v418.z.string()
3624
3692
  })
3625
3693
  ])
3626
3694
  });
@@ -3662,6 +3730,18 @@ var responseFunctionCallArgumentsDeltaSchema = import_v418.z.object({
3662
3730
  output_index: import_v418.z.number(),
3663
3731
  delta: import_v418.z.string()
3664
3732
  });
3733
+ var responseCodeInterpreterCallCodeDeltaSchema = import_v418.z.object({
3734
+ type: import_v418.z.literal("response.code_interpreter_call_code.delta"),
3735
+ item_id: import_v418.z.string(),
3736
+ output_index: import_v418.z.number(),
3737
+ delta: import_v418.z.string()
3738
+ });
3739
+ var responseCodeInterpreterCallCodeDoneSchema = import_v418.z.object({
3740
+ type: import_v418.z.literal("response.code_interpreter_call_code.done"),
3741
+ item_id: import_v418.z.string(),
3742
+ output_index: import_v418.z.number(),
3743
+ code: import_v418.z.string()
3744
+ });
3665
3745
  var responseAnnotationAddedSchema = import_v418.z.object({
3666
3746
  type: import_v418.z.literal("response.output_text.annotation.added"),
3667
3747
  annotation: import_v418.z.discriminatedUnion("type", [
@@ -3699,6 +3779,8 @@ var openaiResponsesChunkSchema = import_v418.z.union([
3699
3779
  responseOutputItemAddedSchema,
3700
3780
  responseOutputItemDoneSchema,
3701
3781
  responseFunctionCallArgumentsDeltaSchema,
3782
+ responseCodeInterpreterCallCodeDeltaSchema,
3783
+ responseCodeInterpreterCallCodeDoneSchema,
3702
3784
  responseAnnotationAddedSchema,
3703
3785
  responseReasoningSummaryPartAddedSchema,
3704
3786
  responseReasoningSummaryTextDeltaSchema,
@@ -3724,6 +3806,12 @@ function isResponseCreatedChunk(chunk) {
3724
3806
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
3725
3807
  return chunk.type === "response.function_call_arguments.delta";
3726
3808
  }
3809
+ function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
3810
+ return chunk.type === "response.code_interpreter_call_code.delta";
3811
+ }
3812
+ function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
3813
+ return chunk.type === "response.code_interpreter_call_code.done";
3814
+ }
3727
3815
  function isResponseOutputItemAddedChunk(chunk) {
3728
3816
  return chunk.type === "response.output_item.added";
3729
3817
  }
@@ -3826,6 +3914,14 @@ var openaiResponsesProviderOptionsSchema = import_v418.z.object({
3826
3914
  OpenAIResponsesLanguageModel,
3827
3915
  OpenAISpeechModel,
3828
3916
  OpenAITranscriptionModel,
3917
+ codeInterpreter,
3918
+ codeInterpreterArgsSchema,
3919
+ codeInterpreterInputSchema,
3920
+ codeInterpreterOutputSchema,
3921
+ codeInterpreterToolFactory,
3922
+ fileSearch,
3923
+ fileSearchArgsSchema,
3924
+ fileSearchOutputSchema,
3829
3925
  hasDefaultResponseFormat,
3830
3926
  modelMaxImagesPerCall,
3831
3927
  openAITranscriptionProviderOptions,