@ai-sdk/openai 3.0.106 → 3.0.107
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 +7 -0
- package/dist/index.d.mts +17 -15
- package/dist/index.d.ts +17 -15
- package/dist/index.js +80 -67
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -67
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +17 -15
- package/dist/internal/index.d.ts +17 -15
- package/dist/internal/index.js +79 -66
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +79 -66
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/openai-stream-error.ts +58 -3
- package/src/responses/convert-openai-responses-usage.ts +17 -12
- package/src/responses/openai-responses-api.ts +34 -58
- package/src/responses/openai-responses-language-model.ts +19 -12
|
@@ -298,23 +298,24 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
298
298
|
} | {
|
|
299
299
|
type: "response.completed" | "response.incomplete";
|
|
300
300
|
response: {
|
|
301
|
-
|
|
301
|
+
incomplete_details?: {
|
|
302
|
+
reason: string;
|
|
303
|
+
} | null | undefined;
|
|
304
|
+
usage?: (Record<string, JSONValue | undefined> & {
|
|
302
305
|
input_tokens: number;
|
|
303
306
|
output_tokens: number;
|
|
304
|
-
input_tokens_details?: {
|
|
307
|
+
input_tokens_details?: (Record<string, JSONValue | undefined> & {
|
|
305
308
|
cached_tokens?: number | null | undefined;
|
|
306
309
|
cache_write_tokens?: number | null | undefined;
|
|
307
310
|
orchestration_input_tokens?: number | null | undefined;
|
|
308
311
|
orchestration_input_cached_tokens?: number | null | undefined;
|
|
309
|
-
} | null | undefined;
|
|
310
|
-
output_tokens_details?: {
|
|
312
|
+
}) | null | undefined;
|
|
313
|
+
output_tokens_details?: (Record<string, JSONValue | undefined> & {
|
|
311
314
|
reasoning_tokens?: number | null | undefined;
|
|
312
315
|
orchestration_output_tokens?: number | null | undefined;
|
|
313
|
-
} | null | undefined;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
reason: string;
|
|
317
|
-
} | null | undefined;
|
|
316
|
+
}) | null | undefined;
|
|
317
|
+
total_tokens?: number | undefined;
|
|
318
|
+
}) | null | undefined;
|
|
318
319
|
reasoning?: {
|
|
319
320
|
context?: string | null | undefined;
|
|
320
321
|
} | null | undefined;
|
|
@@ -331,20 +332,21 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
331
332
|
incomplete_details?: {
|
|
332
333
|
reason: string;
|
|
333
334
|
} | null | undefined;
|
|
334
|
-
usage?: {
|
|
335
|
+
usage?: (Record<string, JSONValue | undefined> & {
|
|
335
336
|
input_tokens: number;
|
|
336
337
|
output_tokens: number;
|
|
337
|
-
input_tokens_details?: {
|
|
338
|
+
input_tokens_details?: (Record<string, JSONValue | undefined> & {
|
|
338
339
|
cached_tokens?: number | null | undefined;
|
|
339
340
|
cache_write_tokens?: number | null | undefined;
|
|
340
341
|
orchestration_input_tokens?: number | null | undefined;
|
|
341
342
|
orchestration_input_cached_tokens?: number | null | undefined;
|
|
342
|
-
} | null | undefined;
|
|
343
|
-
output_tokens_details?: {
|
|
343
|
+
}) | null | undefined;
|
|
344
|
+
output_tokens_details?: (Record<string, JSONValue | undefined> & {
|
|
344
345
|
reasoning_tokens?: number | null | undefined;
|
|
345
346
|
orchestration_output_tokens?: number | null | undefined;
|
|
346
|
-
} | null | undefined;
|
|
347
|
-
|
|
347
|
+
}) | null | undefined;
|
|
348
|
+
total_tokens?: number | undefined;
|
|
349
|
+
}) | null | undefined;
|
|
348
350
|
reasoning?: {
|
|
349
351
|
context?: string | null | undefined;
|
|
350
352
|
} | null | undefined;
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -298,23 +298,24 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
298
298
|
} | {
|
|
299
299
|
type: "response.completed" | "response.incomplete";
|
|
300
300
|
response: {
|
|
301
|
-
|
|
301
|
+
incomplete_details?: {
|
|
302
|
+
reason: string;
|
|
303
|
+
} | null | undefined;
|
|
304
|
+
usage?: (Record<string, JSONValue | undefined> & {
|
|
302
305
|
input_tokens: number;
|
|
303
306
|
output_tokens: number;
|
|
304
|
-
input_tokens_details?: {
|
|
307
|
+
input_tokens_details?: (Record<string, JSONValue | undefined> & {
|
|
305
308
|
cached_tokens?: number | null | undefined;
|
|
306
309
|
cache_write_tokens?: number | null | undefined;
|
|
307
310
|
orchestration_input_tokens?: number | null | undefined;
|
|
308
311
|
orchestration_input_cached_tokens?: number | null | undefined;
|
|
309
|
-
} | null | undefined;
|
|
310
|
-
output_tokens_details?: {
|
|
312
|
+
}) | null | undefined;
|
|
313
|
+
output_tokens_details?: (Record<string, JSONValue | undefined> & {
|
|
311
314
|
reasoning_tokens?: number | null | undefined;
|
|
312
315
|
orchestration_output_tokens?: number | null | undefined;
|
|
313
|
-
} | null | undefined;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
reason: string;
|
|
317
|
-
} | null | undefined;
|
|
316
|
+
}) | null | undefined;
|
|
317
|
+
total_tokens?: number | undefined;
|
|
318
|
+
}) | null | undefined;
|
|
318
319
|
reasoning?: {
|
|
319
320
|
context?: string | null | undefined;
|
|
320
321
|
} | null | undefined;
|
|
@@ -331,20 +332,21 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
331
332
|
incomplete_details?: {
|
|
332
333
|
reason: string;
|
|
333
334
|
} | null | undefined;
|
|
334
|
-
usage?: {
|
|
335
|
+
usage?: (Record<string, JSONValue | undefined> & {
|
|
335
336
|
input_tokens: number;
|
|
336
337
|
output_tokens: number;
|
|
337
|
-
input_tokens_details?: {
|
|
338
|
+
input_tokens_details?: (Record<string, JSONValue | undefined> & {
|
|
338
339
|
cached_tokens?: number | null | undefined;
|
|
339
340
|
cache_write_tokens?: number | null | undefined;
|
|
340
341
|
orchestration_input_tokens?: number | null | undefined;
|
|
341
342
|
orchestration_input_cached_tokens?: number | null | undefined;
|
|
342
|
-
} | null | undefined;
|
|
343
|
-
output_tokens_details?: {
|
|
343
|
+
}) | null | undefined;
|
|
344
|
+
output_tokens_details?: (Record<string, JSONValue | undefined> & {
|
|
344
345
|
reasoning_tokens?: number | null | undefined;
|
|
345
346
|
orchestration_output_tokens?: number | null | undefined;
|
|
346
|
-
} | null | undefined;
|
|
347
|
-
|
|
347
|
+
}) | null | undefined;
|
|
348
|
+
total_tokens?: number | undefined;
|
|
349
|
+
}) | null | undefined;
|
|
348
350
|
reasoning?: {
|
|
349
351
|
context?: string | null | undefined;
|
|
350
352
|
} | null | undefined;
|
package/dist/internal/index.js
CHANGED
|
@@ -125,6 +125,22 @@ function getGptVersion(modelId) {
|
|
|
125
125
|
|
|
126
126
|
// src/openai-stream-error.ts
|
|
127
127
|
var import_provider = require("@ai-sdk/provider");
|
|
128
|
+
function createOpenAIProviderStreamError(frame) {
|
|
129
|
+
var _a2, _b;
|
|
130
|
+
const streamError = parseStreamError(frame);
|
|
131
|
+
if (streamError == null) {
|
|
132
|
+
return void 0;
|
|
133
|
+
}
|
|
134
|
+
const statusCode = getStatusCode(streamError);
|
|
135
|
+
return {
|
|
136
|
+
message: streamError.message,
|
|
137
|
+
type: (_a2 = streamError.type) != null ? _a2 : void 0,
|
|
138
|
+
code: (_b = streamError.code) != null ? _b : void 0,
|
|
139
|
+
statusCode,
|
|
140
|
+
isRetryable: isRetryableStreamError(streamError, statusCode),
|
|
141
|
+
data: frame
|
|
142
|
+
};
|
|
143
|
+
}
|
|
128
144
|
async function throwIfOpenAIStreamErrorBeforeOutput({
|
|
129
145
|
stream,
|
|
130
146
|
getError,
|
|
@@ -196,16 +212,14 @@ function parseStreamError(frame) {
|
|
|
196
212
|
return typeof (responseError == null ? void 0 : responseError.message) === "string" ? {
|
|
197
213
|
message: responseError.message,
|
|
198
214
|
code: getStringOrNumber(responseError.code),
|
|
199
|
-
type: "response.failed"
|
|
200
|
-
frame
|
|
215
|
+
type: "response.failed"
|
|
201
216
|
} : void 0;
|
|
202
217
|
}
|
|
203
218
|
const error = (_a2 = asRecord(value.error)) != null ? _a2 : value;
|
|
204
219
|
return typeof error.message === "string" && (asRecord(value.error) != null || typeof error.type === "string" || "code" in error || "param" in error) ? {
|
|
205
220
|
message: error.message,
|
|
206
221
|
code: getStringOrNumber(error.code),
|
|
207
|
-
type: typeof error.type === "string" ? error.type : void 0
|
|
208
|
-
frame
|
|
222
|
+
type: typeof error.type === "string" ? error.type : void 0
|
|
209
223
|
} : void 0;
|
|
210
224
|
}
|
|
211
225
|
function getStatusCode(error) {
|
|
@@ -245,6 +259,15 @@ function getStringOrNumber(value) {
|
|
|
245
259
|
function isHttpErrorStatusCode(value) {
|
|
246
260
|
return Number.isInteger(value) && value >= 400 && value <= 599;
|
|
247
261
|
}
|
|
262
|
+
function isRetryableStatusCode(statusCode) {
|
|
263
|
+
return statusCode === 408 || statusCode === 409 || statusCode === 429 || statusCode >= 500;
|
|
264
|
+
}
|
|
265
|
+
function isRetryableStreamError(error, statusCode) {
|
|
266
|
+
if (error.code === "insufficient_quota" || error.type === "insufficient_quota") {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
return isRetryableStatusCode(statusCode);
|
|
270
|
+
}
|
|
248
271
|
|
|
249
272
|
// src/chat/convert-openai-chat-usage.ts
|
|
250
273
|
function convertOpenAIChatUsage(usage) {
|
|
@@ -3952,6 +3975,31 @@ var jsonValueSchema = import_v418.z.lazy(
|
|
|
3952
3975
|
import_v418.z.record(import_v418.z.string(), jsonValueSchema.optional())
|
|
3953
3976
|
])
|
|
3954
3977
|
);
|
|
3978
|
+
var jsonObjectSchema = import_v418.z.record(import_v418.z.string(), jsonValueSchema.optional());
|
|
3979
|
+
var openaiResponsesUsageSchema = import_v418.z.intersection(
|
|
3980
|
+
jsonObjectSchema,
|
|
3981
|
+
import_v418.z.object({
|
|
3982
|
+
input_tokens: import_v418.z.number(),
|
|
3983
|
+
input_tokens_details: import_v418.z.intersection(
|
|
3984
|
+
jsonObjectSchema,
|
|
3985
|
+
import_v418.z.object({
|
|
3986
|
+
cached_tokens: import_v418.z.number().nullish(),
|
|
3987
|
+
cache_write_tokens: import_v418.z.number().nullish(),
|
|
3988
|
+
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
3989
|
+
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
3990
|
+
})
|
|
3991
|
+
).nullish(),
|
|
3992
|
+
output_tokens: import_v418.z.number(),
|
|
3993
|
+
output_tokens_details: import_v418.z.intersection(
|
|
3994
|
+
jsonObjectSchema,
|
|
3995
|
+
import_v418.z.object({
|
|
3996
|
+
reasoning_tokens: import_v418.z.number().nullish(),
|
|
3997
|
+
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
3998
|
+
})
|
|
3999
|
+
).nullish(),
|
|
4000
|
+
total_tokens: import_v418.z.number().optional()
|
|
4001
|
+
})
|
|
4002
|
+
);
|
|
3955
4003
|
function isRecord(value) {
|
|
3956
4004
|
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
3957
4005
|
}
|
|
@@ -4063,20 +4111,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
4063
4111
|
type: import_v418.z.enum(["response.completed", "response.incomplete"]),
|
|
4064
4112
|
response: import_v418.z.object({
|
|
4065
4113
|
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
4066
|
-
usage:
|
|
4067
|
-
input_tokens: import_v418.z.number(),
|
|
4068
|
-
input_tokens_details: import_v418.z.object({
|
|
4069
|
-
cached_tokens: import_v418.z.number().nullish(),
|
|
4070
|
-
cache_write_tokens: import_v418.z.number().nullish(),
|
|
4071
|
-
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
4072
|
-
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
4073
|
-
}).nullish(),
|
|
4074
|
-
output_tokens: import_v418.z.number(),
|
|
4075
|
-
output_tokens_details: import_v418.z.object({
|
|
4076
|
-
reasoning_tokens: import_v418.z.number().nullish(),
|
|
4077
|
-
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
4078
|
-
}).nullish()
|
|
4079
|
-
}),
|
|
4114
|
+
usage: openaiResponsesUsageSchema.nullish(),
|
|
4080
4115
|
reasoning: import_v418.z.object({
|
|
4081
4116
|
context: import_v418.z.string().nullish()
|
|
4082
4117
|
}).nullish(),
|
|
@@ -4092,20 +4127,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
4092
4127
|
message: import_v418.z.string()
|
|
4093
4128
|
}).nullish(),
|
|
4094
4129
|
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
4095
|
-
usage:
|
|
4096
|
-
input_tokens: import_v418.z.number(),
|
|
4097
|
-
input_tokens_details: import_v418.z.object({
|
|
4098
|
-
cached_tokens: import_v418.z.number().nullish(),
|
|
4099
|
-
cache_write_tokens: import_v418.z.number().nullish(),
|
|
4100
|
-
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
4101
|
-
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
4102
|
-
}).nullish(),
|
|
4103
|
-
output_tokens: import_v418.z.number(),
|
|
4104
|
-
output_tokens_details: import_v418.z.object({
|
|
4105
|
-
reasoning_tokens: import_v418.z.number().nullish(),
|
|
4106
|
-
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
4107
|
-
}).nullish()
|
|
4108
|
-
}).nullish(),
|
|
4130
|
+
usage: openaiResponsesUsageSchema.nullish(),
|
|
4109
4131
|
reasoning: import_v418.z.object({
|
|
4110
4132
|
context: import_v418.z.string().nullish()
|
|
4111
4133
|
}).nullish(),
|
|
@@ -4871,20 +4893,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
4871
4893
|
context: import_v418.z.string().nullish()
|
|
4872
4894
|
}).nullish(),
|
|
4873
4895
|
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
4874
|
-
usage:
|
|
4875
|
-
input_tokens: import_v418.z.number(),
|
|
4876
|
-
input_tokens_details: import_v418.z.object({
|
|
4877
|
-
cached_tokens: import_v418.z.number().nullish(),
|
|
4878
|
-
cache_write_tokens: import_v418.z.number().nullish(),
|
|
4879
|
-
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
4880
|
-
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
4881
|
-
}).nullish(),
|
|
4882
|
-
output_tokens: import_v418.z.number(),
|
|
4883
|
-
output_tokens_details: import_v418.z.object({
|
|
4884
|
-
reasoning_tokens: import_v418.z.number().nullish(),
|
|
4885
|
-
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
4886
|
-
}).nullish()
|
|
4887
|
-
}).optional()
|
|
4896
|
+
usage: openaiResponsesUsageSchema.nullish()
|
|
4888
4897
|
})
|
|
4889
4898
|
)
|
|
4890
4899
|
);
|
|
@@ -6795,7 +6804,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6795
6804
|
controller.enqueue({ type: "stream-start", warnings });
|
|
6796
6805
|
},
|
|
6797
6806
|
transform(chunk, controller) {
|
|
6798
|
-
var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P;
|
|
6807
|
+
var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S;
|
|
6799
6808
|
if (options.includeRawChunks) {
|
|
6800
6809
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
6801
6810
|
}
|
|
@@ -7616,15 +7625,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7616
7625
|
raw: (_z = (_y = value.response.incomplete_details) == null ? void 0 : _y.reason) != null ? _z : void 0
|
|
7617
7626
|
};
|
|
7618
7627
|
}
|
|
7619
|
-
usage = value.response.usage;
|
|
7628
|
+
usage = (_A = value.response.usage) != null ? _A : void 0;
|
|
7620
7629
|
if (typeof value.response.service_tier === "string") {
|
|
7621
7630
|
serviceTier = value.response.service_tier;
|
|
7622
7631
|
}
|
|
7623
|
-
if (((
|
|
7632
|
+
if (((_B = value.response.reasoning) == null ? void 0 : _B.context) != null) {
|
|
7624
7633
|
reasoningContext = value.response.reasoning.context;
|
|
7625
7634
|
}
|
|
7626
7635
|
} else if (isResponseFailedChunk(value)) {
|
|
7627
|
-
const incompleteReason = (
|
|
7636
|
+
const incompleteReason = (_C = value.response.incomplete_details) == null ? void 0 : _C.reason;
|
|
7628
7637
|
finishReason = {
|
|
7629
7638
|
unified: incompleteReason ? mapOpenAIResponseFinishReason({
|
|
7630
7639
|
finishReason: incompleteReason,
|
|
@@ -7632,23 +7641,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7632
7641
|
}) : "error",
|
|
7633
7642
|
raw: incompleteReason != null ? incompleteReason : "error"
|
|
7634
7643
|
};
|
|
7635
|
-
usage = (
|
|
7636
|
-
if (((
|
|
7644
|
+
usage = (_D = value.response.usage) != null ? _D : void 0;
|
|
7645
|
+
if (((_E = value.response.reasoning) == null ? void 0 : _E.context) != null) {
|
|
7637
7646
|
reasoningContext = value.response.reasoning.context;
|
|
7638
7647
|
}
|
|
7639
7648
|
if (!encounteredStreamError && value.response.error != null) {
|
|
7640
7649
|
encounteredStreamError = true;
|
|
7650
|
+
const error = {
|
|
7651
|
+
type: "response.failed",
|
|
7652
|
+
sequence_number: value.sequence_number,
|
|
7653
|
+
response: {
|
|
7654
|
+
error: value.response.error,
|
|
7655
|
+
incomplete_details: value.response.incomplete_details,
|
|
7656
|
+
service_tier: value.response.service_tier
|
|
7657
|
+
}
|
|
7658
|
+
};
|
|
7641
7659
|
controller.enqueue({
|
|
7642
7660
|
type: "error",
|
|
7643
|
-
error:
|
|
7644
|
-
type: "response.failed",
|
|
7645
|
-
sequence_number: value.sequence_number,
|
|
7646
|
-
response: {
|
|
7647
|
-
error: value.response.error,
|
|
7648
|
-
incomplete_details: value.response.incomplete_details,
|
|
7649
|
-
service_tier: value.response.service_tier
|
|
7650
|
-
}
|
|
7651
|
-
}
|
|
7661
|
+
error: (_F = createOpenAIProviderStreamError(error)) != null ? _F : error
|
|
7652
7662
|
});
|
|
7653
7663
|
}
|
|
7654
7664
|
} else if (isResponseAnnotationAddedChunk(value)) {
|
|
@@ -7657,7 +7667,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7657
7667
|
controller.enqueue({
|
|
7658
7668
|
type: "source",
|
|
7659
7669
|
sourceType: "url",
|
|
7660
|
-
id: (
|
|
7670
|
+
id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : (0, import_provider_utils36.generateId)(),
|
|
7661
7671
|
url: value.annotation.url,
|
|
7662
7672
|
title: value.annotation.title
|
|
7663
7673
|
});
|
|
@@ -7665,7 +7675,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7665
7675
|
controller.enqueue({
|
|
7666
7676
|
type: "source",
|
|
7667
7677
|
sourceType: "document",
|
|
7668
|
-
id: (
|
|
7678
|
+
id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : (0, import_provider_utils36.generateId)(),
|
|
7669
7679
|
mediaType: "text/plain",
|
|
7670
7680
|
title: value.annotation.filename,
|
|
7671
7681
|
filename: value.annotation.filename,
|
|
@@ -7681,7 +7691,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7681
7691
|
controller.enqueue({
|
|
7682
7692
|
type: "source",
|
|
7683
7693
|
sourceType: "document",
|
|
7684
|
-
id: (
|
|
7694
|
+
id: (_O = (_N = (_M = self.config).generateId) == null ? void 0 : _N.call(_M)) != null ? _O : (0, import_provider_utils36.generateId)(),
|
|
7685
7695
|
mediaType: "text/plain",
|
|
7686
7696
|
title: value.annotation.filename,
|
|
7687
7697
|
filename: value.annotation.filename,
|
|
@@ -7697,7 +7707,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7697
7707
|
controller.enqueue({
|
|
7698
7708
|
type: "source",
|
|
7699
7709
|
sourceType: "document",
|
|
7700
|
-
id: (
|
|
7710
|
+
id: (_R = (_Q = (_P = self.config).generateId) == null ? void 0 : _Q.call(_P)) != null ? _R : (0, import_provider_utils36.generateId)(),
|
|
7701
7711
|
mediaType: "application/octet-stream",
|
|
7702
7712
|
title: value.annotation.file_id,
|
|
7703
7713
|
filename: value.annotation.file_id,
|
|
@@ -7713,7 +7723,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
7713
7723
|
} else if (isErrorChunk(value)) {
|
|
7714
7724
|
encounteredStreamError = true;
|
|
7715
7725
|
finishReason = { unified: "error", raw: "error" };
|
|
7716
|
-
controller.enqueue({
|
|
7726
|
+
controller.enqueue({
|
|
7727
|
+
type: "error",
|
|
7728
|
+
error: (_S = createOpenAIProviderStreamError(value)) != null ? _S : value
|
|
7729
|
+
});
|
|
7717
7730
|
}
|
|
7718
7731
|
},
|
|
7719
7732
|
flush(controller) {
|