@ai-sdk/gateway 4.0.109 → 4.0.111
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 +16 -0
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/gateway-decision-model.ts +25 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
+
## 4.0.111
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [9667bf2]
|
|
8
|
+
- Updated dependencies [e57803c]
|
|
9
|
+
- Updated dependencies [81663cc]
|
|
10
|
+
- @ai-sdk/provider-utils@5.0.59
|
|
11
|
+
- @ai-sdk/provider@4.0.27
|
|
12
|
+
|
|
13
|
+
## 4.0.110
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- e280aa1: feat(gateway): send image files in decision state
|
|
18
|
+
|
|
3
19
|
## 4.0.109
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1838,11 +1838,7 @@ var GatewayDecisionModel = class {
|
|
|
1838
1838
|
return this.doDecide(options);
|
|
1839
1839
|
}
|
|
1840
1840
|
async doDecide({ state, questions, headers, abortSignal, providerOptions }) {
|
|
1841
|
-
const
|
|
1842
|
-
if (part.type === "file") throw new UnsupportedFunctionalityError({ functionality: "Gateway decision file input" });
|
|
1843
|
-
return part.type === "text" ? part.text : part.value;
|
|
1844
|
-
});
|
|
1845
|
-
const requestState = values.length === 1 && (typeof values[0] === "string" || typeof values[0] === "object" && values[0] !== null) ? values[0] : values;
|
|
1841
|
+
const stateParts = toGatewayDecisionState(state);
|
|
1846
1842
|
const gatewayOptions = await parseProviderOptions({
|
|
1847
1843
|
provider: "gateway",
|
|
1848
1844
|
providerOptions,
|
|
@@ -1858,7 +1854,7 @@ var GatewayDecisionModel = class {
|
|
|
1858
1854
|
url: this.getUrl(),
|
|
1859
1855
|
headers: combineHeaders(resolvedHeaders, headers ?? {}, this.getModelConfigHeaders(), await resolve(this.config.o11yHeaders)),
|
|
1860
1856
|
body: {
|
|
1861
|
-
|
|
1857
|
+
stateParts,
|
|
1862
1858
|
questions,
|
|
1863
1859
|
...validatedProviderOptions ? { providerOptions: validatedProviderOptions } : {}
|
|
1864
1860
|
},
|
|
@@ -1948,6 +1944,20 @@ const gatewayDecisionResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
|
1948
1944
|
warnings: z.array(gatewayDecisionWarningSchema).optional(),
|
|
1949
1945
|
providerMetadata: z.record(z.string(), z.record(z.string(), z.unknown())).optional()
|
|
1950
1946
|
})));
|
|
1947
|
+
function toGatewayDecisionState(state) {
|
|
1948
|
+
return state.map((part) => {
|
|
1949
|
+
if (part.type !== "file") return part;
|
|
1950
|
+
if (part.data.type !== "data") throw new UnsupportedFunctionalityError({ functionality: `Gateway decision file input: ${part.data.type} data` });
|
|
1951
|
+
const { data } = part.data;
|
|
1952
|
+
return {
|
|
1953
|
+
...part,
|
|
1954
|
+
data: {
|
|
1955
|
+
type: "data",
|
|
1956
|
+
data: typeof data === "string" ? data : convertUint8ArrayToBase64(data)
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1951
1961
|
//#endregion
|
|
1952
1962
|
//#region src/gateway-reranking-model.ts
|
|
1953
1963
|
var GatewayRerankingModel = class {
|
|
@@ -3040,7 +3050,7 @@ async function getVercelRequestId() {
|
|
|
3040
3050
|
}
|
|
3041
3051
|
//#endregion
|
|
3042
3052
|
//#region src/version.ts
|
|
3043
|
-
const VERSION = "4.0.
|
|
3053
|
+
const VERSION = "4.0.111";
|
|
3044
3054
|
//#endregion
|
|
3045
3055
|
//#region src/gateway-provider.ts
|
|
3046
3056
|
const AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|