ai 3.4.32 → 4.0.0-canary.0

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.
@@ -1,13 +0,0 @@
1
- import { useChat as useChat$1, useCompletion as useCompletion$1 } from '@ai-sdk/solid';
2
- export { CreateMessage, Message, UseChatHelpers, UseChatOptions } from '@ai-sdk/solid';
3
-
4
- /**
5
- * @deprecated Use `useChat` from `@ai-sdk/solid` instead.
6
- */
7
- declare const useChat: typeof useChat$1;
8
- /**
9
- * @deprecated Use `useCompletion` from `@ai-sdk/solid` instead.
10
- */
11
- declare const useCompletion: typeof useCompletion$1;
12
-
13
- export { useChat, useCompletion };
@@ -1,13 +0,0 @@
1
- import { useChat as useChat$1, useCompletion as useCompletion$1 } from '@ai-sdk/solid';
2
- export { CreateMessage, Message, UseChatHelpers, UseChatOptions } from '@ai-sdk/solid';
3
-
4
- /**
5
- * @deprecated Use `useChat` from `@ai-sdk/solid` instead.
6
- */
7
- declare const useChat: typeof useChat$1;
8
- /**
9
- * @deprecated Use `useCompletion` from `@ai-sdk/solid` instead.
10
- */
11
- declare const useCompletion: typeof useCompletion$1;
12
-
13
- export { useChat, useCompletion };
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // solid/index.ts
21
- var solid_exports = {};
22
- __export(solid_exports, {
23
- useChat: () => useChat,
24
- useCompletion: () => useCompletion
25
- });
26
- module.exports = __toCommonJS(solid_exports);
27
- var import_solid = require("@ai-sdk/solid");
28
- var useChat = import_solid.useChat;
29
- var useCompletion = import_solid.useCompletion;
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- useChat,
33
- useCompletion
34
- });
35
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../index.ts"],"sourcesContent":["import {\n useChat as useChatSolid,\n useCompletion as useCompletionSolid,\n} from '@ai-sdk/solid';\n\n/**\n * @deprecated Use `useChat` from `@ai-sdk/solid` instead.\n */\nexport const useChat = useChatSolid;\n\n/**\n * @deprecated Use `useCompletion` from `@ai-sdk/solid` instead.\n */\nexport const useCompletion = useCompletionSolid;\n\n/**\n * @deprecated Use `@ai-sdk/solid` instead.\n */\nexport type {\n CreateMessage,\n Message,\n UseChatOptions,\n UseChatHelpers,\n} from '@ai-sdk/solid';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAGO;AAKA,IAAM,UAAU,aAAAA;AAKhB,IAAM,gBAAgB,aAAAC;","names":["useChatSolid","useCompletionSolid"]}
@@ -1,12 +0,0 @@
1
- // solid/index.ts
2
- import {
3
- useChat as useChatSolid,
4
- useCompletion as useCompletionSolid
5
- } from "@ai-sdk/solid";
6
- var useChat = useChatSolid;
7
- var useCompletion = useCompletionSolid;
8
- export {
9
- useChat,
10
- useCompletion
11
- };
12
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../index.ts"],"sourcesContent":["import {\n useChat as useChatSolid,\n useCompletion as useCompletionSolid,\n} from '@ai-sdk/solid';\n\n/**\n * @deprecated Use `useChat` from `@ai-sdk/solid` instead.\n */\nexport const useChat = useChatSolid;\n\n/**\n * @deprecated Use `useCompletion` from `@ai-sdk/solid` instead.\n */\nexport const useCompletion = useCompletionSolid;\n\n/**\n * @deprecated Use `@ai-sdk/solid` instead.\n */\nexport type {\n CreateMessage,\n Message,\n UseChatOptions,\n UseChatHelpers,\n} from '@ai-sdk/solid';\n"],"mappings":";AAAA;AAAA,EACE,WAAW;AAAA,EACX,iBAAiB;AAAA,OACZ;AAKA,IAAM,UAAU;AAKhB,IAAM,gBAAgB;","names":[]}
@@ -1,175 +0,0 @@
1
- import { UseChatOptions as UseChatOptions$1, Message, CreateMessage, ChatRequestOptions, JSONValue, RequestOptions, UseCompletionOptions, AssistantStatus, UseAssistantOptions } from '@ai-sdk/ui-utils';
2
- export { CreateMessage, Message, UseCompletionOptions } from '@ai-sdk/ui-utils';
3
- import { Readable, Writable } from 'svelte/store';
4
-
5
- type UseChatOptions = UseChatOptions$1 & {
6
- /**
7
- Maximum number of automatic roundtrips for tool calls.
8
-
9
- An automatic tool call roundtrip is a call to the server with the
10
- tool call results when all tool calls in the last assistant
11
- message have results.
12
-
13
- A maximum number is required to prevent infinite loops in the
14
- case of misconfigured tools.
15
-
16
- By default, it's set to 0, which will disable the feature.
17
-
18
- @deprecated Use `maxSteps` instead (which is `maxToolRoundtrips` + 1).
19
- */
20
- maxToolRoundtrips?: number;
21
- /**
22
- Maximum number of sequential LLM calls (steps), e.g. when you use tool calls. Must be at least 1.
23
-
24
- A maximum number is required to prevent infinite loops in the case of misconfigured tools.
25
-
26
- By default, it's set to 1, which means that only a single LLM call is made.
27
- */
28
- maxSteps?: number;
29
- };
30
- type UseChatHelpers = {
31
- /** Current messages in the chat */
32
- messages: Readable<Message[]>;
33
- /** The error object of the API request */
34
- error: Readable<undefined | Error>;
35
- /**
36
- * Append a user message to the chat list. This triggers the API call to fetch
37
- * the assistant's response.
38
- * @param message The message to append
39
- * @param chatRequestOptions Additional options to pass to the API call
40
- */
41
- append: (message: Message | CreateMessage, chatRequestOptions?: ChatRequestOptions) => Promise<string | null | undefined>;
42
- /**
43
- * Reload the last AI chat response for the given chat history. If the last
44
- * message isn't from the assistant, it will request the API to generate a
45
- * new response.
46
- */
47
- reload: (chatRequestOptions?: ChatRequestOptions) => Promise<string | null | undefined>;
48
- /**
49
- * Abort the current request immediately, keep the generated tokens if any.
50
- */
51
- stop: () => void;
52
- /**
53
- * Update the `messages` state locally. This is useful when you want to
54
- * edit the messages on the client, and then trigger the `reload` method
55
- * manually to regenerate the AI response.
56
- */
57
- setMessages: (messages: Message[] | ((messages: Message[]) => Message[])) => void;
58
- /** The current value of the input */
59
- input: Writable<string>;
60
- /** Form submission handler to automatically reset input and append a user message */
61
- handleSubmit: (event?: {
62
- preventDefault?: () => void;
63
- }, chatRequestOptions?: ChatRequestOptions) => void;
64
- metadata?: Object;
65
- /** Whether the API request is in progress */
66
- isLoading: Readable<boolean | undefined>;
67
- /** Additional data added on the server via StreamData */
68
- data: Readable<JSONValue[] | undefined>;
69
- /** Set the data of the chat. You can use this to transform or clear the chat data. */
70
- setData: (data: JSONValue[] | undefined | ((data: JSONValue[] | undefined) => JSONValue[] | undefined)) => void;
71
- };
72
- /**
73
- * @deprecated Use `useChat` from `@ai-sdk/svelte` instead.
74
- */
75
- declare function useChat({ api, id, initialMessages, initialInput, sendExtraMessageFields, experimental_onFunctionCall, experimental_onToolCall, streamMode, streamProtocol, onResponse, onFinish, onError, onToolCall, credentials, headers, body, generateId, fetch, keepLastMessageOnError, maxToolRoundtrips, maxSteps, }?: UseChatOptions): UseChatHelpers & {
76
- addToolResult: ({ toolCallId, result, }: {
77
- toolCallId: string;
78
- result: any;
79
- }) => void;
80
- };
81
-
82
- type UseCompletionHelpers = {
83
- /** The current completion result */
84
- completion: Readable<string>;
85
- /** The error object of the API request */
86
- error: Readable<undefined | Error>;
87
- /**
88
- * Send a new prompt to the API endpoint and update the completion state.
89
- */
90
- complete: (prompt: string, options?: RequestOptions) => Promise<string | null | undefined>;
91
- /**
92
- * Abort the current API request but keep the generated tokens.
93
- */
94
- stop: () => void;
95
- /**
96
- * Update the `completion` state locally.
97
- */
98
- setCompletion: (completion: string) => void;
99
- /** The current value of the input */
100
- input: Writable<string>;
101
- /**
102
- * Form submission handler to automatically reset input and append a user message
103
- * @example
104
- * ```jsx
105
- * <form onSubmit={handleSubmit}>
106
- * <input onChange={handleInputChange} value={input} />
107
- * </form>
108
- * ```
109
- */
110
- handleSubmit: (event?: {
111
- preventDefault?: () => void;
112
- }) => void;
113
- /** Whether the API request is in progress */
114
- isLoading: Readable<boolean | undefined>;
115
- /** Additional data added on the server via StreamData */
116
- data: Readable<JSONValue[] | undefined>;
117
- };
118
- /**
119
- * @deprecated Use `useCompletion` from `@ai-sdk/svelte` instead.
120
- */
121
- declare function useCompletion({ api, id, initialCompletion, initialInput, credentials, headers, body, streamMode, streamProtocol, onResponse, onFinish, onError, fetch, }?: UseCompletionOptions): UseCompletionHelpers;
122
-
123
- type UseAssistantHelpers = {
124
- /**
125
- * The current array of chat messages.
126
- */
127
- messages: Readable<Message[]>;
128
- /**
129
- * Update the message store with a new array of messages.
130
- */
131
- setMessages: (messages: Message[]) => void;
132
- /**
133
- * The current thread ID.
134
- */
135
- threadId: Readable<string | undefined>;
136
- /**
137
- * The current value of the input field.
138
- */
139
- input: Writable<string>;
140
- /**
141
- * Append a user message to the chat list. This triggers the API call to fetch
142
- * the assistant's response.
143
- * @param message The message to append
144
- * @param requestOptions Additional options to pass to the API call
145
- */
146
- append: (message: Message | CreateMessage, requestOptions?: {
147
- data?: Record<string, string>;
148
- }) => Promise<void>;
149
- /**
150
- Abort the current request immediately, keep the generated tokens if any.
151
- */
152
- stop: () => void;
153
- /**
154
- * Form submission handler that automatically resets the input field and appends a user message.
155
- */
156
- submitMessage: (event?: {
157
- preventDefault?: () => void;
158
- }, requestOptions?: {
159
- data?: Record<string, string>;
160
- }) => Promise<void>;
161
- /**
162
- * The current status of the assistant. This can be used to show a loading indicator.
163
- */
164
- status: Readable<AssistantStatus>;
165
- /**
166
- * The error thrown during the assistant message processing, if any.
167
- */
168
- error: Readable<undefined | Error>;
169
- };
170
- /**
171
- * @deprecated Use `useAssistant` from `@ai-sdk/svelte` instead.
172
- */
173
- declare function useAssistant({ api, threadId: threadIdParam, credentials, headers, body, onError, fetch, }: UseAssistantOptions): UseAssistantHelpers;
174
-
175
- export { UseAssistantHelpers, UseChatHelpers, UseChatOptions, UseCompletionHelpers, useAssistant, useChat, useCompletion };
@@ -1,175 +0,0 @@
1
- import { UseChatOptions as UseChatOptions$1, Message, CreateMessage, ChatRequestOptions, JSONValue, RequestOptions, UseCompletionOptions, AssistantStatus, UseAssistantOptions } from '@ai-sdk/ui-utils';
2
- export { CreateMessage, Message, UseCompletionOptions } from '@ai-sdk/ui-utils';
3
- import { Readable, Writable } from 'svelte/store';
4
-
5
- type UseChatOptions = UseChatOptions$1 & {
6
- /**
7
- Maximum number of automatic roundtrips for tool calls.
8
-
9
- An automatic tool call roundtrip is a call to the server with the
10
- tool call results when all tool calls in the last assistant
11
- message have results.
12
-
13
- A maximum number is required to prevent infinite loops in the
14
- case of misconfigured tools.
15
-
16
- By default, it's set to 0, which will disable the feature.
17
-
18
- @deprecated Use `maxSteps` instead (which is `maxToolRoundtrips` + 1).
19
- */
20
- maxToolRoundtrips?: number;
21
- /**
22
- Maximum number of sequential LLM calls (steps), e.g. when you use tool calls. Must be at least 1.
23
-
24
- A maximum number is required to prevent infinite loops in the case of misconfigured tools.
25
-
26
- By default, it's set to 1, which means that only a single LLM call is made.
27
- */
28
- maxSteps?: number;
29
- };
30
- type UseChatHelpers = {
31
- /** Current messages in the chat */
32
- messages: Readable<Message[]>;
33
- /** The error object of the API request */
34
- error: Readable<undefined | Error>;
35
- /**
36
- * Append a user message to the chat list. This triggers the API call to fetch
37
- * the assistant's response.
38
- * @param message The message to append
39
- * @param chatRequestOptions Additional options to pass to the API call
40
- */
41
- append: (message: Message | CreateMessage, chatRequestOptions?: ChatRequestOptions) => Promise<string | null | undefined>;
42
- /**
43
- * Reload the last AI chat response for the given chat history. If the last
44
- * message isn't from the assistant, it will request the API to generate a
45
- * new response.
46
- */
47
- reload: (chatRequestOptions?: ChatRequestOptions) => Promise<string | null | undefined>;
48
- /**
49
- * Abort the current request immediately, keep the generated tokens if any.
50
- */
51
- stop: () => void;
52
- /**
53
- * Update the `messages` state locally. This is useful when you want to
54
- * edit the messages on the client, and then trigger the `reload` method
55
- * manually to regenerate the AI response.
56
- */
57
- setMessages: (messages: Message[] | ((messages: Message[]) => Message[])) => void;
58
- /** The current value of the input */
59
- input: Writable<string>;
60
- /** Form submission handler to automatically reset input and append a user message */
61
- handleSubmit: (event?: {
62
- preventDefault?: () => void;
63
- }, chatRequestOptions?: ChatRequestOptions) => void;
64
- metadata?: Object;
65
- /** Whether the API request is in progress */
66
- isLoading: Readable<boolean | undefined>;
67
- /** Additional data added on the server via StreamData */
68
- data: Readable<JSONValue[] | undefined>;
69
- /** Set the data of the chat. You can use this to transform or clear the chat data. */
70
- setData: (data: JSONValue[] | undefined | ((data: JSONValue[] | undefined) => JSONValue[] | undefined)) => void;
71
- };
72
- /**
73
- * @deprecated Use `useChat` from `@ai-sdk/svelte` instead.
74
- */
75
- declare function useChat({ api, id, initialMessages, initialInput, sendExtraMessageFields, experimental_onFunctionCall, experimental_onToolCall, streamMode, streamProtocol, onResponse, onFinish, onError, onToolCall, credentials, headers, body, generateId, fetch, keepLastMessageOnError, maxToolRoundtrips, maxSteps, }?: UseChatOptions): UseChatHelpers & {
76
- addToolResult: ({ toolCallId, result, }: {
77
- toolCallId: string;
78
- result: any;
79
- }) => void;
80
- };
81
-
82
- type UseCompletionHelpers = {
83
- /** The current completion result */
84
- completion: Readable<string>;
85
- /** The error object of the API request */
86
- error: Readable<undefined | Error>;
87
- /**
88
- * Send a new prompt to the API endpoint and update the completion state.
89
- */
90
- complete: (prompt: string, options?: RequestOptions) => Promise<string | null | undefined>;
91
- /**
92
- * Abort the current API request but keep the generated tokens.
93
- */
94
- stop: () => void;
95
- /**
96
- * Update the `completion` state locally.
97
- */
98
- setCompletion: (completion: string) => void;
99
- /** The current value of the input */
100
- input: Writable<string>;
101
- /**
102
- * Form submission handler to automatically reset input and append a user message
103
- * @example
104
- * ```jsx
105
- * <form onSubmit={handleSubmit}>
106
- * <input onChange={handleInputChange} value={input} />
107
- * </form>
108
- * ```
109
- */
110
- handleSubmit: (event?: {
111
- preventDefault?: () => void;
112
- }) => void;
113
- /** Whether the API request is in progress */
114
- isLoading: Readable<boolean | undefined>;
115
- /** Additional data added on the server via StreamData */
116
- data: Readable<JSONValue[] | undefined>;
117
- };
118
- /**
119
- * @deprecated Use `useCompletion` from `@ai-sdk/svelte` instead.
120
- */
121
- declare function useCompletion({ api, id, initialCompletion, initialInput, credentials, headers, body, streamMode, streamProtocol, onResponse, onFinish, onError, fetch, }?: UseCompletionOptions): UseCompletionHelpers;
122
-
123
- type UseAssistantHelpers = {
124
- /**
125
- * The current array of chat messages.
126
- */
127
- messages: Readable<Message[]>;
128
- /**
129
- * Update the message store with a new array of messages.
130
- */
131
- setMessages: (messages: Message[]) => void;
132
- /**
133
- * The current thread ID.
134
- */
135
- threadId: Readable<string | undefined>;
136
- /**
137
- * The current value of the input field.
138
- */
139
- input: Writable<string>;
140
- /**
141
- * Append a user message to the chat list. This triggers the API call to fetch
142
- * the assistant's response.
143
- * @param message The message to append
144
- * @param requestOptions Additional options to pass to the API call
145
- */
146
- append: (message: Message | CreateMessage, requestOptions?: {
147
- data?: Record<string, string>;
148
- }) => Promise<void>;
149
- /**
150
- Abort the current request immediately, keep the generated tokens if any.
151
- */
152
- stop: () => void;
153
- /**
154
- * Form submission handler that automatically resets the input field and appends a user message.
155
- */
156
- submitMessage: (event?: {
157
- preventDefault?: () => void;
158
- }, requestOptions?: {
159
- data?: Record<string, string>;
160
- }) => Promise<void>;
161
- /**
162
- * The current status of the assistant. This can be used to show a loading indicator.
163
- */
164
- status: Readable<AssistantStatus>;
165
- /**
166
- * The error thrown during the assistant message processing, if any.
167
- */
168
- error: Readable<undefined | Error>;
169
- };
170
- /**
171
- * @deprecated Use `useAssistant` from `@ai-sdk/svelte` instead.
172
- */
173
- declare function useAssistant({ api, threadId: threadIdParam, credentials, headers, body, onError, fetch, }: UseAssistantOptions): UseAssistantHelpers;
174
-
175
- export { UseAssistantHelpers, UseChatHelpers, UseChatOptions, UseCompletionHelpers, useAssistant, useChat, useCompletion };