@ai-sdk/openai 4.0.69 → 4.0.70

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.
@@ -491,11 +491,7 @@ type OpenAIResponsesUserMessage = {
491
491
  type OpenAIResponsesAssistantMessage = {
492
492
  type?: 'message';
493
493
  role: 'assistant';
494
- content: Array<{
495
- type: 'output_text';
496
- text: string;
497
- }>;
498
- id?: string;
494
+ content: string;
499
495
  phase?: 'commentary' | 'final_answer' | null;
500
496
  };
501
497
  type OpenAIResponsesFunctionCall = {
@@ -523,6 +519,12 @@ type OpenAIResponsesFunctionCallOutput = {
523
519
  prompt_cache_breakpoint?: {
524
520
  mode: 'explicit';
525
521
  };
522
+ } | {
523
+ type: 'input_image';
524
+ file_id: string;
525
+ prompt_cache_breakpoint?: {
526
+ mode: 'explicit';
527
+ };
526
528
  } | {
527
529
  type: 'input_file';
528
530
  filename: string;
@@ -536,6 +538,12 @@ type OpenAIResponsesFunctionCallOutput = {
536
538
  prompt_cache_breakpoint?: {
537
539
  mode: 'explicit';
538
540
  };
541
+ } | {
542
+ type: 'input_file';
543
+ file_id: string;
544
+ prompt_cache_breakpoint?: {
545
+ mode: 'explicit';
546
+ };
539
547
  }>;
540
548
  caller?: OpenAIResponsesToolCaller;
541
549
  };
@@ -3856,6 +3856,29 @@ async function convertFunctionToolResultOutput({
3856
3856
  case "file": {
3857
3857
  const topLevel = getTopLevelMediaType2(item.mediaType);
3858
3858
  const imageDetail = (_b = (_a3 = item.providerOptions) == null ? void 0 : _a3[providerOptionsName]) == null ? void 0 : _b.imageDetail;
3859
+ if (item.data.type === "reference") {
3860
+ const fileId = resolveProviderReference2({
3861
+ reference: item.data.reference,
3862
+ provider: providerOptionsName
3863
+ });
3864
+ if (topLevel === "image") {
3865
+ return {
3866
+ type: "input_image",
3867
+ file_id: fileId,
3868
+ detail: imageDetail,
3869
+ ...promptCacheBreakpoint2 != null && {
3870
+ prompt_cache_breakpoint: promptCacheBreakpoint2
3871
+ }
3872
+ };
3873
+ }
3874
+ return {
3875
+ type: "input_file",
3876
+ file_id: fileId,
3877
+ ...promptCacheBreakpoint2 != null && {
3878
+ prompt_cache_breakpoint: promptCacheBreakpoint2
3879
+ }
3880
+ };
3881
+ }
3859
3882
  if (item.data.type === "data") {
3860
3883
  const fullMediaType = resolveFullMediaType2({ part: item });
3861
3884
  if (topLevel === "image") {
@@ -4196,8 +4219,7 @@ async function convertToOpenAIResponsesInput({
4196
4219
  input.push({
4197
4220
  ...explicitMessageItemType && { type: "message" },
4198
4221
  role: "assistant",
4199
- content: [{ type: "output_text", text: part.text }],
4200
- id,
4222
+ content: part.text,
4201
4223
  ...phase != null && { phase }
4202
4224
  });
4203
4225
  break;