ai 3.1.29 → 3.1.31

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,656 +1,17 @@
1
- /**
2
- Typed tool call that is returned by generateText and streamText.
3
- It contains the tool call ID, the tool name, and the tool arguments.
4
- */
5
- interface ToolCall$1<NAME extends string, ARGS> {
6
- /**
7
- ID of the tool call. This ID is used to match the tool call with the tool result.
8
- */
9
- toolCallId: string;
10
- /**
11
- Name of the tool that is being called.
12
- */
13
- toolName: NAME;
14
- /**
15
- Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
16
- */
17
- args: ARGS;
18
- }
19
-
20
- /**
21
- Typed tool result that is returned by generateText and streamText.
22
- It contains the tool call ID, the tool name, the tool arguments, and the tool result.
23
- */
24
- interface ToolResult<NAME extends string, ARGS, RESULT> {
25
- /**
26
- ID of the tool call. This ID is used to match the tool call with the tool result.
27
- */
28
- toolCallId: string;
29
- /**
30
- Name of the tool that was called.
31
- */
32
- toolName: NAME;
33
- /**
34
- Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
35
- */
36
- args: ARGS;
37
- /**
38
- Result of the tool call. This is the result of the tool's execution.
39
- */
40
- result: RESULT;
41
- }
1
+ import { useChat as useChat$1, useCompletion as useCompletion$1, useAssistant as useAssistant$1 } from '@ai-sdk/react';
2
+ export { CreateMessage, Message, UseChatHelpers, UseChatOptions } from '@ai-sdk/react';
42
3
 
43
- type AssistantStatus = 'in_progress' | 'awaiting_message';
44
- type UseAssistantOptions = {
45
- /**
46
- * The API endpoint that accepts a `{ threadId: string | null; message: string; }` object and returns an `AssistantResponse` stream.
47
- * The threadId refers to an existing thread with messages (or is `null` to create a new thread).
48
- * The message is the next message that should be appended to the thread and sent to the assistant.
49
- */
50
- api: string;
51
- /**
52
- * An optional string that represents the ID of an existing thread.
53
- * If not provided, a new thread will be created.
54
- */
55
- threadId?: string;
56
- /**
57
- * An optional literal that sets the mode of credentials to be used on the request.
58
- * Defaults to "same-origin".
59
- */
60
- credentials?: RequestCredentials;
61
- /**
62
- * An optional object of headers to be passed to the API endpoint.
63
- */
64
- headers?: Record<string, string> | Headers;
65
- /**
66
- * An optional, additional body object to be passed to the API endpoint.
67
- */
68
- body?: object;
69
- /**
70
- * An optional callback that will be called when the assistant encounters an error.
71
- */
72
- onError?: (error: Error) => void;
73
- };
74
-
75
- /**
76
- * @deprecated use AI SDK 3.1 CoreTool / ToolResult instead
77
- */
78
- interface FunctionCall {
79
- /**
80
- * The arguments to call the function with, as generated by the model in JSON
81
- * format. Note that the model does not always generate valid JSON, and may
82
- * hallucinate parameters not defined by your function schema. Validate the
83
- * arguments in your code before calling your function.
84
- */
85
- arguments?: string;
86
- /**
87
- * The name of the function to call.
88
- */
89
- name?: string;
90
- }
91
- /**
92
- * @deprecated use AI SDK 3.1 CoreTool / ToolResult instead
93
- *
94
- * The tool calls generated by the model, such as function calls.
95
- */
96
- interface ToolCall {
97
- id: string;
98
- type: string;
99
- function: {
100
- name: string;
101
- arguments: string;
102
- };
103
- }
104
- /**
105
- * @deprecated use AI SDK 3.1 CoreTool / ToolChoice instead
106
- *
107
- * Controls which (if any) function is called by the model.
108
- * - none means the model will not call a function and instead generates a message.
109
- * - auto means the model can pick between generating a message or calling a function.
110
- * - Specifying a particular function via {"type: "function", "function": {"name": "my_function"}} forces the model to call that function.
111
- * none is the default when no functions are present. auto is the default if functions are present.
112
- */
113
- type ToolChoice = 'none' | 'auto' | {
114
- type: 'function';
115
- function: {
116
- name: string;
117
- };
118
- };
119
- /**
120
- * @deprecated use AI SDK 3.1 CoreTool instead
121
- *
122
- * A list of tools the model may call. Currently, only functions are supported as a tool.
123
- * Use this to provide a list of functions the model may generate JSON inputs for.
124
- */
125
- interface Tool {
126
- type: 'function';
127
- function: Function;
128
- }
129
- /**
130
- * @deprecated use AI SDK 3.1 CoreTool instead
131
- */
132
- interface Function {
133
- /**
134
- * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain
135
- * underscores and dashes, with a maximum length of 64.
136
- */
137
- name: string;
138
- /**
139
- * The parameters the functions accepts, described as a JSON Schema object. See the
140
- * [guide](/docs/guides/gpt/function-calling) for examples, and the
141
- * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
142
- * documentation about the format.
143
- *
144
- * To describe a function that accepts no parameters, provide the value
145
- * `{"type": "object", "properties": {}}`.
146
- */
147
- parameters: Record<string, unknown>;
148
- /**
149
- * A description of what the function does, used by the model to choose when and
150
- * how to call the function.
151
- */
152
- description?: string;
153
- }
154
- type IdGenerator = () => string;
155
- /**
156
- Tool invocations are either tool calls or tool results. For each assistant tool call,
157
- there is one tool invocation. While the call is in progress, the invocation is a tool call.
158
- Once the call is complete, the invocation is a tool result.
159
- */
160
- type ToolInvocation = ToolCall$1<string, any> | ToolResult<string, any, any>;
161
4
  /**
162
- * AI SDK UI Messages. They are used in the client and to communicate between the frontend and the API routes.
5
+ * @deprecated Use `useChat` from `@ai-sdk/react` instead.
163
6
  */
164
- interface Message {
165
- id: string;
166
- createdAt?: Date;
167
- content: string;
168
- tool_call_id?: string;
169
- /**
170
- @deprecated Use AI SDK RSC instead: https://sdk.vercel.ai/docs/ai-sdk-rsc
171
- */
172
- ui?: string | JSX.Element | JSX.Element[] | null | undefined;
173
- /**
174
- * `function` and `tool` roles are deprecated.
175
- */
176
- role: 'system' | 'user' | 'assistant' | 'function' | 'data' | 'tool';
177
- /**
178
- *
179
- * If the message has a role of `function`, the `name` field is the name of the function.
180
- * Otherwise, the name field should not be set.
181
- */
182
- name?: string;
183
- /**
184
- * @deprecated Use AI SDK 3.1 `toolInvocations` instead.
185
- *
186
- * If the assistant role makes a function call, the `function_call` field
187
- * contains the function call name and arguments. Otherwise, the field should
188
- * not be set. (Deprecated and replaced by tool_calls.)
189
- */
190
- function_call?: string | FunctionCall;
191
- data?: JSONValue;
192
- /**
193
- * @deprecated Use AI SDK 3.1 `toolInvocations` instead.
194
- *
195
- * If the assistant role makes a tool call, the `tool_calls` field contains
196
- * the tool call name and arguments. Otherwise, the field should not be set.
197
- */
198
- tool_calls?: string | ToolCall[];
199
- /**
200
- * Additional message-specific information added on the server via StreamData
201
- */
202
- annotations?: JSONValue[] | undefined;
203
- /**
204
- Tool invocations (that can be tool calls or tool results, depending on whether or not the invocation has finished)
205
- that the assistant made as part of this message.
206
- */
207
- toolInvocations?: Array<ToolInvocation>;
208
- }
209
- type CreateMessage = Omit<Message, 'id'> & {
210
- id?: Message['id'];
211
- };
212
- type ChatRequest = {
213
- messages: Message[];
214
- options?: RequestOptions;
215
- functions?: Array<Function>;
216
- function_call?: FunctionCall;
217
- data?: Record<string, string>;
218
- tools?: Array<Tool>;
219
- tool_choice?: ToolChoice;
220
- };
7
+ declare const useChat: typeof useChat$1;
221
8
  /**
222
- * @deprecated Use AI SDK 3.1 `streamText` and `onToolCall` instead.
9
+ * @deprecated Use `useCompletion` from `@ai-sdk/react` instead.
223
10
  */
224
- type FunctionCallHandler = (chatMessages: Message[], functionCall: FunctionCall) => Promise<ChatRequest | void>;
225
- /**
226
- * @deprecated Use AI SDK 3.1 `streamText` and `onToolCall` instead.
227
- */
228
- type ToolCallHandler = (chatMessages: Message[], toolCalls: ToolCall[]) => Promise<ChatRequest | void>;
229
- type RequestOptions = {
230
- /**
231
- An optional object of headers to be passed to the API endpoint.
232
- */
233
- headers?: Record<string, string> | Headers;
234
- /**
235
- An optional object to be passed to the API endpoint.
236
- */
237
- body?: object;
238
- };
239
- type ChatRequestOptions = {
240
- /**
241
- The options to be passed to the fetch call.
242
- */
243
- options?: RequestOptions;
244
- /**
245
- @deprecated
246
- */
247
- functions?: Array<Function>;
248
- /**
249
- @deprecated
250
- */
251
- function_call?: FunctionCall;
252
- /**
253
- @deprecated
254
- */
255
- tools?: Array<Tool>;
256
- /**
257
- @deprecated
258
- */
259
- tool_choice?: ToolChoice;
260
- /**
261
- Additional data to be sent to the server.
262
- */
263
- data?: Record<string, string>;
264
- };
265
- type UseChatOptions = {
266
- /**
267
- * The API endpoint that accepts a `{ messages: Message[] }` object and returns
268
- * a stream of tokens of the AI chat response. Defaults to `/api/chat`.
269
- */
270
- api?: string;
271
- /**
272
- * A unique identifier for the chat. If not provided, a random one will be
273
- * generated. When provided, the `useChat` hook with the same `id` will
274
- * have shared states across components.
275
- */
276
- id?: string;
277
- /**
278
- * Initial messages of the chat. Useful to load an existing chat history.
279
- */
280
- initialMessages?: Message[];
281
- /**
282
- * Initial input of the chat.
283
- */
284
- initialInput?: string;
285
- /**
286
- * @deprecated Use AI SDK 3.1 `streamText` and `onToolCall` instead.
287
- *
288
- * Callback function to be called when a function call is received.
289
- * If the function returns a `ChatRequest` object, the request will be sent
290
- * automatically to the API and will be used to update the chat.
291
- */
292
- experimental_onFunctionCall?: FunctionCallHandler;
293
- /**
294
- * @deprecated Use AI SDK 3.1 `streamText` and `onToolCall` instead.
295
- *
296
- * Callback function to be called when a tool call is received.
297
- * If the function returns a `ChatRequest` object, the request will be sent
298
- * automatically to the API and will be used to update the chat.
299
- */
300
- experimental_onToolCall?: ToolCallHandler;
301
- /**
302
- Optional callback function that is invoked when a tool call is received.
303
- Intended for automatic client-side tool execution.
304
-
305
- You can optionally return a result for the tool call,
306
- either synchronously or asynchronously.
307
- */
308
- onToolCall?: ({ toolCall, }: {
309
- toolCall: ToolCall$1<string, unknown>;
310
- }) => void | Promise<unknown> | unknown;
311
- /**
312
- * Callback function to be called when the API response is received.
313
- */
314
- onResponse?: (response: Response) => void | Promise<void>;
315
- /**
316
- * Callback function to be called when the chat is finished streaming.
317
- */
318
- onFinish?: (message: Message) => void;
319
- /**
320
- * Callback function to be called when an error is encountered.
321
- */
322
- onError?: (error: Error) => void;
323
- /**
324
- * A way to provide a function that is going to be used for ids for messages.
325
- * If not provided nanoid is used by default.
326
- */
327
- generateId?: IdGenerator;
328
- /**
329
- * The credentials mode to be used for the fetch request.
330
- * Possible values are: 'omit', 'same-origin', 'include'.
331
- * Defaults to 'same-origin'.
332
- */
333
- credentials?: RequestCredentials;
334
- /**
335
- * HTTP headers to be sent with the API request.
336
- */
337
- headers?: Record<string, string> | Headers;
338
- /**
339
- * Extra body object to be sent with the API request.
340
- * @example
341
- * Send a `sessionId` to the API along with the messages.
342
- * ```js
343
- * useChat({
344
- * body: {
345
- * sessionId: '123',
346
- * }
347
- * })
348
- * ```
349
- */
350
- body?: object;
351
- /**
352
- * Whether to send extra message fields such as `message.id` and `message.createdAt` to the API.
353
- * Defaults to `false`. When set to `true`, the API endpoint might need to
354
- * handle the extra fields before forwarding the request to the AI service.
355
- */
356
- sendExtraMessageFields?: boolean;
357
- /** Stream mode (default to "stream-data") */
358
- streamMode?: 'stream-data' | 'text';
359
- };
360
- type UseCompletionOptions = {
361
- /**
362
- * The API endpoint that accepts a `{ prompt: string }` object and returns
363
- * a stream of tokens of the AI completion response. Defaults to `/api/completion`.
364
- */
365
- api?: string;
366
- /**
367
- * An unique identifier for the chat. If not provided, a random one will be
368
- * generated. When provided, the `useChat` hook with the same `id` will
369
- * have shared states across components.
370
- */
371
- id?: string;
372
- /**
373
- * Initial prompt input of the completion.
374
- */
375
- initialInput?: string;
376
- /**
377
- * Initial completion result. Useful to load an existing history.
378
- */
379
- initialCompletion?: string;
380
- /**
381
- * Callback function to be called when the API response is received.
382
- */
383
- onResponse?: (response: Response) => void | Promise<void>;
384
- /**
385
- * Callback function to be called when the completion is finished streaming.
386
- */
387
- onFinish?: (prompt: string, completion: string) => void;
388
- /**
389
- * Callback function to be called when an error is encountered.
390
- */
391
- onError?: (error: Error) => void;
392
- /**
393
- * The credentials mode to be used for the fetch request.
394
- * Possible values are: 'omit', 'same-origin', 'include'.
395
- * Defaults to 'same-origin'.
396
- */
397
- credentials?: RequestCredentials;
398
- /**
399
- * HTTP headers to be sent with the API request.
400
- */
401
- headers?: Record<string, string> | Headers;
402
- /**
403
- * Extra body object to be sent with the API request.
404
- * @example
405
- * Send a `sessionId` to the API along with the prompt.
406
- * ```js
407
- * useChat({
408
- * body: {
409
- * sessionId: '123',
410
- * }
411
- * })
412
- * ```
413
- */
414
- body?: object;
415
- /** Stream mode (default to "stream-data") */
416
- streamMode?: 'stream-data' | 'text';
417
- };
418
- type JSONValue = null | string | number | boolean | {
419
- [x: string]: JSONValue;
420
- } | Array<JSONValue>;
421
-
422
- /**
423
- * A stream wrapper to send custom JSON-encoded data back to the client.
424
- */
425
- declare class StreamData {
426
- private encoder;
427
- private controller;
428
- stream: ReadableStream<Uint8Array>;
429
- private isClosed;
430
- private warningTimeout;
431
- constructor();
432
- close(): Promise<void>;
433
- append(value: JSONValue): void;
434
- appendMessageAnnotation(value: JSONValue): void;
435
- }
436
-
437
- /**
438
- * This is a naive implementation of the streaming React response API.
439
- * Currently, it can carry the original raw content, data payload and a special
440
- * UI payload and stream them via "rows" (nested promises).
441
- * It must be used inside Server Actions so Flight can encode the React elements.
442
- *
443
- * It is naive as unlike the StreamingTextResponse, it does not send the diff
444
- * between the rows, but flushing the full payload on each row.
445
- */
446
-
447
- type UINode = string | JSX.Element | JSX.Element[] | null | undefined;
448
- /**
449
- A utility class for streaming React responses.
450
-
451
- @deprecated Use AI SDK RSC instead: https://sdk.vercel.ai/docs/ai-sdk-rsc
452
- */
453
- declare class experimental_StreamingReactResponse {
454
- constructor(res: ReadableStream, options?: {
455
- ui?: (message: {
456
- content: string;
457
- data?: JSONValue[];
458
- }) => UINode | Promise<UINode>;
459
- data?: StreamData;
460
- generateId?: IdGenerator;
461
- });
462
- }
463
-
464
- type UseChatHelpers = {
465
- /** Current messages in the chat */
466
- messages: Message[];
467
- /** The error object of the API request */
468
- error: undefined | Error;
469
- /**
470
- * Append a user message to the chat list. This triggers the API call to fetch
471
- * the assistant's response.
472
- * @param message The message to append
473
- * @param options Additional options to pass to the API call
474
- */
475
- append: (message: Message | CreateMessage, chatRequestOptions?: ChatRequestOptions) => Promise<string | null | undefined>;
476
- /**
477
- * Reload the last AI chat response for the given chat history. If the last
478
- * message isn't from the assistant, it will request the API to generate a
479
- * new response.
480
- */
481
- reload: (chatRequestOptions?: ChatRequestOptions) => Promise<string | null | undefined>;
482
- /**
483
- * Abort the current request immediately, keep the generated tokens if any.
484
- */
485
- stop: () => void;
486
- /**
487
- * Update the `messages` state locally. This is useful when you want to
488
- * edit the messages on the client, and then trigger the `reload` method
489
- * manually to regenerate the AI response.
490
- */
491
- setMessages: (messages: Message[]) => void;
492
- /** The current value of the input */
493
- input: string;
494
- /** setState-powered method to update the input value */
495
- setInput: React.Dispatch<React.SetStateAction<string>>;
496
- /** An input/textarea-ready onChange handler to control the value of the input */
497
- handleInputChange: (e: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLTextAreaElement>) => void;
498
- /** Form submission handler to automatically reset input and append a user message */
499
- handleSubmit: (e: React.FormEvent<HTMLFormElement>, chatRequestOptions?: ChatRequestOptions) => void;
500
- metadata?: Object;
501
- /** Whether the API request is in progress */
502
- isLoading: boolean;
503
- /** Additional data added on the server via StreamData */
504
- data?: JSONValue[];
505
- };
506
- /**
507
- @deprecated Use AI SDK RSC instead: https://sdk.vercel.ai/docs/ai-sdk-rsc
508
- */
509
- type StreamingReactResponseAction = (payload: {
510
- messages: Message[];
511
- data?: Record<string, string>;
512
- }) => Promise<experimental_StreamingReactResponse>;
513
- declare function useChat({ api, id, initialMessages, initialInput, sendExtraMessageFields, experimental_onFunctionCall, experimental_onToolCall, onToolCall, experimental_maxAutomaticRoundtrips, maxAutomaticRoundtrips, maxToolRoundtrips, streamMode, onResponse, onFinish, onError, credentials, headers, body, generateId, }?: Omit<UseChatOptions, 'api'> & {
514
- api?: string | StreamingReactResponseAction;
515
- key?: string;
516
- /**
517
- @deprecated Use `maxToolRoundtrips` instead.
518
- */
519
- experimental_maxAutomaticRoundtrips?: number;
520
- /**
521
- @deprecated Use `maxToolRoundtrips` instead.
522
- */
523
- maxAutomaticRoundtrips?: number;
524
- /**
525
- Maximal number of automatic roundtrips for tool calls.
526
-
527
- An automatic tool call roundtrip is a call to the server with the
528
- tool call results when all tool calls in the last assistant
529
- message have results.
530
-
531
- A maximum number is required to prevent infinite loops in the
532
- case of misconfigured tools.
533
-
534
- By default, it's set to 0, which will disable the feature.
535
- */
536
- maxToolRoundtrips?: number;
537
- }): UseChatHelpers & {
538
- /**
539
- * @deprecated Use `addToolResult` instead.
540
- */
541
- experimental_addToolResult: ({ toolCallId, result, }: {
542
- toolCallId: string;
543
- result: any;
544
- }) => void;
545
- addToolResult: ({ toolCallId, result, }: {
546
- toolCallId: string;
547
- result: any;
548
- }) => void;
549
- };
550
-
551
- type UseCompletionHelpers = {
552
- /** The current completion result */
553
- completion: string;
554
- /**
555
- * Send a new prompt to the API endpoint and update the completion state.
556
- */
557
- complete: (prompt: string, options?: RequestOptions) => Promise<string | null | undefined>;
558
- /** The error object of the API request */
559
- error: undefined | Error;
560
- /**
561
- * Abort the current API request but keep the generated tokens.
562
- */
563
- stop: () => void;
564
- /**
565
- * Update the `completion` state locally.
566
- */
567
- setCompletion: (completion: string) => void;
568
- /** The current value of the input */
569
- input: string;
570
- /** setState-powered method to update the input value */
571
- setInput: React.Dispatch<React.SetStateAction<string>>;
572
- /**
573
- * An input/textarea-ready onChange handler to control the value of the input
574
- * @example
575
- * ```jsx
576
- * <input onChange={handleInputChange} value={input} />
577
- * ```
578
- */
579
- handleInputChange: (e: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLTextAreaElement>) => void;
580
- /**
581
- * Form submission handler to automatically reset input and append a user message
582
- * @example
583
- * ```jsx
584
- * <form onSubmit={handleSubmit}>
585
- * <input onChange={handleInputChange} value={input} />
586
- * </form>
587
- * ```
588
- */
589
- handleSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
590
- /** Whether the API request is in progress */
591
- isLoading: boolean;
592
- /** Additional data added on the server via StreamData */
593
- data?: JSONValue[];
594
- };
595
- declare function useCompletion({ api, id, initialCompletion, initialInput, credentials, headers, body, streamMode, onResponse, onFinish, onError, }?: UseCompletionOptions): UseCompletionHelpers;
596
-
597
- type UseAssistantHelpers = {
598
- /**
599
- * The current array of chat messages.
600
- */
601
- messages: Message[];
602
- /**
603
- * Update the message store with a new array of messages.
604
- */
605
- setMessages: React.Dispatch<React.SetStateAction<Message[]>>;
606
- /**
607
- * The current thread ID.
608
- */
609
- threadId: string | undefined;
610
- /**
611
- * The current value of the input field.
612
- */
613
- input: string;
614
- /**
615
- * Append a user message to the chat list. This triggers the API call to fetch
616
- * the assistant's response.
617
- * @param message The message to append
618
- * @param requestOptions Additional options to pass to the API call
619
- */
620
- append: (message: Message | CreateMessage, requestOptions?: {
621
- data?: Record<string, string>;
622
- }) => Promise<void>;
623
- /**
624
- Abort the current request immediately, keep the generated tokens if any.
625
- */
626
- stop: () => void;
627
- /**
628
- * setState-powered method to update the input value.
629
- */
630
- setInput: React.Dispatch<React.SetStateAction<string>>;
631
- /**
632
- * Handler for the `onChange` event of the input field to control the input's value.
633
- */
634
- handleInputChange: (event: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLTextAreaElement>) => void;
635
- /**
636
- * Form submission handler that automatically resets the input field and appends a user message.
637
- */
638
- submitMessage: (event?: React.FormEvent<HTMLFormElement>, requestOptions?: {
639
- data?: Record<string, string>;
640
- }) => Promise<void>;
641
- /**
642
- * The current status of the assistant. This can be used to show a loading indicator.
643
- */
644
- status: AssistantStatus;
645
- /**
646
- * The error thrown during the assistant message processing, if any.
647
- */
648
- error: undefined | unknown;
649
- };
650
- declare function useAssistant({ api, threadId: threadIdParam, credentials, headers, body, onError, }: UseAssistantOptions): UseAssistantHelpers;
11
+ declare const useCompletion: typeof useCompletion$1;
651
12
  /**
652
- @deprecated Use `useAssistant` instead.
13
+ * @deprecated Use `useAssistant` from `@ai-sdk/react` instead.
653
14
  */
654
- declare const experimental_useAssistant: typeof useAssistant;
15
+ declare const useAssistant: typeof useAssistant$1;
655
16
 
656
- export { CreateMessage, Message, UseAssistantHelpers, UseChatHelpers, UseChatOptions, UseCompletionHelpers, UseCompletionOptions, experimental_useAssistant, useAssistant, useChat, useCompletion };
17
+ export { useAssistant, useChat, useCompletion };