@ai-sdk/openai 2.0.50 → 2.0.52
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.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +64 -3
- package/dist/index.d.ts +64 -3
- package/dist/index.js +109 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +111 -97
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +107 -91
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +111 -95
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.js
CHANGED
|
@@ -2356,6 +2356,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2356
2356
|
input.push(reasoningMessages[reasoningId]);
|
|
2357
2357
|
} else {
|
|
2358
2358
|
reasoningMessage.summary.push(...summaryParts);
|
|
2359
|
+
if ((providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent) != null) {
|
|
2360
|
+
reasoningMessage.encrypted_content = providerOptions.reasoningEncryptedContent;
|
|
2361
|
+
}
|
|
2359
2362
|
}
|
|
2360
2363
|
}
|
|
2361
2364
|
} else {
|
|
@@ -2522,11 +2525,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
|
|
|
2522
2525
|
import_v414.z.object({
|
|
2523
2526
|
type: import_v414.z.literal("web_search_call"),
|
|
2524
2527
|
id: import_v414.z.string(),
|
|
2525
|
-
status: import_v414.z.string()
|
|
2526
|
-
action: import_v414.z.object({
|
|
2527
|
-
type: import_v414.z.literal("search"),
|
|
2528
|
-
query: import_v414.z.string().optional()
|
|
2529
|
-
}).nullish()
|
|
2528
|
+
status: import_v414.z.string()
|
|
2530
2529
|
}),
|
|
2531
2530
|
import_v414.z.object({
|
|
2532
2531
|
type: import_v414.z.literal("computer_call"),
|
|
@@ -2612,7 +2611,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
|
|
|
2612
2611
|
url: import_v414.z.string(),
|
|
2613
2612
|
pattern: import_v414.z.string()
|
|
2614
2613
|
})
|
|
2615
|
-
])
|
|
2614
|
+
])
|
|
2616
2615
|
}),
|
|
2617
2616
|
import_v414.z.object({
|
|
2618
2617
|
type: import_v414.z.literal("file_search_call"),
|
|
@@ -2702,6 +2701,11 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
|
|
|
2702
2701
|
summary_index: import_v414.z.number(),
|
|
2703
2702
|
delta: import_v414.z.string()
|
|
2704
2703
|
}),
|
|
2704
|
+
import_v414.z.object({
|
|
2705
|
+
type: import_v414.z.literal("response.reasoning_summary_part.done"),
|
|
2706
|
+
item_id: import_v414.z.string(),
|
|
2707
|
+
summary_index: import_v414.z.number()
|
|
2708
|
+
}),
|
|
2705
2709
|
import_v414.z.object({
|
|
2706
2710
|
type: import_v414.z.literal("error"),
|
|
2707
2711
|
code: import_v414.z.string(),
|
|
@@ -2793,7 +2797,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazyValidator)(
|
|
|
2793
2797
|
url: import_v414.z.string(),
|
|
2794
2798
|
pattern: import_v414.z.string()
|
|
2795
2799
|
})
|
|
2796
|
-
])
|
|
2800
|
+
])
|
|
2797
2801
|
}),
|
|
2798
2802
|
import_v414.z.object({
|
|
2799
2803
|
type: import_v414.z.literal("file_search_call"),
|
|
@@ -3088,9 +3092,7 @@ var import_v418 = require("zod/v4");
|
|
|
3088
3092
|
var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
3089
3093
|
() => (0, import_provider_utils25.zodSchema)(
|
|
3090
3094
|
import_v418.z.object({
|
|
3091
|
-
filters: import_v418.z.object({
|
|
3092
|
-
allowedDomains: import_v418.z.array(import_v418.z.string()).optional()
|
|
3093
|
-
}).optional(),
|
|
3095
|
+
filters: import_v418.z.object({ allowedDomains: import_v418.z.array(import_v418.z.string()).optional() }).optional(),
|
|
3094
3096
|
searchContextSize: import_v418.z.enum(["low", "medium", "high"]).optional(),
|
|
3095
3097
|
userLocation: import_v418.z.object({
|
|
3096
3098
|
type: import_v418.z.literal("approximate"),
|
|
@@ -3102,16 +3104,17 @@ var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3102
3104
|
})
|
|
3103
3105
|
)
|
|
3104
3106
|
);
|
|
3105
|
-
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3107
|
+
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(() => (0, import_provider_utils25.zodSchema)(import_v418.z.object({})));
|
|
3108
|
+
var webSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3106
3109
|
() => (0, import_provider_utils25.zodSchema)(
|
|
3107
3110
|
import_v418.z.object({
|
|
3108
3111
|
action: import_v418.z.discriminatedUnion("type", [
|
|
3109
3112
|
import_v418.z.object({
|
|
3110
3113
|
type: import_v418.z.literal("search"),
|
|
3111
|
-
query: import_v418.z.string().
|
|
3114
|
+
query: import_v418.z.string().optional()
|
|
3112
3115
|
}),
|
|
3113
3116
|
import_v418.z.object({
|
|
3114
|
-
type: import_v418.z.literal("
|
|
3117
|
+
type: import_v418.z.literal("openPage"),
|
|
3115
3118
|
url: import_v418.z.string()
|
|
3116
3119
|
}),
|
|
3117
3120
|
import_v418.z.object({
|
|
@@ -3119,14 +3122,15 @@ var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3119
3122
|
url: import_v418.z.string(),
|
|
3120
3123
|
pattern: import_v418.z.string()
|
|
3121
3124
|
})
|
|
3122
|
-
])
|
|
3125
|
+
])
|
|
3123
3126
|
})
|
|
3124
3127
|
)
|
|
3125
3128
|
);
|
|
3126
|
-
var webSearchToolFactory = (0, import_provider_utils25.
|
|
3129
|
+
var webSearchToolFactory = (0, import_provider_utils25.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3127
3130
|
id: "openai.web_search",
|
|
3128
3131
|
name: "web_search",
|
|
3129
|
-
inputSchema: webSearchInputSchema
|
|
3132
|
+
inputSchema: webSearchInputSchema,
|
|
3133
|
+
outputSchema: webSearchOutputSchema
|
|
3130
3134
|
});
|
|
3131
3135
|
|
|
3132
3136
|
// src/tool/web-search-preview.ts
|
|
@@ -3135,51 +3139,30 @@ var import_v419 = require("zod/v4");
|
|
|
3135
3139
|
var webSearchPreviewArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
3136
3140
|
() => (0, import_provider_utils26.zodSchema)(
|
|
3137
3141
|
import_v419.z.object({
|
|
3138
|
-
/**
|
|
3139
|
-
* Search context size to use for the web search.
|
|
3140
|
-
* - high: Most comprehensive context, highest cost, slower response
|
|
3141
|
-
* - medium: Balanced context, cost, and latency (default)
|
|
3142
|
-
* - low: Least context, lowest cost, fastest response
|
|
3143
|
-
*/
|
|
3144
3142
|
searchContextSize: import_v419.z.enum(["low", "medium", "high"]).optional(),
|
|
3145
|
-
/**
|
|
3146
|
-
* User location information to provide geographically relevant search results.
|
|
3147
|
-
*/
|
|
3148
3143
|
userLocation: import_v419.z.object({
|
|
3149
|
-
/**
|
|
3150
|
-
* Type of location (always 'approximate')
|
|
3151
|
-
*/
|
|
3152
3144
|
type: import_v419.z.literal("approximate"),
|
|
3153
|
-
/**
|
|
3154
|
-
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
3155
|
-
*/
|
|
3156
3145
|
country: import_v419.z.string().optional(),
|
|
3157
|
-
/**
|
|
3158
|
-
* City name (free text, e.g., 'Minneapolis')
|
|
3159
|
-
*/
|
|
3160
3146
|
city: import_v419.z.string().optional(),
|
|
3161
|
-
/**
|
|
3162
|
-
* Region name (free text, e.g., 'Minnesota')
|
|
3163
|
-
*/
|
|
3164
3147
|
region: import_v419.z.string().optional(),
|
|
3165
|
-
/**
|
|
3166
|
-
* IANA timezone (e.g., 'America/Chicago')
|
|
3167
|
-
*/
|
|
3168
3148
|
timezone: import_v419.z.string().optional()
|
|
3169
3149
|
}).optional()
|
|
3170
3150
|
})
|
|
3171
3151
|
)
|
|
3172
3152
|
);
|
|
3173
3153
|
var webSearchPreviewInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3154
|
+
() => (0, import_provider_utils26.zodSchema)(import_v419.z.object({}))
|
|
3155
|
+
);
|
|
3156
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3174
3157
|
() => (0, import_provider_utils26.zodSchema)(
|
|
3175
3158
|
import_v419.z.object({
|
|
3176
3159
|
action: import_v419.z.discriminatedUnion("type", [
|
|
3177
3160
|
import_v419.z.object({
|
|
3178
3161
|
type: import_v419.z.literal("search"),
|
|
3179
|
-
query: import_v419.z.string().
|
|
3162
|
+
query: import_v419.z.string().optional()
|
|
3180
3163
|
}),
|
|
3181
3164
|
import_v419.z.object({
|
|
3182
|
-
type: import_v419.z.literal("
|
|
3165
|
+
type: import_v419.z.literal("openPage"),
|
|
3183
3166
|
url: import_v419.z.string()
|
|
3184
3167
|
}),
|
|
3185
3168
|
import_v419.z.object({
|
|
@@ -3187,14 +3170,15 @@ var webSearchPreviewInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
3187
3170
|
url: import_v419.z.string(),
|
|
3188
3171
|
pattern: import_v419.z.string()
|
|
3189
3172
|
})
|
|
3190
|
-
])
|
|
3173
|
+
])
|
|
3191
3174
|
})
|
|
3192
3175
|
)
|
|
3193
3176
|
);
|
|
3194
|
-
var webSearchPreview = (0, import_provider_utils26.
|
|
3177
|
+
var webSearchPreview = (0, import_provider_utils26.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3195
3178
|
id: "openai.web_search_preview",
|
|
3196
3179
|
name: "web_search_preview",
|
|
3197
|
-
inputSchema: webSearchPreviewInputSchema
|
|
3180
|
+
inputSchema: webSearchPreviewInputSchema,
|
|
3181
|
+
outputSchema: webSearchPreviewOutputSchema
|
|
3198
3182
|
});
|
|
3199
3183
|
|
|
3200
3184
|
// src/tool/image-generation.ts
|
|
@@ -3584,7 +3568,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3584
3568
|
tools: openaiTools,
|
|
3585
3569
|
tool_choice: openaiToolChoice
|
|
3586
3570
|
},
|
|
3587
|
-
warnings: [...warnings, ...toolWarnings]
|
|
3571
|
+
warnings: [...warnings, ...toolWarnings],
|
|
3572
|
+
store
|
|
3588
3573
|
};
|
|
3589
3574
|
}
|
|
3590
3575
|
async doGenerate(options) {
|
|
@@ -3739,14 +3724,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3739
3724
|
type: "tool-call",
|
|
3740
3725
|
toolCallId: part.id,
|
|
3741
3726
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3742
|
-
input: JSON.stringify({
|
|
3727
|
+
input: JSON.stringify({}),
|
|
3743
3728
|
providerExecuted: true
|
|
3744
3729
|
});
|
|
3745
3730
|
content.push({
|
|
3746
3731
|
type: "tool-result",
|
|
3747
3732
|
toolCallId: part.id,
|
|
3748
3733
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3749
|
-
result:
|
|
3734
|
+
result: mapWebSearchOutput(part.action),
|
|
3750
3735
|
providerExecuted: true
|
|
3751
3736
|
});
|
|
3752
3737
|
break;
|
|
@@ -3859,7 +3844,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3859
3844
|
const {
|
|
3860
3845
|
args: body,
|
|
3861
3846
|
warnings,
|
|
3862
|
-
webSearchToolName
|
|
3847
|
+
webSearchToolName,
|
|
3848
|
+
store
|
|
3863
3849
|
} = await this.getArgs(options);
|
|
3864
3850
|
const { responseHeaders, value: response } = await (0, import_provider_utils29.postJsonToApi)({
|
|
3865
3851
|
url: this.config.url({
|
|
@@ -3898,7 +3884,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3898
3884
|
controller.enqueue({ type: "stream-start", warnings });
|
|
3899
3885
|
},
|
|
3900
3886
|
transform(chunk, controller) {
|
|
3901
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v
|
|
3887
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
3902
3888
|
if (options.includeRawChunks) {
|
|
3903
3889
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
3904
3890
|
}
|
|
@@ -3930,6 +3916,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3930
3916
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3931
3917
|
providerExecuted: true
|
|
3932
3918
|
});
|
|
3919
|
+
controller.enqueue({
|
|
3920
|
+
type: "tool-input-end",
|
|
3921
|
+
id: value.item.id
|
|
3922
|
+
});
|
|
3923
|
+
controller.enqueue({
|
|
3924
|
+
type: "tool-call",
|
|
3925
|
+
toolCallId: value.item.id,
|
|
3926
|
+
toolName: "web_search",
|
|
3927
|
+
input: JSON.stringify({}),
|
|
3928
|
+
providerExecuted: true
|
|
3929
|
+
});
|
|
3933
3930
|
} else if (value.item.type === "computer_call") {
|
|
3934
3931
|
ongoingToolCalls[value.output_index] = {
|
|
3935
3932
|
toolName: "computer_use",
|
|
@@ -3986,10 +3983,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3986
3983
|
}
|
|
3987
3984
|
}
|
|
3988
3985
|
});
|
|
3989
|
-
} else if (
|
|
3986
|
+
} else if (isResponseOutputItemAddedChunk(value) && value.item.type === "reasoning") {
|
|
3990
3987
|
activeReasoning[value.item.id] = {
|
|
3991
3988
|
encryptedContent: value.item.encrypted_content,
|
|
3992
|
-
summaryParts:
|
|
3989
|
+
summaryParts: { 0: "active" }
|
|
3993
3990
|
};
|
|
3994
3991
|
controller.enqueue({
|
|
3995
3992
|
type: "reasoning-start",
|
|
@@ -4023,22 +4020,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4023
4020
|
});
|
|
4024
4021
|
} else if (value.item.type === "web_search_call") {
|
|
4025
4022
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4026
|
-
controller.enqueue({
|
|
4027
|
-
type: "tool-input-end",
|
|
4028
|
-
id: value.item.id
|
|
4029
|
-
});
|
|
4030
|
-
controller.enqueue({
|
|
4031
|
-
type: "tool-call",
|
|
4032
|
-
toolCallId: value.item.id,
|
|
4033
|
-
toolName: "web_search",
|
|
4034
|
-
input: JSON.stringify({ action: value.item.action }),
|
|
4035
|
-
providerExecuted: true
|
|
4036
|
-
});
|
|
4037
4023
|
controller.enqueue({
|
|
4038
4024
|
type: "tool-result",
|
|
4039
4025
|
toolCallId: value.item.id,
|
|
4040
4026
|
toolName: "web_search",
|
|
4041
|
-
result:
|
|
4027
|
+
result: mapWebSearchOutput(value.item.action),
|
|
4042
4028
|
providerExecuted: true
|
|
4043
4029
|
});
|
|
4044
4030
|
} else if (value.item.type === "computer_call") {
|
|
@@ -4128,9 +4114,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4128
4114
|
type: "text-end",
|
|
4129
4115
|
id: value.item.id
|
|
4130
4116
|
});
|
|
4131
|
-
} else if (
|
|
4117
|
+
} else if (value.item.type === "reasoning") {
|
|
4132
4118
|
const activeReasoningPart = activeReasoning[value.item.id];
|
|
4133
|
-
|
|
4119
|
+
const summaryPartIndices = Object.entries(
|
|
4120
|
+
activeReasoningPart.summaryParts
|
|
4121
|
+
).filter(
|
|
4122
|
+
([_, status]) => status === "active" || status === "can-conclude"
|
|
4123
|
+
).map(([summaryIndex]) => summaryIndex);
|
|
4124
|
+
for (const summaryIndex of summaryPartIndices) {
|
|
4134
4125
|
controller.enqueue({
|
|
4135
4126
|
type: "reasoning-end",
|
|
4136
4127
|
id: `${value.item.id}:${summaryIndex}`,
|
|
@@ -4204,23 +4195,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4204
4195
|
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.logprobs) && value.logprobs) {
|
|
4205
4196
|
logprobs.push(value.logprobs);
|
|
4206
4197
|
}
|
|
4207
|
-
} else if (
|
|
4198
|
+
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
4208
4199
|
if (value.summary_index > 0) {
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4200
|
+
const activeReasoningPart = activeReasoning[value.item_id];
|
|
4201
|
+
activeReasoningPart.summaryParts[value.summary_index] = "active";
|
|
4202
|
+
for (const summaryIndex of Object.keys(
|
|
4203
|
+
activeReasoningPart.summaryParts
|
|
4204
|
+
)) {
|
|
4205
|
+
if (activeReasoningPart.summaryParts[summaryIndex] === "can-conclude") {
|
|
4206
|
+
controller.enqueue({
|
|
4207
|
+
type: "reasoning-end",
|
|
4208
|
+
id: `${value.item_id}:${summaryIndex}`,
|
|
4209
|
+
providerMetadata: { openai: { itemId: value.item_id } }
|
|
4210
|
+
});
|
|
4211
|
+
activeReasoningPart.summaryParts[summaryIndex] = "concluded";
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4212
4214
|
controller.enqueue({
|
|
4213
4215
|
type: "reasoning-start",
|
|
4214
4216
|
id: `${value.item_id}:${value.summary_index}`,
|
|
4215
4217
|
providerMetadata: {
|
|
4216
4218
|
openai: {
|
|
4217
4219
|
itemId: value.item_id,
|
|
4218
|
-
reasoningEncryptedContent: (
|
|
4220
|
+
reasoningEncryptedContent: (_h = (_g = activeReasoning[value.item_id]) == null ? void 0 : _g.encryptedContent) != null ? _h : null
|
|
4219
4221
|
}
|
|
4220
4222
|
}
|
|
4221
4223
|
});
|
|
4222
4224
|
}
|
|
4223
|
-
} else if (
|
|
4225
|
+
} else if (value.type === "response.reasoning_summary_text.delta") {
|
|
4224
4226
|
controller.enqueue({
|
|
4225
4227
|
type: "reasoning-delta",
|
|
4226
4228
|
id: `${value.item_id}:${value.summary_index}`,
|
|
@@ -4231,16 +4233,29 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4231
4233
|
}
|
|
4232
4234
|
}
|
|
4233
4235
|
});
|
|
4236
|
+
} else if (value.type === "response.reasoning_summary_part.done") {
|
|
4237
|
+
if (store) {
|
|
4238
|
+
controller.enqueue({
|
|
4239
|
+
type: "reasoning-end",
|
|
4240
|
+
id: `${value.item_id}:${value.summary_index}`,
|
|
4241
|
+
providerMetadata: {
|
|
4242
|
+
openai: { itemId: value.item_id }
|
|
4243
|
+
}
|
|
4244
|
+
});
|
|
4245
|
+
activeReasoning[value.item_id].summaryParts[value.summary_index] = "concluded";
|
|
4246
|
+
} else {
|
|
4247
|
+
activeReasoning[value.item_id].summaryParts[value.summary_index] = "can-conclude";
|
|
4248
|
+
}
|
|
4234
4249
|
} else if (isResponseFinishedChunk(value)) {
|
|
4235
4250
|
finishReason = mapOpenAIResponseFinishReason({
|
|
4236
|
-
finishReason: (
|
|
4251
|
+
finishReason: (_i = value.response.incomplete_details) == null ? void 0 : _i.reason,
|
|
4237
4252
|
hasFunctionCall
|
|
4238
4253
|
});
|
|
4239
4254
|
usage.inputTokens = value.response.usage.input_tokens;
|
|
4240
4255
|
usage.outputTokens = value.response.usage.output_tokens;
|
|
4241
4256
|
usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
|
|
4242
|
-
usage.reasoningTokens = (
|
|
4243
|
-
usage.cachedInputTokens = (
|
|
4257
|
+
usage.reasoningTokens = (_k = (_j = value.response.usage.output_tokens_details) == null ? void 0 : _j.reasoning_tokens) != null ? _k : void 0;
|
|
4258
|
+
usage.cachedInputTokens = (_m = (_l = value.response.usage.input_tokens_details) == null ? void 0 : _l.cached_tokens) != null ? _m : void 0;
|
|
4244
4259
|
if (typeof value.response.service_tier === "string") {
|
|
4245
4260
|
serviceTier = value.response.service_tier;
|
|
4246
4261
|
}
|
|
@@ -4249,7 +4264,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4249
4264
|
controller.enqueue({
|
|
4250
4265
|
type: "source",
|
|
4251
4266
|
sourceType: "url",
|
|
4252
|
-
id: (
|
|
4267
|
+
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils29.generateId)(),
|
|
4253
4268
|
url: value.annotation.url,
|
|
4254
4269
|
title: value.annotation.title
|
|
4255
4270
|
});
|
|
@@ -4257,10 +4272,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4257
4272
|
controller.enqueue({
|
|
4258
4273
|
type: "source",
|
|
4259
4274
|
sourceType: "document",
|
|
4260
|
-
id: (
|
|
4275
|
+
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils29.generateId)(),
|
|
4261
4276
|
mediaType: "text/plain",
|
|
4262
|
-
title: (
|
|
4263
|
-
filename: (
|
|
4277
|
+
title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
|
|
4278
|
+
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id
|
|
4264
4279
|
});
|
|
4265
4280
|
}
|
|
4266
4281
|
} else if (isErrorChunk(value)) {
|
|
@@ -4299,9 +4314,6 @@ function isTextDeltaChunk(chunk) {
|
|
|
4299
4314
|
function isResponseOutputItemDoneChunk(chunk) {
|
|
4300
4315
|
return chunk.type === "response.output_item.done";
|
|
4301
4316
|
}
|
|
4302
|
-
function isResponseOutputItemDoneReasoningChunk(chunk) {
|
|
4303
|
-
return isResponseOutputItemDoneChunk(chunk) && chunk.item.type === "reasoning";
|
|
4304
|
-
}
|
|
4305
4317
|
function isResponseFinishedChunk(chunk) {
|
|
4306
4318
|
return chunk.type === "response.completed" || chunk.type === "response.incomplete";
|
|
4307
4319
|
}
|
|
@@ -4320,18 +4332,9 @@ function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
|
4320
4332
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
4321
4333
|
return chunk.type === "response.output_item.added";
|
|
4322
4334
|
}
|
|
4323
|
-
function isResponseOutputItemAddedReasoningChunk(chunk) {
|
|
4324
|
-
return isResponseOutputItemAddedChunk(chunk) && chunk.item.type === "reasoning";
|
|
4325
|
-
}
|
|
4326
4335
|
function isResponseAnnotationAddedChunk(chunk) {
|
|
4327
4336
|
return chunk.type === "response.output_text.annotation.added";
|
|
4328
4337
|
}
|
|
4329
|
-
function isResponseReasoningSummaryPartAddedChunk(chunk) {
|
|
4330
|
-
return chunk.type === "response.reasoning_summary_part.added";
|
|
4331
|
-
}
|
|
4332
|
-
function isResponseReasoningSummaryTextDeltaChunk(chunk) {
|
|
4333
|
-
return chunk.type === "response.reasoning_summary_text.delta";
|
|
4334
|
-
}
|
|
4335
4338
|
function isErrorChunk(chunk) {
|
|
4336
4339
|
return chunk.type === "error";
|
|
4337
4340
|
}
|
|
@@ -4369,6 +4372,19 @@ function getResponsesModelConfig(modelId) {
|
|
|
4369
4372
|
isReasoningModel: false
|
|
4370
4373
|
};
|
|
4371
4374
|
}
|
|
4375
|
+
function mapWebSearchOutput(action) {
|
|
4376
|
+
var _a;
|
|
4377
|
+
switch (action.type) {
|
|
4378
|
+
case "search":
|
|
4379
|
+
return { action: { type: "search", query: (_a = action.query) != null ? _a : void 0 } };
|
|
4380
|
+
case "open_page":
|
|
4381
|
+
return { action: { type: "openPage", url: action.url } };
|
|
4382
|
+
case "find":
|
|
4383
|
+
return {
|
|
4384
|
+
action: { type: "find", url: action.url, pattern: action.pattern }
|
|
4385
|
+
};
|
|
4386
|
+
}
|
|
4387
|
+
}
|
|
4372
4388
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4373
4389
|
0 && (module.exports = {
|
|
4374
4390
|
OpenAIChatLanguageModel,
|