@ai-sdk/openai-compatible
Advanced tools
Comparing version 0.1.0 to 0.1.1
# @ai-sdk/openai-compatible | ||
## 0.1.1 | ||
### Patch Changes | ||
- 0a699f1: feat: add reasoning token support | ||
- Updated dependencies [e7a9ec9] | ||
- Updated dependencies [0a699f1] | ||
- @ai-sdk/provider-utils@2.1.1 | ||
- @ai-sdk/provider@1.0.5 | ||
## 0.1.0 | ||
@@ -4,0 +14,0 @@ |
@@ -385,3 +385,3 @@ "use strict"; | ||
async doGenerate(options) { | ||
var _a, _b, _c, _d, _e, _f; | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
const { args, warnings } = this.getArgs({ ...options }); | ||
@@ -407,3 +407,4 @@ const body = JSON.stringify(args); | ||
text: (_a = choice.message.content) != null ? _a : void 0, | ||
toolCalls: (_b = choice.message.tool_calls) == null ? void 0 : _b.map((toolCall) => { | ||
reasoning: (_b = choice.message.reasoning_content) != null ? _b : void 0, | ||
toolCalls: (_c = choice.message.tool_calls) == null ? void 0 : _c.map((toolCall) => { | ||
var _a2; | ||
@@ -419,4 +420,4 @@ return { | ||
usage: { | ||
promptTokens: (_d = (_c = response.usage) == null ? void 0 : _c.prompt_tokens) != null ? _d : NaN, | ||
completionTokens: (_f = (_e = response.usage) == null ? void 0 : _e.completion_tokens) != null ? _f : NaN | ||
promptTokens: (_e = (_d = response.usage) == null ? void 0 : _d.prompt_tokens) != null ? _e : NaN, | ||
completionTokens: (_g = (_f = response.usage) == null ? void 0 : _f.completion_tokens) != null ? _g : NaN | ||
}, | ||
@@ -436,2 +437,8 @@ rawCall: { rawPrompt, rawSettings }, | ||
controller.enqueue({ type: "response-metadata", ...result.response }); | ||
if (result.reasoning) { | ||
controller.enqueue({ | ||
type: "reasoning", | ||
textDelta: result.reasoning | ||
}); | ||
} | ||
if (result.text) { | ||
@@ -499,2 +506,3 @@ controller.enqueue({ | ||
new TransformStream({ | ||
// TODO we lost type safety on Chunk, most likely due to the error schema. MUST FIX | ||
transform(chunk, controller) { | ||
@@ -536,2 +544,8 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n; | ||
const delta = choice.delta; | ||
if (delta.reasoning_content != null) { | ||
controller.enqueue({ | ||
type: "reasoning", | ||
textDelta: delta.reasoning_content | ||
}); | ||
} | ||
if (delta.content != null) { | ||
@@ -655,2 +669,3 @@ controller.enqueue({ | ||
content: import_zod2.z.string().nullish(), | ||
reasoning_content: import_zod2.z.string().nullish(), | ||
tool_calls: import_zod2.z.array( | ||
@@ -685,2 +700,3 @@ import_zod2.z.object({ | ||
content: import_zod2.z.string().nullish(), | ||
reasoning_content: import_zod2.z.string().nullish(), | ||
tool_calls: import_zod2.z.array( | ||
@@ -687,0 +703,0 @@ import_zod2.z.object({ |
{ | ||
"name": "@ai-sdk/openai-compatible", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "Apache-2.0", | ||
@@ -29,4 +29,4 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@ai-sdk/provider": "1.0.4", | ||
"@ai-sdk/provider-utils": "2.1.0" | ||
"@ai-sdk/provider": "1.0.5", | ||
"@ai-sdk/provider-utils": "2.1.1" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
289278
2962
+ Added@ai-sdk/provider@1.0.5(transitive)
+ Added@ai-sdk/provider-utils@2.1.1(transitive)
- Removed@ai-sdk/provider@1.0.4(transitive)
- Removed@ai-sdk/provider-utils@2.1.0(transitive)
Updated@ai-sdk/provider@1.0.5
Updated@ai-sdk/provider-utils@2.1.1