@ai-sdk/openai 3.0.0-beta.27 → 3.0.0-beta.29
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
|
@@ -2360,6 +2360,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2360
2360
|
input.push(reasoningMessages[reasoningId]);
|
|
2361
2361
|
} else {
|
|
2362
2362
|
reasoningMessage.summary.push(...summaryParts);
|
|
2363
|
+
if ((providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent) != null) {
|
|
2364
|
+
reasoningMessage.encrypted_content = providerOptions.reasoningEncryptedContent;
|
|
2365
|
+
}
|
|
2363
2366
|
}
|
|
2364
2367
|
}
|
|
2365
2368
|
} else {
|
|
@@ -2529,11 +2532,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2529
2532
|
import_v414.z.object({
|
|
2530
2533
|
type: import_v414.z.literal("web_search_call"),
|
|
2531
2534
|
id: import_v414.z.string(),
|
|
2532
|
-
status: import_v414.z.string()
|
|
2533
|
-
action: import_v414.z.object({
|
|
2534
|
-
type: import_v414.z.literal("search"),
|
|
2535
|
-
query: import_v414.z.string().optional()
|
|
2536
|
-
}).nullish()
|
|
2535
|
+
status: import_v414.z.string()
|
|
2537
2536
|
}),
|
|
2538
2537
|
import_v414.z.object({
|
|
2539
2538
|
type: import_v414.z.literal("computer_call"),
|
|
@@ -2619,7 +2618,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2619
2618
|
url: import_v414.z.string(),
|
|
2620
2619
|
pattern: import_v414.z.string()
|
|
2621
2620
|
})
|
|
2622
|
-
])
|
|
2621
|
+
])
|
|
2623
2622
|
}),
|
|
2624
2623
|
import_v414.z.object({
|
|
2625
2624
|
type: import_v414.z.literal("file_search_call"),
|
|
@@ -2709,6 +2708,11 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2709
2708
|
summary_index: import_v414.z.number(),
|
|
2710
2709
|
delta: import_v414.z.string()
|
|
2711
2710
|
}),
|
|
2711
|
+
import_v414.z.object({
|
|
2712
|
+
type: import_v414.z.literal("response.reasoning_summary_part.done"),
|
|
2713
|
+
item_id: import_v414.z.string(),
|
|
2714
|
+
summary_index: import_v414.z.number()
|
|
2715
|
+
}),
|
|
2712
2716
|
import_v414.z.object({
|
|
2713
2717
|
type: import_v414.z.literal("error"),
|
|
2714
2718
|
code: import_v414.z.string(),
|
|
@@ -2800,7 +2804,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2800
2804
|
url: import_v414.z.string(),
|
|
2801
2805
|
pattern: import_v414.z.string()
|
|
2802
2806
|
})
|
|
2803
|
-
])
|
|
2807
|
+
])
|
|
2804
2808
|
}),
|
|
2805
2809
|
import_v414.z.object({
|
|
2806
2810
|
type: import_v414.z.literal("file_search_call"),
|
|
@@ -3095,9 +3099,7 @@ var import_v418 = require("zod/v4");
|
|
|
3095
3099
|
var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
3096
3100
|
() => (0, import_provider_utils25.zodSchema)(
|
|
3097
3101
|
import_v418.z.object({
|
|
3098
|
-
filters: import_v418.z.object({
|
|
3099
|
-
allowedDomains: import_v418.z.array(import_v418.z.string()).optional()
|
|
3100
|
-
}).optional(),
|
|
3102
|
+
filters: import_v418.z.object({ allowedDomains: import_v418.z.array(import_v418.z.string()).optional() }).optional(),
|
|
3101
3103
|
searchContextSize: import_v418.z.enum(["low", "medium", "high"]).optional(),
|
|
3102
3104
|
userLocation: import_v418.z.object({
|
|
3103
3105
|
type: import_v418.z.literal("approximate"),
|
|
@@ -3109,16 +3111,17 @@ var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3109
3111
|
})
|
|
3110
3112
|
)
|
|
3111
3113
|
);
|
|
3112
|
-
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3114
|
+
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(() => (0, import_provider_utils25.zodSchema)(import_v418.z.object({})));
|
|
3115
|
+
var webSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3113
3116
|
() => (0, import_provider_utils25.zodSchema)(
|
|
3114
3117
|
import_v418.z.object({
|
|
3115
3118
|
action: import_v418.z.discriminatedUnion("type", [
|
|
3116
3119
|
import_v418.z.object({
|
|
3117
3120
|
type: import_v418.z.literal("search"),
|
|
3118
|
-
query: import_v418.z.string().
|
|
3121
|
+
query: import_v418.z.string().optional()
|
|
3119
3122
|
}),
|
|
3120
3123
|
import_v418.z.object({
|
|
3121
|
-
type: import_v418.z.literal("
|
|
3124
|
+
type: import_v418.z.literal("openPage"),
|
|
3122
3125
|
url: import_v418.z.string()
|
|
3123
3126
|
}),
|
|
3124
3127
|
import_v418.z.object({
|
|
@@ -3126,14 +3129,15 @@ var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3126
3129
|
url: import_v418.z.string(),
|
|
3127
3130
|
pattern: import_v418.z.string()
|
|
3128
3131
|
})
|
|
3129
|
-
])
|
|
3132
|
+
])
|
|
3130
3133
|
})
|
|
3131
3134
|
)
|
|
3132
3135
|
);
|
|
3133
|
-
var webSearchToolFactory = (0, import_provider_utils25.
|
|
3136
|
+
var webSearchToolFactory = (0, import_provider_utils25.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3134
3137
|
id: "openai.web_search",
|
|
3135
3138
|
name: "web_search",
|
|
3136
|
-
inputSchema: webSearchInputSchema
|
|
3139
|
+
inputSchema: webSearchInputSchema,
|
|
3140
|
+
outputSchema: webSearchOutputSchema
|
|
3137
3141
|
});
|
|
3138
3142
|
|
|
3139
3143
|
// src/tool/web-search-preview.ts
|
|
@@ -3142,51 +3146,30 @@ var import_v419 = require("zod/v4");
|
|
|
3142
3146
|
var webSearchPreviewArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
3143
3147
|
() => (0, import_provider_utils26.zodSchema)(
|
|
3144
3148
|
import_v419.z.object({
|
|
3145
|
-
/**
|
|
3146
|
-
* Search context size to use for the web search.
|
|
3147
|
-
* - high: Most comprehensive context, highest cost, slower response
|
|
3148
|
-
* - medium: Balanced context, cost, and latency (default)
|
|
3149
|
-
* - low: Least context, lowest cost, fastest response
|
|
3150
|
-
*/
|
|
3151
3149
|
searchContextSize: import_v419.z.enum(["low", "medium", "high"]).optional(),
|
|
3152
|
-
/**
|
|
3153
|
-
* User location information to provide geographically relevant search results.
|
|
3154
|
-
*/
|
|
3155
3150
|
userLocation: import_v419.z.object({
|
|
3156
|
-
/**
|
|
3157
|
-
* Type of location (always 'approximate')
|
|
3158
|
-
*/
|
|
3159
3151
|
type: import_v419.z.literal("approximate"),
|
|
3160
|
-
/**
|
|
3161
|
-
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
3162
|
-
*/
|
|
3163
3152
|
country: import_v419.z.string().optional(),
|
|
3164
|
-
/**
|
|
3165
|
-
* City name (free text, e.g., 'Minneapolis')
|
|
3166
|
-
*/
|
|
3167
3153
|
city: import_v419.z.string().optional(),
|
|
3168
|
-
/**
|
|
3169
|
-
* Region name (free text, e.g., 'Minnesota')
|
|
3170
|
-
*/
|
|
3171
3154
|
region: import_v419.z.string().optional(),
|
|
3172
|
-
/**
|
|
3173
|
-
* IANA timezone (e.g., 'America/Chicago')
|
|
3174
|
-
*/
|
|
3175
3155
|
timezone: import_v419.z.string().optional()
|
|
3176
3156
|
}).optional()
|
|
3177
3157
|
})
|
|
3178
3158
|
)
|
|
3179
3159
|
);
|
|
3180
3160
|
var webSearchPreviewInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3161
|
+
() => (0, import_provider_utils26.zodSchema)(import_v419.z.object({}))
|
|
3162
|
+
);
|
|
3163
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3181
3164
|
() => (0, import_provider_utils26.zodSchema)(
|
|
3182
3165
|
import_v419.z.object({
|
|
3183
3166
|
action: import_v419.z.discriminatedUnion("type", [
|
|
3184
3167
|
import_v419.z.object({
|
|
3185
3168
|
type: import_v419.z.literal("search"),
|
|
3186
|
-
query: import_v419.z.string().
|
|
3169
|
+
query: import_v419.z.string().optional()
|
|
3187
3170
|
}),
|
|
3188
3171
|
import_v419.z.object({
|
|
3189
|
-
type: import_v419.z.literal("
|
|
3172
|
+
type: import_v419.z.literal("openPage"),
|
|
3190
3173
|
url: import_v419.z.string()
|
|
3191
3174
|
}),
|
|
3192
3175
|
import_v419.z.object({
|
|
@@ -3194,14 +3177,15 @@ var webSearchPreviewInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
3194
3177
|
url: import_v419.z.string(),
|
|
3195
3178
|
pattern: import_v419.z.string()
|
|
3196
3179
|
})
|
|
3197
|
-
])
|
|
3180
|
+
])
|
|
3198
3181
|
})
|
|
3199
3182
|
)
|
|
3200
3183
|
);
|
|
3201
|
-
var webSearchPreview = (0, import_provider_utils26.
|
|
3184
|
+
var webSearchPreview = (0, import_provider_utils26.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3202
3185
|
id: "openai.web_search_preview",
|
|
3203
3186
|
name: "web_search_preview",
|
|
3204
|
-
inputSchema: webSearchPreviewInputSchema
|
|
3187
|
+
inputSchema: webSearchPreviewInputSchema,
|
|
3188
|
+
outputSchema: webSearchPreviewOutputSchema
|
|
3205
3189
|
});
|
|
3206
3190
|
|
|
3207
3191
|
// src/tool/image-generation.ts
|
|
@@ -3592,7 +3576,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3592
3576
|
tools: openaiTools,
|
|
3593
3577
|
tool_choice: openaiToolChoice
|
|
3594
3578
|
},
|
|
3595
|
-
warnings: [...warnings, ...toolWarnings]
|
|
3579
|
+
warnings: [...warnings, ...toolWarnings],
|
|
3580
|
+
store
|
|
3596
3581
|
};
|
|
3597
3582
|
}
|
|
3598
3583
|
async doGenerate(options) {
|
|
@@ -3747,14 +3732,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3747
3732
|
type: "tool-call",
|
|
3748
3733
|
toolCallId: part.id,
|
|
3749
3734
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3750
|
-
input: JSON.stringify({
|
|
3735
|
+
input: JSON.stringify({}),
|
|
3751
3736
|
providerExecuted: true
|
|
3752
3737
|
});
|
|
3753
3738
|
content.push({
|
|
3754
3739
|
type: "tool-result",
|
|
3755
3740
|
toolCallId: part.id,
|
|
3756
3741
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3757
|
-
result:
|
|
3742
|
+
result: mapWebSearchOutput(part.action),
|
|
3758
3743
|
providerExecuted: true
|
|
3759
3744
|
});
|
|
3760
3745
|
break;
|
|
@@ -3867,7 +3852,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3867
3852
|
const {
|
|
3868
3853
|
args: body,
|
|
3869
3854
|
warnings,
|
|
3870
|
-
webSearchToolName
|
|
3855
|
+
webSearchToolName,
|
|
3856
|
+
store
|
|
3871
3857
|
} = await this.getArgs(options);
|
|
3872
3858
|
const { responseHeaders, value: response } = await (0, import_provider_utils29.postJsonToApi)({
|
|
3873
3859
|
url: this.config.url({
|
|
@@ -3906,7 +3892,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3906
3892
|
controller.enqueue({ type: "stream-start", warnings });
|
|
3907
3893
|
},
|
|
3908
3894
|
transform(chunk, controller) {
|
|
3909
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v
|
|
3895
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
3910
3896
|
if (options.includeRawChunks) {
|
|
3911
3897
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
3912
3898
|
}
|
|
@@ -3938,6 +3924,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3938
3924
|
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
3939
3925
|
providerExecuted: true
|
|
3940
3926
|
});
|
|
3927
|
+
controller.enqueue({
|
|
3928
|
+
type: "tool-input-end",
|
|
3929
|
+
id: value.item.id
|
|
3930
|
+
});
|
|
3931
|
+
controller.enqueue({
|
|
3932
|
+
type: "tool-call",
|
|
3933
|
+
toolCallId: value.item.id,
|
|
3934
|
+
toolName: "web_search",
|
|
3935
|
+
input: JSON.stringify({}),
|
|
3936
|
+
providerExecuted: true
|
|
3937
|
+
});
|
|
3941
3938
|
} else if (value.item.type === "computer_call") {
|
|
3942
3939
|
ongoingToolCalls[value.output_index] = {
|
|
3943
3940
|
toolName: "computer_use",
|
|
@@ -3994,10 +3991,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3994
3991
|
}
|
|
3995
3992
|
}
|
|
3996
3993
|
});
|
|
3997
|
-
} else if (
|
|
3994
|
+
} else if (isResponseOutputItemAddedChunk(value) && value.item.type === "reasoning") {
|
|
3998
3995
|
activeReasoning[value.item.id] = {
|
|
3999
3996
|
encryptedContent: value.item.encrypted_content,
|
|
4000
|
-
summaryParts:
|
|
3997
|
+
summaryParts: { 0: "active" }
|
|
4001
3998
|
};
|
|
4002
3999
|
controller.enqueue({
|
|
4003
4000
|
type: "reasoning-start",
|
|
@@ -4031,22 +4028,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4031
4028
|
});
|
|
4032
4029
|
} else if (value.item.type === "web_search_call") {
|
|
4033
4030
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4034
|
-
controller.enqueue({
|
|
4035
|
-
type: "tool-input-end",
|
|
4036
|
-
id: value.item.id
|
|
4037
|
-
});
|
|
4038
|
-
controller.enqueue({
|
|
4039
|
-
type: "tool-call",
|
|
4040
|
-
toolCallId: value.item.id,
|
|
4041
|
-
toolName: "web_search",
|
|
4042
|
-
input: JSON.stringify({ action: value.item.action }),
|
|
4043
|
-
providerExecuted: true
|
|
4044
|
-
});
|
|
4045
4031
|
controller.enqueue({
|
|
4046
4032
|
type: "tool-result",
|
|
4047
4033
|
toolCallId: value.item.id,
|
|
4048
4034
|
toolName: "web_search",
|
|
4049
|
-
result:
|
|
4035
|
+
result: mapWebSearchOutput(value.item.action),
|
|
4050
4036
|
providerExecuted: true
|
|
4051
4037
|
});
|
|
4052
4038
|
} else if (value.item.type === "computer_call") {
|
|
@@ -4136,9 +4122,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4136
4122
|
type: "text-end",
|
|
4137
4123
|
id: value.item.id
|
|
4138
4124
|
});
|
|
4139
|
-
} else if (
|
|
4125
|
+
} else if (value.item.type === "reasoning") {
|
|
4140
4126
|
const activeReasoningPart = activeReasoning[value.item.id];
|
|
4141
|
-
|
|
4127
|
+
const summaryPartIndices = Object.entries(
|
|
4128
|
+
activeReasoningPart.summaryParts
|
|
4129
|
+
).filter(
|
|
4130
|
+
([_, status]) => status === "active" || status === "can-conclude"
|
|
4131
|
+
).map(([summaryIndex]) => summaryIndex);
|
|
4132
|
+
for (const summaryIndex of summaryPartIndices) {
|
|
4142
4133
|
controller.enqueue({
|
|
4143
4134
|
type: "reasoning-end",
|
|
4144
4135
|
id: `${value.item.id}:${summaryIndex}`,
|
|
@@ -4223,23 +4214,34 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4223
4214
|
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.logprobs) && value.logprobs) {
|
|
4224
4215
|
logprobs.push(value.logprobs);
|
|
4225
4216
|
}
|
|
4226
|
-
} else if (
|
|
4217
|
+
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
4227
4218
|
if (value.summary_index > 0) {
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4219
|
+
const activeReasoningPart = activeReasoning[value.item_id];
|
|
4220
|
+
activeReasoningPart.summaryParts[value.summary_index] = "active";
|
|
4221
|
+
for (const summaryIndex of Object.keys(
|
|
4222
|
+
activeReasoningPart.summaryParts
|
|
4223
|
+
)) {
|
|
4224
|
+
if (activeReasoningPart.summaryParts[summaryIndex] === "can-conclude") {
|
|
4225
|
+
controller.enqueue({
|
|
4226
|
+
type: "reasoning-end",
|
|
4227
|
+
id: `${value.item_id}:${summaryIndex}`,
|
|
4228
|
+
providerMetadata: { openai: { itemId: value.item_id } }
|
|
4229
|
+
});
|
|
4230
|
+
activeReasoningPart.summaryParts[summaryIndex] = "concluded";
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4231
4233
|
controller.enqueue({
|
|
4232
4234
|
type: "reasoning-start",
|
|
4233
4235
|
id: `${value.item_id}:${value.summary_index}`,
|
|
4234
4236
|
providerMetadata: {
|
|
4235
4237
|
openai: {
|
|
4236
4238
|
itemId: value.item_id,
|
|
4237
|
-
reasoningEncryptedContent: (
|
|
4239
|
+
reasoningEncryptedContent: (_h = (_g = activeReasoning[value.item_id]) == null ? void 0 : _g.encryptedContent) != null ? _h : null
|
|
4238
4240
|
}
|
|
4239
4241
|
}
|
|
4240
4242
|
});
|
|
4241
4243
|
}
|
|
4242
|
-
} else if (
|
|
4244
|
+
} else if (value.type === "response.reasoning_summary_text.delta") {
|
|
4243
4245
|
controller.enqueue({
|
|
4244
4246
|
type: "reasoning-delta",
|
|
4245
4247
|
id: `${value.item_id}:${value.summary_index}`,
|
|
@@ -4250,16 +4252,29 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4250
4252
|
}
|
|
4251
4253
|
}
|
|
4252
4254
|
});
|
|
4255
|
+
} else if (value.type === "response.reasoning_summary_part.done") {
|
|
4256
|
+
if (store) {
|
|
4257
|
+
controller.enqueue({
|
|
4258
|
+
type: "reasoning-end",
|
|
4259
|
+
id: `${value.item_id}:${value.summary_index}`,
|
|
4260
|
+
providerMetadata: {
|
|
4261
|
+
openai: { itemId: value.item_id }
|
|
4262
|
+
}
|
|
4263
|
+
});
|
|
4264
|
+
activeReasoning[value.item_id].summaryParts[value.summary_index] = "concluded";
|
|
4265
|
+
} else {
|
|
4266
|
+
activeReasoning[value.item_id].summaryParts[value.summary_index] = "can-conclude";
|
|
4267
|
+
}
|
|
4253
4268
|
} else if (isResponseFinishedChunk(value)) {
|
|
4254
4269
|
finishReason = mapOpenAIResponseFinishReason({
|
|
4255
|
-
finishReason: (
|
|
4270
|
+
finishReason: (_i = value.response.incomplete_details) == null ? void 0 : _i.reason,
|
|
4256
4271
|
hasFunctionCall
|
|
4257
4272
|
});
|
|
4258
4273
|
usage.inputTokens = value.response.usage.input_tokens;
|
|
4259
4274
|
usage.outputTokens = value.response.usage.output_tokens;
|
|
4260
4275
|
usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
|
|
4261
|
-
usage.reasoningTokens = (
|
|
4262
|
-
usage.cachedInputTokens = (
|
|
4276
|
+
usage.reasoningTokens = (_k = (_j = value.response.usage.output_tokens_details) == null ? void 0 : _j.reasoning_tokens) != null ? _k : void 0;
|
|
4277
|
+
usage.cachedInputTokens = (_m = (_l = value.response.usage.input_tokens_details) == null ? void 0 : _l.cached_tokens) != null ? _m : void 0;
|
|
4263
4278
|
if (typeof value.response.service_tier === "string") {
|
|
4264
4279
|
serviceTier = value.response.service_tier;
|
|
4265
4280
|
}
|
|
@@ -4268,7 +4283,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4268
4283
|
controller.enqueue({
|
|
4269
4284
|
type: "source",
|
|
4270
4285
|
sourceType: "url",
|
|
4271
|
-
id: (
|
|
4286
|
+
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils29.generateId)(),
|
|
4272
4287
|
url: value.annotation.url,
|
|
4273
4288
|
title: value.annotation.title
|
|
4274
4289
|
});
|
|
@@ -4276,10 +4291,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4276
4291
|
controller.enqueue({
|
|
4277
4292
|
type: "source",
|
|
4278
4293
|
sourceType: "document",
|
|
4279
|
-
id: (
|
|
4294
|
+
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils29.generateId)(),
|
|
4280
4295
|
mediaType: "text/plain",
|
|
4281
|
-
title: (
|
|
4282
|
-
filename: (
|
|
4296
|
+
title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
|
|
4297
|
+
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id
|
|
4283
4298
|
});
|
|
4284
4299
|
}
|
|
4285
4300
|
} else if (isErrorChunk(value)) {
|
|
@@ -4318,9 +4333,6 @@ function isTextDeltaChunk(chunk) {
|
|
|
4318
4333
|
function isResponseOutputItemDoneChunk(chunk) {
|
|
4319
4334
|
return chunk.type === "response.output_item.done";
|
|
4320
4335
|
}
|
|
4321
|
-
function isResponseOutputItemDoneReasoningChunk(chunk) {
|
|
4322
|
-
return isResponseOutputItemDoneChunk(chunk) && chunk.item.type === "reasoning";
|
|
4323
|
-
}
|
|
4324
4336
|
function isResponseFinishedChunk(chunk) {
|
|
4325
4337
|
return chunk.type === "response.completed" || chunk.type === "response.incomplete";
|
|
4326
4338
|
}
|
|
@@ -4342,18 +4354,9 @@ function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
|
4342
4354
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
4343
4355
|
return chunk.type === "response.output_item.added";
|
|
4344
4356
|
}
|
|
4345
|
-
function isResponseOutputItemAddedReasoningChunk(chunk) {
|
|
4346
|
-
return isResponseOutputItemAddedChunk(chunk) && chunk.item.type === "reasoning";
|
|
4347
|
-
}
|
|
4348
4357
|
function isResponseAnnotationAddedChunk(chunk) {
|
|
4349
4358
|
return chunk.type === "response.output_text.annotation.added";
|
|
4350
4359
|
}
|
|
4351
|
-
function isResponseReasoningSummaryPartAddedChunk(chunk) {
|
|
4352
|
-
return chunk.type === "response.reasoning_summary_part.added";
|
|
4353
|
-
}
|
|
4354
|
-
function isResponseReasoningSummaryTextDeltaChunk(chunk) {
|
|
4355
|
-
return chunk.type === "response.reasoning_summary_text.delta";
|
|
4356
|
-
}
|
|
4357
4360
|
function isErrorChunk(chunk) {
|
|
4358
4361
|
return chunk.type === "error";
|
|
4359
4362
|
}
|
|
@@ -4391,6 +4394,19 @@ function getResponsesModelConfig(modelId) {
|
|
|
4391
4394
|
isReasoningModel: false
|
|
4392
4395
|
};
|
|
4393
4396
|
}
|
|
4397
|
+
function mapWebSearchOutput(action) {
|
|
4398
|
+
var _a;
|
|
4399
|
+
switch (action.type) {
|
|
4400
|
+
case "search":
|
|
4401
|
+
return { action: { type: "search", query: (_a = action.query) != null ? _a : void 0 } };
|
|
4402
|
+
case "open_page":
|
|
4403
|
+
return { action: { type: "openPage", url: action.url } };
|
|
4404
|
+
case "find":
|
|
4405
|
+
return {
|
|
4406
|
+
action: { type: "find", url: action.url, pattern: action.pattern }
|
|
4407
|
+
};
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4394
4410
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4395
4411
|
0 && (module.exports = {
|
|
4396
4412
|
OpenAIChatLanguageModel,
|