ai 3.1.0 → 3.1.2
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/dist/index.d.mts +31 -4
- package/dist/index.d.ts +31 -4
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/rsc/dist/index.d.ts +7 -5
- package/rsc/dist/rsc-server.d.mts +7 -5
- package/rsc/dist/rsc-server.mjs +7 -7
- package/rsc/dist/rsc-server.mjs.map +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ai",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.2",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"sideEffects": false,
|
6
6
|
"main": "./dist/index.js",
|
@@ -102,8 +102,8 @@
|
|
102
102
|
"typescript": "5.1.3",
|
103
103
|
"vite-plugin-solid": "2.7.2",
|
104
104
|
"zod": "3.22.4",
|
105
|
-
"
|
106
|
-
"
|
105
|
+
"eslint-config-vercel-ai": "0.0.0",
|
106
|
+
"@vercel/ai-tsconfig": "0.0.0"
|
107
107
|
},
|
108
108
|
"peerDependencies": {
|
109
109
|
"react": "^18.2.0",
|
package/rsc/dist/index.d.ts
CHANGED
@@ -164,9 +164,11 @@ type Streamable$1 = ReactNode | Promise<ReactNode>;
|
|
164
164
|
type Renderer$1<T> = (props: T) => Streamable$1 | Generator<Streamable$1, Streamable$1, void> | AsyncGenerator<Streamable$1, Streamable$1, void>;
|
165
165
|
/**
|
166
166
|
* `render` is a helper function to create a streamable UI from some LLMs.
|
167
|
-
*
|
167
|
+
* This API only supports OpenAI's GPT models with Function Calling and Assistants Tools,
|
168
|
+
* please use `streamUI` for compatibility with other providers.
|
168
169
|
*
|
169
|
-
* @deprecated It's recommended to use the `
|
170
|
+
* @deprecated It's recommended to use the `streamUI` API for compatibility with AI SDK Core APIs
|
171
|
+
* and future features. This API will be removed in a future release.
|
170
172
|
*/
|
171
173
|
declare function render<TS extends {
|
172
174
|
[name: string]: z.Schema;
|
@@ -443,9 +445,9 @@ type RenderResult = {
|
|
443
445
|
value: ReactNode;
|
444
446
|
} & Awaited<ReturnType<LanguageModelV1['doStream']>>;
|
445
447
|
/**
|
446
|
-
* `
|
448
|
+
* `streamUI` is a helper function to create a streamable UI from LLMs.
|
447
449
|
*/
|
448
|
-
declare function
|
450
|
+
declare function streamUI<TOOLS extends {
|
449
451
|
[name: string]: z.ZodTypeAny;
|
450
452
|
} = {}>({ model, tools, system, prompt, messages, maxRetries, abortSignal, initial, text, ...settings }: CallSettings & Prompt & {
|
451
453
|
/**
|
@@ -564,4 +566,4 @@ declare function useAIState<AI extends AIProvider = any>(key: keyof InferAIState
|
|
564
566
|
declare function useActions<AI extends AIProvider = any>(): InferActions<AI, any>;
|
565
567
|
declare function useSyncUIState(): () => Promise<void>;
|
566
568
|
|
567
|
-
export { StreamableValue, createAI, createStreamableUI, createStreamableValue,
|
569
|
+
export { StreamableValue, createAI, createStreamableUI, createStreamableValue, getAIState, getMutableAIState, readStreamableValue, render, streamUI, useAIState, useActions, useStreamableValue, useSyncUIState, useUIState };
|
@@ -162,9 +162,11 @@ type Streamable$1 = ReactNode | Promise<ReactNode>;
|
|
162
162
|
type Renderer$1<T> = (props: T) => Streamable$1 | Generator<Streamable$1, Streamable$1, void> | AsyncGenerator<Streamable$1, Streamable$1, void>;
|
163
163
|
/**
|
164
164
|
* `render` is a helper function to create a streamable UI from some LLMs.
|
165
|
-
*
|
165
|
+
* This API only supports OpenAI's GPT models with Function Calling and Assistants Tools,
|
166
|
+
* please use `streamUI` for compatibility with other providers.
|
166
167
|
*
|
167
|
-
* @deprecated It's recommended to use the `
|
168
|
+
* @deprecated It's recommended to use the `streamUI` API for compatibility with AI SDK Core APIs
|
169
|
+
* and future features. This API will be removed in a future release.
|
168
170
|
*/
|
169
171
|
declare function render<TS extends {
|
170
172
|
[name: string]: z.Schema;
|
@@ -441,9 +443,9 @@ type RenderResult = {
|
|
441
443
|
value: ReactNode;
|
442
444
|
} & Awaited<ReturnType<LanguageModelV1['doStream']>>;
|
443
445
|
/**
|
444
|
-
* `
|
446
|
+
* `streamUI` is a helper function to create a streamable UI from LLMs.
|
445
447
|
*/
|
446
|
-
declare function
|
448
|
+
declare function streamUI<TOOLS extends {
|
447
449
|
[name: string]: z.ZodTypeAny;
|
448
450
|
} = {}>({ model, tools, system, prompt, messages, maxRetries, abortSignal, initial, text, ...settings }: CallSettings & Prompt & {
|
449
451
|
/**
|
@@ -500,4 +502,4 @@ declare function createAI<AIState = any, UIState = any, Actions extends AIAction
|
|
500
502
|
onGetUIState?: OnGetUIState<UIState>;
|
501
503
|
}): AIProvider<AIState, UIState, Actions>;
|
502
504
|
|
503
|
-
export { createAI, createStreamableUI, createStreamableValue,
|
505
|
+
export { createAI, createStreamableUI, createStreamableValue, getAIState, getMutableAIState, render, streamUI };
|
package/rsc/dist/rsc-server.mjs
CHANGED
@@ -1581,7 +1581,7 @@ import {
|
|
1581
1581
|
} from "@ai-sdk/provider";
|
1582
1582
|
import { safeParseJSON } from "@ai-sdk/provider-utils";
|
1583
1583
|
var defaultTextRenderer = ({ content }) => content;
|
1584
|
-
async function
|
1584
|
+
async function streamUI({
|
1585
1585
|
model,
|
1586
1586
|
tools,
|
1587
1587
|
system,
|
@@ -1595,24 +1595,24 @@ async function experimental_streamUI({
|
|
1595
1595
|
}) {
|
1596
1596
|
if (typeof model === "string") {
|
1597
1597
|
throw new Error(
|
1598
|
-
"`model` cannot be a string in `
|
1598
|
+
"`model` cannot be a string in `streamUI`. Use the actual model instance instead."
|
1599
1599
|
);
|
1600
1600
|
}
|
1601
1601
|
if ("functions" in settings) {
|
1602
1602
|
throw new Error(
|
1603
|
-
"`functions` is not supported in `
|
1603
|
+
"`functions` is not supported in `streamUI`, use `tools` instead."
|
1604
1604
|
);
|
1605
1605
|
}
|
1606
1606
|
if ("provider" in settings) {
|
1607
1607
|
throw new Error(
|
1608
|
-
"`provider` is no longer needed in `
|
1608
|
+
"`provider` is no longer needed in `streamUI`. Use `model` instead."
|
1609
1609
|
);
|
1610
1610
|
}
|
1611
1611
|
if (tools) {
|
1612
1612
|
for (const [name, tool] of Object.entries(tools)) {
|
1613
1613
|
if ("render" in tool) {
|
1614
1614
|
throw new Error(
|
1615
|
-
"Tool definition in `
|
1615
|
+
"Tool definition in `streamUI` should not have `render` property. Use `generate` instead. Found in tool: " + name
|
1616
1616
|
);
|
1617
1617
|
}
|
1618
1618
|
}
|
@@ -1835,9 +1835,9 @@ export {
|
|
1835
1835
|
createAI,
|
1836
1836
|
createStreamableUI,
|
1837
1837
|
createStreamableValue,
|
1838
|
-
experimental_streamUI,
|
1839
1838
|
getAIState,
|
1840
1839
|
getMutableAIState,
|
1841
|
-
render
|
1840
|
+
render,
|
1841
|
+
streamUI
|
1842
1842
|
};
|
1843
1843
|
//# sourceMappingURL=rsc-server.mjs.map
|