ai 4.1.52 → 4.1.54
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 +17 -0
- package/dist/index.d.mts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# ai
|
2
2
|
|
3
|
+
## 4.1.54
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- ee1c787: fix (ai/core): correct spread apply order to fix extract reasoning middleware with generateText
|
8
|
+
|
9
|
+
## 4.1.53
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- e1d3d42: feat (ai): expose raw response body in generateText and generateObject
|
14
|
+
- Updated dependencies [e1d3d42]
|
15
|
+
- @ai-sdk/provider@1.0.10
|
16
|
+
- @ai-sdk/provider-utils@2.1.11
|
17
|
+
- @ai-sdk/ui-utils@1.1.17
|
18
|
+
- @ai-sdk/react@1.1.21
|
19
|
+
|
3
20
|
## 4.1.52
|
4
21
|
|
5
22
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
@@ -192,7 +192,7 @@ type LanguageModelResponseMetadata = {
|
|
192
192
|
*/
|
193
193
|
modelId: string;
|
194
194
|
/**
|
195
|
-
Response headers.
|
195
|
+
Response headers (available only for providers that use HTTP requests).
|
196
196
|
*/
|
197
197
|
headers?: Record<string, string>;
|
198
198
|
};
|
@@ -936,7 +936,12 @@ interface GenerateObjectResult<OBJECT> {
|
|
936
936
|
/**
|
937
937
|
Additional response information.
|
938
938
|
*/
|
939
|
-
readonly response: LanguageModelResponseMetadata
|
939
|
+
readonly response: LanguageModelResponseMetadata & {
|
940
|
+
/**
|
941
|
+
Response body (available only for providers that use HTTP requests).
|
942
|
+
*/
|
943
|
+
body?: unknown;
|
944
|
+
};
|
940
945
|
/**
|
941
946
|
Logprobs for the completion.
|
942
947
|
`undefined` if the mode does not support logprobs or if was not enabled.
|
@@ -1934,6 +1939,10 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
|
|
1934
1939
|
need to be added separately.
|
1935
1940
|
*/
|
1936
1941
|
messages: Array<CoreAssistantMessage | CoreToolMessage>;
|
1942
|
+
/**
|
1943
|
+
Response body (available only for providers that use HTTP requests).
|
1944
|
+
*/
|
1945
|
+
body?: unknown;
|
1937
1946
|
};
|
1938
1947
|
/**
|
1939
1948
|
Logprobs for the completion.
|
package/dist/index.d.ts
CHANGED
@@ -192,7 +192,7 @@ type LanguageModelResponseMetadata = {
|
|
192
192
|
*/
|
193
193
|
modelId: string;
|
194
194
|
/**
|
195
|
-
Response headers.
|
195
|
+
Response headers (available only for providers that use HTTP requests).
|
196
196
|
*/
|
197
197
|
headers?: Record<string, string>;
|
198
198
|
};
|
@@ -936,7 +936,12 @@ interface GenerateObjectResult<OBJECT> {
|
|
936
936
|
/**
|
937
937
|
Additional response information.
|
938
938
|
*/
|
939
|
-
readonly response: LanguageModelResponseMetadata
|
939
|
+
readonly response: LanguageModelResponseMetadata & {
|
940
|
+
/**
|
941
|
+
Response body (available only for providers that use HTTP requests).
|
942
|
+
*/
|
943
|
+
body?: unknown;
|
944
|
+
};
|
940
945
|
/**
|
941
946
|
Logprobs for the completion.
|
942
947
|
`undefined` if the mode does not support logprobs or if was not enabled.
|
@@ -1934,6 +1939,10 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
|
|
1934
1939
|
need to be added separately.
|
1935
1940
|
*/
|
1936
1941
|
messages: Array<CoreAssistantMessage | CoreToolMessage>;
|
1942
|
+
/**
|
1943
|
+
Response body (available only for providers that use HTTP requests).
|
1944
|
+
*/
|
1945
|
+
body?: unknown;
|
1937
1946
|
};
|
1938
1947
|
/**
|
1939
1948
|
Logprobs for the completion.
|
package/dist/index.js
CHANGED
@@ -2859,7 +2859,8 @@ async function generateObject({
|
|
2859
2859
|
request,
|
2860
2860
|
response: {
|
2861
2861
|
...response,
|
2862
|
-
headers: rawResponse == null ? void 0 : rawResponse.headers
|
2862
|
+
headers: rawResponse == null ? void 0 : rawResponse.headers,
|
2863
|
+
body: rawResponse == null ? void 0 : rawResponse.body
|
2863
2864
|
},
|
2864
2865
|
logprobs,
|
2865
2866
|
providerMetadata: resultProviderMetadata
|
@@ -3993,7 +3994,7 @@ async function generateText({
|
|
3993
3994
|
}),
|
3994
3995
|
tracer,
|
3995
3996
|
fn: async (span) => {
|
3996
|
-
var _a17, _b, _c, _d, _e, _f, _g, _h, _i;
|
3997
|
+
var _a17, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
3997
3998
|
const mode = {
|
3998
3999
|
type: "regular",
|
3999
4000
|
...prepareToolsAndToolChoice({ tools, toolChoice, activeTools })
|
@@ -4249,6 +4250,7 @@ async function generateText({
|
|
4249
4250
|
response: {
|
4250
4251
|
...currentModelResponse.response,
|
4251
4252
|
headers: (_i = currentModelResponse.rawResponse) == null ? void 0 : _i.headers,
|
4253
|
+
body: (_j = currentModelResponse.rawResponse) == null ? void 0 : _j.body,
|
4252
4254
|
messages: responseMessages
|
4253
4255
|
},
|
4254
4256
|
logprobs: currentModelResponse.logprobs,
|
@@ -6059,7 +6061,7 @@ function extractReasoningMiddleware({
|
|
6059
6061
|
);
|
6060
6062
|
textWithoutReasoning = beforeMatch + (beforeMatch.length > 0 && afterMatch.length > 0 ? separator : "") + afterMatch;
|
6061
6063
|
}
|
6062
|
-
return { text: textWithoutReasoning, reasoning
|
6064
|
+
return { ...rest, text: textWithoutReasoning, reasoning };
|
6063
6065
|
},
|
6064
6066
|
wrapStream: async ({ doStream }) => {
|
6065
6067
|
const { stream, ...rest } = await doStream();
|