@ai-sdk/openai 2.0.21 → 2.0.22
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 +8 -0
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -13
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +19 -13
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +19 -13
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2383,7 +2383,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2383
2383
|
};
|
|
2384
2384
|
}
|
|
2385
2385
|
async doGenerate(options) {
|
|
2386
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
2386
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2387
2387
|
const { args: body, warnings } = await this.getArgs(options);
|
|
2388
2388
|
const url = this.config.url({
|
|
2389
2389
|
path: "/responses",
|
|
@@ -2429,10 +2429,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2429
2429
|
}),
|
|
2430
2430
|
z13.object({
|
|
2431
2431
|
type: z13.literal("file_citation"),
|
|
2432
|
-
start_index: z13.number(),
|
|
2433
|
-
end_index: z13.number(),
|
|
2434
2432
|
file_id: z13.string(),
|
|
2435
|
-
|
|
2433
|
+
filename: z13.string().nullish(),
|
|
2434
|
+
index: z13.number().nullish(),
|
|
2435
|
+
start_index: z13.number().nullish(),
|
|
2436
|
+
end_index: z13.number().nullish(),
|
|
2437
|
+
quote: z13.string().nullish()
|
|
2436
2438
|
})
|
|
2437
2439
|
])
|
|
2438
2440
|
)
|
|
@@ -2550,8 +2552,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2550
2552
|
sourceType: "document",
|
|
2551
2553
|
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
|
|
2552
2554
|
mediaType: "text/plain",
|
|
2553
|
-
title: annotation.quote,
|
|
2554
|
-
filename: annotation.file_id
|
|
2555
|
+
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
2556
|
+
filename: (_l = annotation.filename) != null ? _l : annotation.file_id
|
|
2555
2557
|
});
|
|
2556
2558
|
}
|
|
2557
2559
|
}
|
|
@@ -2642,15 +2644,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2642
2644
|
return {
|
|
2643
2645
|
content,
|
|
2644
2646
|
finishReason: mapOpenAIResponseFinishReason({
|
|
2645
|
-
finishReason: (
|
|
2647
|
+
finishReason: (_m = response.incomplete_details) == null ? void 0 : _m.reason,
|
|
2646
2648
|
hasToolCalls: content.some((part) => part.type === "tool-call")
|
|
2647
2649
|
}),
|
|
2648
2650
|
usage: {
|
|
2649
2651
|
inputTokens: response.usage.input_tokens,
|
|
2650
2652
|
outputTokens: response.usage.output_tokens,
|
|
2651
2653
|
totalTokens: response.usage.input_tokens + response.usage.output_tokens,
|
|
2652
|
-
reasoningTokens: (
|
|
2653
|
-
cachedInputTokens: (
|
|
2654
|
+
reasoningTokens: (_o = (_n = response.usage.output_tokens_details) == null ? void 0 : _n.reasoning_tokens) != null ? _o : void 0,
|
|
2655
|
+
cachedInputTokens: (_q = (_p = response.usage.input_tokens_details) == null ? void 0 : _p.cached_tokens) != null ? _q : void 0
|
|
2654
2656
|
},
|
|
2655
2657
|
request: { body },
|
|
2656
2658
|
response: {
|
|
@@ -2702,7 +2704,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2702
2704
|
controller.enqueue({ type: "stream-start", warnings });
|
|
2703
2705
|
},
|
|
2704
2706
|
transform(chunk, controller) {
|
|
2705
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
2707
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
2706
2708
|
if (options.includeRawChunks) {
|
|
2707
2709
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
2708
2710
|
}
|
|
@@ -2968,8 +2970,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2968
2970
|
sourceType: "document",
|
|
2969
2971
|
id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
|
|
2970
2972
|
mediaType: "text/plain",
|
|
2971
|
-
title: value.annotation.quote,
|
|
2972
|
-
filename: value.annotation.file_id
|
|
2973
|
+
title: (_t = (_s = value.annotation.quote) != null ? _s : value.annotation.filename) != null ? _t : "Document",
|
|
2974
|
+
filename: (_u = value.annotation.filename) != null ? _u : value.annotation.file_id
|
|
2973
2975
|
});
|
|
2974
2976
|
}
|
|
2975
2977
|
} else if (isErrorChunk(value)) {
|
|
@@ -3147,7 +3149,11 @@ var responseAnnotationAddedSchema = z13.object({
|
|
|
3147
3149
|
z13.object({
|
|
3148
3150
|
type: z13.literal("file_citation"),
|
|
3149
3151
|
file_id: z13.string(),
|
|
3150
|
-
|
|
3152
|
+
filename: z13.string().nullish(),
|
|
3153
|
+
index: z13.number().nullish(),
|
|
3154
|
+
start_index: z13.number().nullish(),
|
|
3155
|
+
end_index: z13.number().nullish(),
|
|
3156
|
+
quote: z13.string().nullish()
|
|
3151
3157
|
})
|
|
3152
3158
|
])
|
|
3153
3159
|
});
|