ai 5.0.0-alpha.5 → 5.0.0-alpha.7
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 +27 -0
- package/dist/index.d.mts +275 -435
- package/dist/index.d.ts +275 -435
- package/dist/index.js +481 -593
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +481 -583
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
import { ToolResultContent, Schema, ToolCall, ToolResult, IdGenerator,
|
1
|
+
import { ToolResultContent, Schema, ToolCall, ToolResult, IdGenerator, Validator, StandardSchemaV1, FetchFunction } from '@ai-sdk/provider-utils';
|
2
2
|
export { IdGenerator, Schema, ToolCall, ToolResult, asSchema, createIdGenerator, generateId, jsonSchema } from '@ai-sdk/provider-utils';
|
3
3
|
import { AISDKError, SharedV2ProviderMetadata, SharedV2ProviderOptions, EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2CallWarning, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2CallWarning, LanguageModelV2Source, SpeechModelV1, SpeechModelV1CallWarning, TranscriptionModelV1, TranscriptionModelV1CallWarning, LanguageModelV2Usage, JSONObject, LanguageModelV2ToolCall, JSONSchema7, LanguageModelV2CallOptions, JSONParseError, TypeValidationError, LanguageModelV2Middleware, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
|
4
4
|
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, NoContentGeneratedError, NoSuchModelError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
5
|
+
import { GatewayModelId } from '@ai-sdk/gateway';
|
5
6
|
import { z } from 'zod';
|
6
7
|
import { ServerResponse } from 'node:http';
|
7
8
|
import { AttributeValue, Tracer } from '@opentelemetry/api';
|
@@ -382,7 +383,7 @@ type JSONValue = JSONValue$1;
|
|
382
383
|
/**
|
383
384
|
Language model that is used by the AI SDK Core functions.
|
384
385
|
*/
|
385
|
-
type LanguageModel = LanguageModelV2;
|
386
|
+
type LanguageModel = GatewayModelId | LanguageModelV2;
|
386
387
|
/**
|
387
388
|
Reason why a language model finished generating a response.
|
388
389
|
|
@@ -2114,13 +2115,10 @@ It is optional for backwards compatibility.
|
|
2114
2115
|
*/
|
2115
2116
|
type ToolInvocation = ({
|
2116
2117
|
state: 'partial-call';
|
2117
|
-
step?: number;
|
2118
2118
|
} & ToolCall<string, any>) | ({
|
2119
2119
|
state: 'call';
|
2120
|
-
step?: number;
|
2121
2120
|
} & ToolCall<string, any>) | ({
|
2122
2121
|
state: 'result';
|
2123
|
-
step?: number;
|
2124
2122
|
} & ToolResult<string, any, any>);
|
2125
2123
|
/**
|
2126
2124
|
The data types that can be used in the UI message for the UI message data parts.
|
@@ -2288,15 +2286,31 @@ declare function pipeTextStreamToResponse({ response, status, statusText, header
|
|
2288
2286
|
textStream: ReadableStream<string>;
|
2289
2287
|
} & ResponseInit): void;
|
2290
2288
|
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2289
|
+
declare const getOriginalFetch: () => typeof fetch;
|
2290
|
+
declare function callCompletionApi({ api, prompt, credentials, headers, body, streamProtocol, setCompletion, setLoading, setError, setAbortController, onFinish, onError, fetch, }: {
|
2291
|
+
api: string;
|
2292
|
+
prompt: string;
|
2293
|
+
credentials: RequestCredentials | undefined;
|
2294
|
+
headers: HeadersInit | undefined;
|
2295
|
+
body: Record<string, any>;
|
2296
|
+
streamProtocol: 'data' | 'text' | undefined;
|
2297
|
+
setCompletion: (completion: string) => void;
|
2298
|
+
setLoading: (loading: boolean) => void;
|
2299
|
+
setError: (error: Error | undefined) => void;
|
2300
|
+
setAbortController: (abortController: AbortController | null) => void;
|
2301
|
+
onFinish: ((prompt: string, completion: string) => void) | undefined;
|
2302
|
+
onError: ((error: Error) => void) | undefined;
|
2303
|
+
fetch: ReturnType<typeof getOriginalFetch> | undefined;
|
2304
|
+
}): Promise<string | null | undefined>;
|
2305
|
+
|
2306
|
+
type Job = () => Promise<void>;
|
2307
|
+
|
2308
|
+
declare class SerialJobExecutor {
|
2309
|
+
private queue;
|
2310
|
+
private isProcessing;
|
2311
|
+
private processQueue;
|
2312
|
+
run(job: Job): Promise<void>;
|
2313
|
+
}
|
2300
2314
|
|
2301
2315
|
/**
|
2302
2316
|
The result of an `embed` call.
|
@@ -2708,14 +2722,12 @@ type PrepareStepFunction<TOOLS extends Record<string, Tool> = Record<string, Too
|
|
2708
2722
|
steps: Array<StepResult<NoInfer<TOOLS>>>;
|
2709
2723
|
stepNumber: number;
|
2710
2724
|
model: LanguageModel;
|
2711
|
-
}) => PromiseLike<
|
2712
|
-
|
2713
|
-
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
2714
|
-
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2715
|
-
} | undefined> | {
|
2725
|
+
}) => PromiseLike<PrepareStepResult<TOOLS>> | PrepareStepResult<TOOLS>;
|
2726
|
+
type PrepareStepResult<TOOLS extends Record<string, Tool> = Record<string, Tool>> = {
|
2716
2727
|
model?: LanguageModel;
|
2717
2728
|
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
2718
2729
|
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2730
|
+
system?: string;
|
2719
2731
|
} | undefined;
|
2720
2732
|
|
2721
2733
|
type StopCondition<TOOLS extends ToolSet> = (options: {
|
@@ -2776,7 +2788,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
2776
2788
|
@returns
|
2777
2789
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
2778
2790
|
*/
|
2779
|
-
declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
|
2791
|
+
declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
|
2780
2792
|
/**
|
2781
2793
|
The language model to use.
|
2782
2794
|
*/
|
@@ -3696,15 +3708,6 @@ declare function parsePartialJson(jsonText: string | undefined): Promise<{
|
|
3696
3708
|
state: 'undefined-input' | 'successful-parse' | 'repaired-parse' | 'failed-parse';
|
3697
3709
|
}>;
|
3698
3710
|
|
3699
|
-
type Job = () => Promise<void>;
|
3700
|
-
|
3701
|
-
declare class SerialJobExecutor {
|
3702
|
-
private queue;
|
3703
|
-
private isProcessing;
|
3704
|
-
private processQueue;
|
3705
|
-
run(job: Job): Promise<void>;
|
3706
|
-
}
|
3707
|
-
|
3708
3711
|
/**
|
3709
3712
|
* Creates a ReadableStream that emits the provided values with an optional delay between each value.
|
3710
3713
|
*
|
@@ -4162,15 +4165,15 @@ declare const wrapLanguageModel: ({ model, middleware: middlewareArg, modelId, p
|
|
4162
4165
|
*
|
4163
4166
|
* @throws {NoSuchModelError} Throws when a requested model is not found and no fallback provider is available.
|
4164
4167
|
*/
|
4165
|
-
declare function customProvider<LANGUAGE_MODELS extends Record<string,
|
4168
|
+
declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV2>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV2<string>>, IMAGE_MODELS extends Record<string, ImageModelV2>>({ languageModels, textEmbeddingModels, imageModels, fallbackProvider, }: {
|
4166
4169
|
languageModels?: LANGUAGE_MODELS;
|
4167
4170
|
textEmbeddingModels?: EMBEDDING_MODELS;
|
4168
4171
|
imageModels?: IMAGE_MODELS;
|
4169
4172
|
fallbackProvider?: ProviderV2;
|
4170
|
-
}):
|
4171
|
-
languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>):
|
4172
|
-
textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>):
|
4173
|
-
imageModel(modelId: ExtractModelId<IMAGE_MODELS>):
|
4173
|
+
}): ProviderV2 & {
|
4174
|
+
languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV2;
|
4175
|
+
textEmbeddingModel(modelId: ExtractModelId<EMBEDDING_MODELS>): EmbeddingModelV2<string>;
|
4176
|
+
imageModel(modelId: ExtractModelId<IMAGE_MODELS>): ImageModelV2;
|
4174
4177
|
};
|
4175
4178
|
/**
|
4176
4179
|
* @deprecated Use `customProvider` instead.
|
@@ -4195,12 +4198,12 @@ declare class NoSuchProviderError extends NoSuchModelError {
|
|
4195
4198
|
|
4196
4199
|
type ExtractLiteralUnion<T> = T extends string ? string extends T ? never : T : never;
|
4197
4200
|
interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
|
4198
|
-
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never):
|
4199
|
-
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
4200
|
-
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never):
|
4201
|
-
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
4202
|
-
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never):
|
4203
|
-
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never):
|
4201
|
+
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
|
4202
|
+
languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): LanguageModelV2;
|
4203
|
+
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['textEmbeddingModel']>>[0]>}` : never): EmbeddingModelV2<string>;
|
4204
|
+
textEmbeddingModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): EmbeddingModelV2<string>;
|
4205
|
+
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['imageModel']>>[0]>}` : never): ImageModelV2;
|
4206
|
+
imageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${string}` : never): ImageModelV2;
|
4204
4207
|
}
|
4205
4208
|
/**
|
4206
4209
|
* Creates a registry for the given providers.
|
@@ -4449,114 +4452,72 @@ interface ChatTransport<MESSAGE_METADATA, DATA_TYPES extends UIDataTypes> {
|
|
4449
4452
|
requestType: 'generate' | 'resume';
|
4450
4453
|
}) => Promise<ReadableStream<UIMessageStreamPart>>;
|
4451
4454
|
}
|
4452
|
-
|
4453
|
-
|
4454
|
-
|
4455
|
-
|
4456
|
-
|
4457
|
-
|
4458
|
-
|
4459
|
-
|
4460
|
-
|
4461
|
-
|
4462
|
-
|
4463
|
-
|
4464
|
-
|
4465
|
-
|
4466
|
-
|
4467
|
-
|
4468
|
-
|
4469
|
-
|
4470
|
-
|
4471
|
-
|
4472
|
-
|
4473
|
-
|
4474
|
-
|
4475
|
-
|
4476
|
-
|
4477
|
-
|
4478
|
-
|
4479
|
-
|
4480
|
-
|
4481
|
-
|
4482
|
-
|
4483
|
-
|
4484
|
-
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
|
4489
|
-
|
4490
|
-
|
4491
|
-
|
4492
|
-
|
4493
|
-
|
4494
|
-
|
4495
|
-
|
4496
|
-
|
4497
|
-
|
4498
|
-
|
4499
|
-
|
4500
|
-
|
4501
|
-
|
4502
|
-
|
4503
|
-
|
4504
|
-
|
4505
|
-
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4510
|
-
|
4511
|
-
|
4512
|
-
|
4513
|
-
|
4514
|
-
|
4515
|
-
|
4516
|
-
|
4517
|
-
|
4518
|
-
* Defaults to 'same-origin'.
|
4519
|
-
*/
|
4520
|
-
credentials?: RequestCredentials;
|
4521
|
-
/**
|
4522
|
-
* HTTP headers to be sent with the API request.
|
4523
|
-
*/
|
4524
|
-
headers?: Record<string, string> | Headers;
|
4525
|
-
/**
|
4526
|
-
* Extra body object to be sent with the API request.
|
4527
|
-
* @example
|
4528
|
-
* Send a `sessionId` to the API along with the messages.
|
4529
|
-
* ```js
|
4530
|
-
* useChat({
|
4531
|
-
* body: {
|
4532
|
-
* sessionId: '123',
|
4533
|
-
* }
|
4534
|
-
* })
|
4535
|
-
* ```
|
4536
|
-
*/
|
4537
|
-
body?: object;
|
4538
|
-
/**
|
4539
|
-
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
4540
|
-
or to provide a custom fetch implementation for e.g. testing.
|
4541
|
-
*/
|
4542
|
-
fetch?: FetchFunction;
|
4543
|
-
/**
|
4544
|
-
* When a function is provided, it will be used
|
4545
|
-
* to prepare the request body for the chat API. This can be useful for
|
4546
|
-
* customizing the request body based on the messages and data in the chat.
|
4547
|
-
*
|
4548
|
-
* @param id The id of the chat.
|
4549
|
-
* @param messages The current messages in the chat.
|
4550
|
-
* @param requestBody The request body object passed in the chat request.
|
4551
|
-
*/
|
4552
|
-
prepareRequestBody?: (options: {
|
4553
|
-
chatId: string;
|
4554
|
-
messages: UIMessage<MESSAGE_METADATA, DATA_TYPES>[];
|
4555
|
-
requestBody?: object;
|
4556
|
-
}) => unknown;
|
4557
|
-
});
|
4558
|
-
submitMessages({ chatId, messages, abortController, body, headers, requestType, }: Parameters<ChatTransport<MESSAGE_METADATA, DATA_TYPES>['submitMessages']>[0]): Promise<ReadableStream<UIMessageStreamPart>>;
|
4559
|
-
}
|
4455
|
+
|
4456
|
+
type ChatRequestOptions = {
|
4457
|
+
/**
|
4458
|
+
Additional headers that should be to be passed to the API endpoint.
|
4459
|
+
*/
|
4460
|
+
headers?: Record<string, string> | Headers;
|
4461
|
+
/**
|
4462
|
+
Additional body JSON properties that should be sent to the API endpoint.
|
4463
|
+
*/
|
4464
|
+
body?: object;
|
4465
|
+
};
|
4466
|
+
type UseChatOptions<MESSAGE_METADATA = unknown, DATA_TYPE_SCHEMAS extends UIDataPartSchemas = UIDataPartSchemas> = {
|
4467
|
+
/**
|
4468
|
+
* A unique identifier for the chat. If not provided, a random one will be
|
4469
|
+
* generated. When provided, the `useChat` hook with the same `id` will
|
4470
|
+
* have shared states across components.
|
4471
|
+
*/
|
4472
|
+
chatId?: string;
|
4473
|
+
/**
|
4474
|
+
* Initial input of the chat.
|
4475
|
+
*/
|
4476
|
+
initialInput?: string;
|
4477
|
+
/**
|
4478
|
+
Optional callback function that is invoked when a tool call is received.
|
4479
|
+
Intended for automatic client-side tool execution.
|
4480
|
+
|
4481
|
+
You can optionally return a result for the tool call,
|
4482
|
+
either synchronously or asynchronously.
|
4483
|
+
*/
|
4484
|
+
onToolCall?: ({ toolCall, }: {
|
4485
|
+
toolCall: ToolCall<string, unknown>;
|
4486
|
+
}) => void | Promise<unknown> | unknown;
|
4487
|
+
/**
|
4488
|
+
* Optional callback function that is called when the assistant message is finished streaming.
|
4489
|
+
*
|
4490
|
+
* @param message The message that was streamed.
|
4491
|
+
*/
|
4492
|
+
onFinish?: (options: {
|
4493
|
+
message: UIMessage<MESSAGE_METADATA, InferUIDataParts<DATA_TYPE_SCHEMAS>>;
|
4494
|
+
}) => void;
|
4495
|
+
/**
|
4496
|
+
* Callback function to be called when an error is encountered.
|
4497
|
+
*/
|
4498
|
+
onError?: (error: Error) => void;
|
4499
|
+
/**
|
4500
|
+
* A way to provide a function that is going to be used for ids for messages and the chat.
|
4501
|
+
* If not provided the default AI SDK `generateId` is used.
|
4502
|
+
*/
|
4503
|
+
generateId?: IdGenerator;
|
4504
|
+
/**
|
4505
|
+
* Chat store that should be used.
|
4506
|
+
* It must not change during the component lifecycle.
|
4507
|
+
*
|
4508
|
+
* When a ChatStore is provided, it will be used as is.
|
4509
|
+
* It should be stable and the stability is guaranteed by the user.
|
4510
|
+
*
|
4511
|
+
* When a function is provided, it will be called to create a new chat store.
|
4512
|
+
* The function will be called when the hook is mounted and the chat store will be
|
4513
|
+
* created.
|
4514
|
+
* The function will be called with the same arguments as the hook is called with.
|
4515
|
+
* The function should return a ChatStoreOptions object.
|
4516
|
+
*
|
4517
|
+
* When no value is provided, a default chat store will be created.
|
4518
|
+
*/
|
4519
|
+
chatStore?: ChatStore<MESSAGE_METADATA, DATA_TYPE_SCHEMAS> | (() => ChatStoreOptions<MESSAGE_METADATA, DATA_TYPE_SCHEMAS>);
|
4520
|
+
};
|
4560
4521
|
|
4561
4522
|
type StreamingUIMessageState<MESSAGE_METADATA = unknown, UI_DATA_PART_SCHEMAS extends UIDataPartSchemas = UIDataPartSchemas> = {
|
4562
4523
|
message: UIMessage<MESSAGE_METADATA, InferUIDataParts<UI_DATA_PART_SCHEMAS>>;
|
@@ -4564,11 +4525,9 @@ type StreamingUIMessageState<MESSAGE_METADATA = unknown, UI_DATA_PART_SCHEMAS ex
|
|
4564
4525
|
activeReasoningPart: ReasoningUIPart | undefined;
|
4565
4526
|
partialToolCalls: Record<string, {
|
4566
4527
|
text: string;
|
4567
|
-
step: number;
|
4568
4528
|
index: number;
|
4569
4529
|
toolName: string;
|
4570
4530
|
}>;
|
4571
|
-
step: number;
|
4572
4531
|
};
|
4573
4532
|
|
4574
4533
|
interface ChatStoreSubscriber {
|
@@ -4704,123 +4663,42 @@ declare class ChatStore<MESSAGE_METADATA = unknown, UI_DATA_PART_SCHEMAS extends
|
|
4704
4663
|
private triggerRequest;
|
4705
4664
|
}
|
4706
4665
|
|
4707
|
-
|
4666
|
+
declare function convertFileListToFileUIParts(files: FileList | undefined): Promise<Array<FileUIPart>>;
|
4667
|
+
|
4668
|
+
/**
|
4669
|
+
Converts an array of messages from useChat into an array of CoreMessages that can be used
|
4670
|
+
with the AI core functions (e.g. `streamText`).
|
4671
|
+
*/
|
4672
|
+
declare function convertToModelMessages<TOOLS extends ToolSet = never>(messages: Array<Omit<UIMessage, 'id'>>, options?: {
|
4673
|
+
tools?: TOOLS;
|
4674
|
+
}): ModelMessage[];
|
4675
|
+
/**
|
4676
|
+
@deprecated Use `convertToModelMessages` instead.
|
4677
|
+
*/
|
4678
|
+
declare const convertToCoreMessages: typeof convertToModelMessages;
|
4679
|
+
|
4680
|
+
interface DefaultChatStoreOptions<MESSAGE_METADATA = unknown, UI_DATA_PART_SCHEMAS extends UIDataPartSchemas = UIDataPartSchemas> {
|
4708
4681
|
/**
|
4709
|
-
|
4682
|
+
* Schema for the message metadata. Validates the message metadata.
|
4683
|
+
* Message metadata can be undefined or must match the schema.
|
4710
4684
|
*/
|
4711
|
-
|
4685
|
+
messageMetadataSchema?: Validator<MESSAGE_METADATA> | StandardSchemaV1<MESSAGE_METADATA>;
|
4712
4686
|
/**
|
4713
|
-
|
4687
|
+
* Schema for the data types. Validates the data types.
|
4714
4688
|
*/
|
4715
|
-
|
4716
|
-
};
|
4717
|
-
type UseChatOptions<MESSAGE_METADATA = unknown, DATA_TYPE_SCHEMAS extends UIDataPartSchemas = UIDataPartSchemas> = {
|
4689
|
+
dataPartSchemas?: UI_DATA_PART_SCHEMAS;
|
4718
4690
|
/**
|
4719
|
-
*
|
4720
|
-
*
|
4721
|
-
*
|
4691
|
+
* The API endpoint that accepts a `{ messages: Message[] }` object and returns
|
4692
|
+
* a stream of tokens of the AI chat response.
|
4693
|
+
*
|
4694
|
+
* Defaults to `/api/chat`
|
4722
4695
|
*/
|
4723
|
-
|
4696
|
+
api?: string;
|
4724
4697
|
/**
|
4725
|
-
*
|
4698
|
+
* A way to provide a function that is going to be used for ids for messages and the chat.
|
4699
|
+
* If not provided the default AI SDK `generateId` is used.
|
4726
4700
|
*/
|
4727
|
-
|
4728
|
-
/**
|
4729
|
-
Optional callback function that is invoked when a tool call is received.
|
4730
|
-
Intended for automatic client-side tool execution.
|
4731
|
-
|
4732
|
-
You can optionally return a result for the tool call,
|
4733
|
-
either synchronously or asynchronously.
|
4734
|
-
*/
|
4735
|
-
onToolCall?: ({ toolCall, }: {
|
4736
|
-
toolCall: ToolCall<string, unknown>;
|
4737
|
-
}) => void | Promise<unknown> | unknown;
|
4738
|
-
/**
|
4739
|
-
* Optional callback function that is called when the assistant message is finished streaming.
|
4740
|
-
*
|
4741
|
-
* @param message The message that was streamed.
|
4742
|
-
*/
|
4743
|
-
onFinish?: (options: {
|
4744
|
-
message: UIMessage<MESSAGE_METADATA, InferUIDataParts<DATA_TYPE_SCHEMAS>>;
|
4745
|
-
}) => void;
|
4746
|
-
/**
|
4747
|
-
* Callback function to be called when an error is encountered.
|
4748
|
-
*/
|
4749
|
-
onError?: (error: Error) => void;
|
4750
|
-
/**
|
4751
|
-
* A way to provide a function that is going to be used for ids for messages and the chat.
|
4752
|
-
* If not provided the default AI SDK `generateId` is used.
|
4753
|
-
*/
|
4754
|
-
generateId?: IdGenerator;
|
4755
|
-
/**
|
4756
|
-
* Chat store that should be used.
|
4757
|
-
* It must not change during the component lifecycle.
|
4758
|
-
*
|
4759
|
-
* When a ChatStore is provided, it will be used as is.
|
4760
|
-
* It should be stable and the stability is guaranteed by the user.
|
4761
|
-
*
|
4762
|
-
* When a function is provided, it will be called to create a new chat store.
|
4763
|
-
* The function will be called when the hook is mounted and the chat store will be
|
4764
|
-
* created.
|
4765
|
-
* The function will be called with the same arguments as the hook is called with.
|
4766
|
-
* The function should return a ChatStoreOptions object.
|
4767
|
-
*
|
4768
|
-
* When no value is provided, a default chat store will be created.
|
4769
|
-
*/
|
4770
|
-
chatStore?: ChatStore<MESSAGE_METADATA, DATA_TYPE_SCHEMAS> | (() => ChatStoreOptions<MESSAGE_METADATA, DATA_TYPE_SCHEMAS>);
|
4771
|
-
};
|
4772
|
-
type OriginalUseChatOptions<MESSAGE_METADATA = unknown> = {
|
4773
|
-
/**
|
4774
|
-
* Schema for the message metadata. Validates the message metadata.
|
4775
|
-
* Message metadata can be undefined or must match the schema.
|
4776
|
-
*/
|
4777
|
-
messageMetadataSchema?: Schema<MESSAGE_METADATA>;
|
4778
|
-
/**
|
4779
|
-
* The API endpoint that accepts a `{ messages: Message[] }` object and returns
|
4780
|
-
* a stream of tokens of the AI chat response. Defaults to `/api/chat`.
|
4781
|
-
*/
|
4782
|
-
api?: string;
|
4783
|
-
/**
|
4784
|
-
* A unique identifier for the chat. If not provided, a random one will be
|
4785
|
-
* generated. When provided, the `useChat` hook with the same `id` will
|
4786
|
-
* have shared states across components.
|
4787
|
-
*/
|
4788
|
-
chatId?: string;
|
4789
|
-
/**
|
4790
|
-
* Initial messages of the chat. Useful to load an existing chat history.
|
4791
|
-
*/
|
4792
|
-
initialMessages?: UIMessage<NoInfer<MESSAGE_METADATA>>[];
|
4793
|
-
/**
|
4794
|
-
* Initial input of the chat.
|
4795
|
-
*/
|
4796
|
-
initialInput?: string;
|
4797
|
-
/**
|
4798
|
-
Optional callback function that is invoked when a tool call is received.
|
4799
|
-
Intended for automatic client-side tool execution.
|
4800
|
-
|
4801
|
-
You can optionally return a result for the tool call,
|
4802
|
-
either synchronously or asynchronously.
|
4803
|
-
*/
|
4804
|
-
onToolCall?: ({ toolCall, }: {
|
4805
|
-
toolCall: ToolCall<string, unknown>;
|
4806
|
-
}) => void | Promise<unknown> | unknown;
|
4807
|
-
/**
|
4808
|
-
* Optional callback function that is called when the assistant message is finished streaming.
|
4809
|
-
*
|
4810
|
-
* @param message The message that was streamed.
|
4811
|
-
*/
|
4812
|
-
onFinish?: (options: {
|
4813
|
-
message: UIMessage<NoInfer<MESSAGE_METADATA>>;
|
4814
|
-
}) => void;
|
4815
|
-
/**
|
4816
|
-
* Callback function to be called when an error is encountered.
|
4817
|
-
*/
|
4818
|
-
onError?: (error: Error) => void;
|
4819
|
-
/**
|
4820
|
-
* A way to provide a function that is going to be used for ids for messages and the chat.
|
4821
|
-
* If not provided the default AI SDK `generateId` is used.
|
4822
|
-
*/
|
4823
|
-
generateId?: IdGenerator;
|
4701
|
+
generateId?: IdGenerator;
|
4824
4702
|
/**
|
4825
4703
|
* The credentials mode to be used for the fetch request.
|
4826
4704
|
* Possible values are: 'omit', 'same-origin', 'include'.
|
@@ -4845,109 +4723,152 @@ type OriginalUseChatOptions<MESSAGE_METADATA = unknown> = {
|
|
4845
4723
|
*/
|
4846
4724
|
body?: object;
|
4847
4725
|
/**
|
4848
|
-
|
4849
|
-
|
4850
|
-
|
4851
|
-
/**
|
4852
|
-
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
4853
|
-
or to provide a custom fetch implementation for e.g. testing.
|
4854
|
-
*/
|
4726
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
4727
|
+
or to provide a custom fetch implementation for e.g. testing.
|
4728
|
+
*/
|
4855
4729
|
fetch?: FetchFunction;
|
4856
4730
|
/**
|
4857
|
-
|
4858
|
-
|
4731
|
+
Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.
|
4732
|
+
Must be at least 1.
|
4859
4733
|
|
4860
|
-
|
4734
|
+
A maximum number is required to prevent infinite loops in the case of misconfigured tools.
|
4861
4735
|
|
4862
|
-
|
4863
|
-
|
4736
|
+
By default, it's set to 1, which means that only a single LLM call is made.
|
4737
|
+
*/
|
4864
4738
|
maxSteps?: number;
|
4865
|
-
|
4866
|
-
|
4867
|
-
|
4868
|
-
|
4869
|
-
|
4870
|
-
|
4871
|
-
|
4872
|
-
|
4873
|
-
|
4874
|
-
|
4875
|
-
|
4876
|
-
|
4877
|
-
|
4878
|
-
|
4879
|
-
|
4880
|
-
|
4881
|
-
|
4882
|
-
|
4883
|
-
|
4884
|
-
|
4885
|
-
}):
|
4886
|
-
|
4887
|
-
declare const getOriginalFetch: () => typeof fetch;
|
4888
|
-
declare function callCompletionApi({ api, prompt, credentials, headers, body, streamProtocol, setCompletion, setLoading, setError, setAbortController, onFinish, onError, fetch, }: {
|
4889
|
-
api: string;
|
4890
|
-
prompt: string;
|
4891
|
-
credentials: RequestCredentials | undefined;
|
4892
|
-
headers: HeadersInit | undefined;
|
4893
|
-
body: Record<string, any>;
|
4894
|
-
streamProtocol: 'data' | 'text' | undefined;
|
4895
|
-
setCompletion: (completion: string) => void;
|
4896
|
-
setLoading: (loading: boolean) => void;
|
4897
|
-
setError: (error: Error | undefined) => void;
|
4898
|
-
setAbortController: (abortController: AbortController | null) => void;
|
4899
|
-
onFinish: ((prompt: string, completion: string) => void) | undefined;
|
4900
|
-
onError: ((error: Error) => void) | undefined;
|
4901
|
-
fetch: ReturnType<typeof getOriginalFetch> | undefined;
|
4902
|
-
}): Promise<string | null | undefined>;
|
4903
|
-
|
4904
|
-
declare function convertFileListToFileUIParts(files: FileList | undefined): Promise<Array<FileUIPart>>;
|
4905
|
-
|
4906
|
-
/**
|
4907
|
-
Converts an array of messages from useChat into an array of CoreMessages that can be used
|
4908
|
-
with the AI core functions (e.g. `streamText`).
|
4909
|
-
*/
|
4910
|
-
declare function convertToModelMessages<TOOLS extends ToolSet = never>(messages: Array<Omit<UIMessage, 'id'>>, options?: {
|
4911
|
-
tools?: TOOLS;
|
4912
|
-
}): ModelMessage[];
|
4913
|
-
/**
|
4914
|
-
@deprecated Use `convertToModelMessages` instead.
|
4915
|
-
*/
|
4916
|
-
declare const convertToCoreMessages: typeof convertToModelMessages;
|
4739
|
+
/**
|
4740
|
+
* When a function is provided, it will be used
|
4741
|
+
* to prepare the request body for the chat API. This can be useful for
|
4742
|
+
* customizing the request body based on the messages and data in the chat.
|
4743
|
+
*
|
4744
|
+
* @param chatId The id of the chat.
|
4745
|
+
* @param messages The current messages in the chat.
|
4746
|
+
* @param requestBody The request body object passed in the chat request.
|
4747
|
+
*/
|
4748
|
+
prepareRequestBody?: (options: {
|
4749
|
+
chatId: string;
|
4750
|
+
messages: UIMessage<MESSAGE_METADATA, InferUIDataParts<UI_DATA_PART_SCHEMAS>>[];
|
4751
|
+
requestBody?: object;
|
4752
|
+
}) => unknown;
|
4753
|
+
chats?: {
|
4754
|
+
[id: string]: {
|
4755
|
+
messages: UIMessage<MESSAGE_METADATA, InferUIDataParts<UI_DATA_PART_SCHEMAS>>[];
|
4756
|
+
};
|
4757
|
+
};
|
4758
|
+
}
|
4759
|
+
declare function defaultChatStoreOptions<MESSAGE_METADATA = unknown, UI_DATA_PART_SCHEMAS extends UIDataPartSchemas = UIDataPartSchemas>({ api, fetch, credentials, headers, body, prepareRequestBody, generateId, messageMetadataSchema, maxSteps, dataPartSchemas, chats, }: DefaultChatStoreOptions<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS>): () => ChatStoreOptions<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS>;
|
4917
4760
|
|
4918
|
-
declare
|
4761
|
+
declare class DefaultChatTransport<MESSAGE_METADATA, DATA_TYPES extends UIDataTypes> implements ChatTransport<MESSAGE_METADATA, DATA_TYPES> {
|
4762
|
+
private api;
|
4763
|
+
private credentials?;
|
4764
|
+
private headers?;
|
4765
|
+
private body?;
|
4766
|
+
private fetch?;
|
4767
|
+
private prepareRequestBody?;
|
4768
|
+
constructor({ api, credentials, headers, body, fetch, prepareRequestBody, }: {
|
4769
|
+
api: string;
|
4770
|
+
/**
|
4771
|
+
* The credentials mode to be used for the fetch request.
|
4772
|
+
* Possible values are: 'omit', 'same-origin', 'include'.
|
4773
|
+
* Defaults to 'same-origin'.
|
4774
|
+
*/
|
4775
|
+
credentials?: RequestCredentials;
|
4776
|
+
/**
|
4777
|
+
* HTTP headers to be sent with the API request.
|
4778
|
+
*/
|
4779
|
+
headers?: Record<string, string> | Headers;
|
4780
|
+
/**
|
4781
|
+
* Extra body object to be sent with the API request.
|
4782
|
+
* @example
|
4783
|
+
* Send a `sessionId` to the API along with the messages.
|
4784
|
+
* ```js
|
4785
|
+
* useChat({
|
4786
|
+
* body: {
|
4787
|
+
* sessionId: '123',
|
4788
|
+
* }
|
4789
|
+
* })
|
4790
|
+
* ```
|
4791
|
+
*/
|
4792
|
+
body?: object;
|
4793
|
+
/**
|
4794
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
4795
|
+
or to provide a custom fetch implementation for e.g. testing.
|
4796
|
+
*/
|
4797
|
+
fetch?: FetchFunction;
|
4798
|
+
/**
|
4799
|
+
* When a function is provided, it will be used
|
4800
|
+
* to prepare the request body for the chat API. This can be useful for
|
4801
|
+
* customizing the request body based on the messages and data in the chat.
|
4802
|
+
*
|
4803
|
+
* @param id The id of the chat.
|
4804
|
+
* @param messages The current messages in the chat.
|
4805
|
+
* @param requestBody The request body object passed in the chat request.
|
4806
|
+
*/
|
4807
|
+
prepareRequestBody?: (options: {
|
4808
|
+
chatId: string;
|
4809
|
+
messages: UIMessage<MESSAGE_METADATA, DATA_TYPES>[];
|
4810
|
+
requestBody?: object;
|
4811
|
+
}) => unknown;
|
4812
|
+
});
|
4813
|
+
submitMessages({ chatId, messages, abortController, body, headers, requestType, }: Parameters<ChatTransport<MESSAGE_METADATA, DATA_TYPES>['submitMessages']>[0]): Promise<ReadableStream<UIMessageStreamPart>>;
|
4814
|
+
}
|
4919
4815
|
|
4920
4816
|
declare function getToolInvocations(message: UIMessage): ToolInvocation[];
|
4921
4817
|
|
4922
|
-
declare
|
4923
|
-
|
4924
|
-
|
4925
|
-
|
4926
|
-
|
4927
|
-
|
4928
|
-
|
4929
|
-
|
4930
|
-
|
4931
|
-
|
4932
|
-
|
4933
|
-
|
4934
|
-
|
4935
|
-
|
4936
|
-
|
4937
|
-
/**
|
4938
|
-
|
4939
|
-
|
4940
|
-
|
4941
|
-
|
4942
|
-
|
4943
|
-
|
4944
|
-
|
4945
|
-
|
4946
|
-
|
4947
|
-
|
4948
|
-
|
4949
|
-
|
4950
|
-
})
|
4818
|
+
declare class TextStreamChatTransport<MESSAGE_METADATA, DATA_TYPES extends UIDataTypes> implements ChatTransport<MESSAGE_METADATA, DATA_TYPES> {
|
4819
|
+
private api;
|
4820
|
+
private credentials?;
|
4821
|
+
private headers?;
|
4822
|
+
private body?;
|
4823
|
+
private fetch?;
|
4824
|
+
private prepareRequestBody?;
|
4825
|
+
constructor({ api, credentials, headers, body, fetch, prepareRequestBody, }: {
|
4826
|
+
api: string;
|
4827
|
+
/**
|
4828
|
+
* The credentials mode to be used for the fetch request.
|
4829
|
+
* Possible values are: 'omit', 'same-origin', 'include'.
|
4830
|
+
* Defaults to 'same-origin'.
|
4831
|
+
*/
|
4832
|
+
credentials?: RequestCredentials;
|
4833
|
+
/**
|
4834
|
+
* HTTP headers to be sent with the API request.
|
4835
|
+
*/
|
4836
|
+
headers?: Record<string, string> | Headers;
|
4837
|
+
/**
|
4838
|
+
* Extra body object to be sent with the API request.
|
4839
|
+
* @example
|
4840
|
+
* Send a `sessionId` to the API along with the messages.
|
4841
|
+
* ```js
|
4842
|
+
* useChat({
|
4843
|
+
* body: {
|
4844
|
+
* sessionId: '123',
|
4845
|
+
* }
|
4846
|
+
* })
|
4847
|
+
* ```
|
4848
|
+
*/
|
4849
|
+
body?: object;
|
4850
|
+
/**
|
4851
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
4852
|
+
or to provide a custom fetch implementation for e.g. testing.
|
4853
|
+
*/
|
4854
|
+
fetch?: FetchFunction;
|
4855
|
+
/**
|
4856
|
+
* When a function is provided, it will be used
|
4857
|
+
* to prepare the request body for the chat API. This can be useful for
|
4858
|
+
* customizing the request body based on the messages and data in the chat.
|
4859
|
+
*
|
4860
|
+
* @param id The id of the chat.
|
4861
|
+
* @param messages The current messages in the chat.
|
4862
|
+
* @param requestBody The request body object passed in the chat request.
|
4863
|
+
*/
|
4864
|
+
prepareRequestBody?: (options: {
|
4865
|
+
chatId: string;
|
4866
|
+
messages: UIMessage<MESSAGE_METADATA, DATA_TYPES>[];
|
4867
|
+
requestBody?: object;
|
4868
|
+
}) => unknown;
|
4869
|
+
});
|
4870
|
+
submitMessages({ chatId, messages, abortController, body, headers, requestType, }: Parameters<ChatTransport<MESSAGE_METADATA, DATA_TYPES>['submitMessages']>[0]): Promise<ReadableStream<UIMessageStreamPart>>;
|
4871
|
+
}
|
4951
4872
|
|
4952
4873
|
type CompletionRequestOptions = {
|
4953
4874
|
/**
|
@@ -5021,85 +4942,4 @@ type UseCompletionOptions = {
|
|
5021
4942
|
fetch?: FetchFunction;
|
5022
4943
|
};
|
5023
4944
|
|
5024
|
-
|
5025
|
-
/**
|
5026
|
-
* Schema for the message metadata. Validates the message metadata.
|
5027
|
-
* Message metadata can be undefined or must match the schema.
|
5028
|
-
*/
|
5029
|
-
messageMetadataSchema?: Validator<MESSAGE_METADATA> | StandardSchemaV1<MESSAGE_METADATA>;
|
5030
|
-
/**
|
5031
|
-
* Schema for the data types. Validates the data types.
|
5032
|
-
*/
|
5033
|
-
dataPartSchemas?: UI_DATA_PART_SCHEMAS;
|
5034
|
-
/**
|
5035
|
-
* The API endpoint that accepts a `{ messages: Message[] }` object and returns
|
5036
|
-
* a stream of tokens of the AI chat response.
|
5037
|
-
*
|
5038
|
-
* Defaults to `/api/chat`
|
5039
|
-
*/
|
5040
|
-
api?: string;
|
5041
|
-
/**
|
5042
|
-
* A way to provide a function that is going to be used for ids for messages and the chat.
|
5043
|
-
* If not provided the default AI SDK `generateId` is used.
|
5044
|
-
*/
|
5045
|
-
generateId?: IdGenerator;
|
5046
|
-
/**
|
5047
|
-
* The credentials mode to be used for the fetch request.
|
5048
|
-
* Possible values are: 'omit', 'same-origin', 'include'.
|
5049
|
-
* Defaults to 'same-origin'.
|
5050
|
-
*/
|
5051
|
-
credentials?: RequestCredentials;
|
5052
|
-
/**
|
5053
|
-
* HTTP headers to be sent with the API request.
|
5054
|
-
*/
|
5055
|
-
headers?: Record<string, string> | Headers;
|
5056
|
-
/**
|
5057
|
-
* Extra body object to be sent with the API request.
|
5058
|
-
* @example
|
5059
|
-
* Send a `sessionId` to the API along with the messages.
|
5060
|
-
* ```js
|
5061
|
-
* useChat({
|
5062
|
-
* body: {
|
5063
|
-
* sessionId: '123',
|
5064
|
-
* }
|
5065
|
-
* })
|
5066
|
-
* ```
|
5067
|
-
*/
|
5068
|
-
body?: object;
|
5069
|
-
/**
|
5070
|
-
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
5071
|
-
or to provide a custom fetch implementation for e.g. testing.
|
5072
|
-
*/
|
5073
|
-
fetch?: FetchFunction;
|
5074
|
-
/**
|
5075
|
-
Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.
|
5076
|
-
Must be at least 1.
|
5077
|
-
|
5078
|
-
A maximum number is required to prevent infinite loops in the case of misconfigured tools.
|
5079
|
-
|
5080
|
-
By default, it's set to 1, which means that only a single LLM call is made.
|
5081
|
-
*/
|
5082
|
-
maxSteps?: number;
|
5083
|
-
/**
|
5084
|
-
* When a function is provided, it will be used
|
5085
|
-
* to prepare the request body for the chat API. This can be useful for
|
5086
|
-
* customizing the request body based on the messages and data in the chat.
|
5087
|
-
*
|
5088
|
-
* @param chatId The id of the chat.
|
5089
|
-
* @param messages The current messages in the chat.
|
5090
|
-
* @param requestBody The request body object passed in the chat request.
|
5091
|
-
*/
|
5092
|
-
prepareRequestBody?: (options: {
|
5093
|
-
chatId: string;
|
5094
|
-
messages: UIMessage<MESSAGE_METADATA, InferUIDataParts<UI_DATA_PART_SCHEMAS>>[];
|
5095
|
-
requestBody?: object;
|
5096
|
-
}) => unknown;
|
5097
|
-
chats?: {
|
5098
|
-
[id: string]: {
|
5099
|
-
messages: UIMessage<MESSAGE_METADATA, InferUIDataParts<UI_DATA_PART_SCHEMAS>>[];
|
5100
|
-
};
|
5101
|
-
};
|
5102
|
-
}
|
5103
|
-
declare function defaultChatStoreOptions<MESSAGE_METADATA = unknown, UI_DATA_PART_SCHEMAS extends UIDataPartSchemas = UIDataPartSchemas>({ api, fetch, credentials, headers, body, prepareRequestBody, generateId, messageMetadataSchema, maxSteps, dataPartSchemas, chats, }: DefaultChatStoreOptions<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS>): () => ChatStoreOptions<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS>;
|
5104
|
-
|
5105
|
-
export { ActiveResponse, AssistantContent, AssistantModelMessage, CallSettings, CallWarning, Chat, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatStoreFactory, ChatStoreOptions, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatStoreOptions, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, OriginalUseChatOptions, output as Output, PrepareStepFunction, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SerialJobExecutor, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStoreOptions, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isAssistantMessageWithCompletedToolCalls, isDeepEqualData, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, shouldResubmitMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, tool, toolModelMessageSchema, updateToolCallResult, userModelMessageSchema, wrapLanguageModel };
|
4945
|
+
export { ActiveResponse, AssistantContent, AssistantModelMessage, CallSettings, CallWarning, Chat, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatStoreFactory, ChatStoreOptions, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatStoreOptions, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SerialJobExecutor, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, assistantModelMessageSchema, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStoreOptions, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isDeepEqualData, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, tool, toolModelMessageSchema, userModelMessageSchema, wrapLanguageModel };
|