ai 4.1.20 → 4.1.22
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 +12 -0
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { IDGenerator } from '@ai-sdk/provider-utils';
|
2
2
|
export { CoreToolCall, CoreToolResult, IDGenerator, ToolCall, ToolResult, createIdGenerator, generateId } from '@ai-sdk/provider-utils';
|
3
3
|
import { DataStreamString, Message, Schema, DeepPartial, JSONValue as JSONValue$1, AssistantMessage, DataMessage } from '@ai-sdk/ui-utils';
|
4
|
-
export { AssistantMessage, AssistantStatus, Attachment, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DataStreamPart, DeepPartial, IdGenerator, JSONValue, Message, RequestOptions, Schema, ToolInvocation, UseAssistantOptions, formatAssistantStreamPart, formatDataStreamPart, jsonSchema, parseAssistantStreamPart, parseDataStreamPart, processDataStream, processTextStream } from '@ai-sdk/ui-utils';
|
4
|
+
export { AssistantMessage, AssistantStatus, Attachment, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DataStreamPart, DeepPartial, IdGenerator, JSONValue, Message, RequestOptions, Schema, ToolInvocation, UseAssistantOptions, formatAssistantStreamPart, formatDataStreamPart, jsonSchema, parseAssistantStreamPart, parseDataStreamPart, processDataStream, processTextStream, zodSchema } from '@ai-sdk/ui-utils';
|
5
5
|
import { JSONValue, EmbeddingModelV1, EmbeddingModelV1Embedding, ImageModelV1, ImageModelV1CallWarning, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning, LanguageModelV1ProviderMetadata, LanguageModelV1CallOptions, AISDKError, LanguageModelV1FunctionToolCall, JSONSchema7, ProviderV1, NoSuchModelError } from '@ai-sdk/provider';
|
6
6
|
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, LanguageModelV1, LanguageModelV1CallOptions, LanguageModelV1Prompt, LanguageModelV1StreamPart, LoadAPIKeyError, NoContentGeneratedError, NoSuchModelError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
7
7
|
import { ServerResponse } from 'node:http';
|
@@ -2322,6 +2322,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
2322
2322
|
@param experimental_generateMessageId - Generate a unique ID for each message.
|
2323
2323
|
|
2324
2324
|
@param onChunk - Callback that is called for each chunk of the stream. The stream processing will pause until the callback promise is resolved.
|
2325
|
+
@param onError - Callback that is called when an error occurs during streaming. You can use it to log errors.
|
2325
2326
|
@param onStepFinish - Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
2326
2327
|
@param onFinish - Callback that is called when the LLM response and all request tool executions
|
2327
2328
|
(for tools that have an `execute` function) are finished.
|
@@ -2329,7 +2330,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
2329
2330
|
@return
|
2330
2331
|
A result object for accessing different stream types and additional information.
|
2331
2332
|
*/
|
2332
|
-
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxSteps, experimental_generateMessageId: generateMessageId, experimental_output: output, experimental_continueSteps: continueSteps, experimental_telemetry: telemetry, experimental_providerMetadata, providerOptions, experimental_toolCallStreaming, toolCallStreaming, experimental_activeTools: activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
2333
|
+
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxSteps, experimental_generateMessageId: generateMessageId, experimental_output: output, experimental_continueSteps: continueSteps, experimental_telemetry: telemetry, experimental_providerMetadata, providerOptions, experimental_toolCallStreaming, toolCallStreaming, experimental_activeTools: activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onError, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
2333
2334
|
/**
|
2334
2335
|
The language model to use.
|
2335
2336
|
*/
|
@@ -2410,6 +2411,12 @@ Callback that is called for each chunk of the stream. The stream processing will
|
|
2410
2411
|
}>;
|
2411
2412
|
}) => Promise<void> | void;
|
2412
2413
|
/**
|
2414
|
+
Callback that is invoked when an error occurs during streaming. You can use it to log errors.
|
2415
|
+
*/
|
2416
|
+
onError?: (event: {
|
2417
|
+
error: unknown;
|
2418
|
+
}) => Promise<void> | void;
|
2419
|
+
/**
|
2413
2420
|
Callback that is called when the LLM response and all request tool executions
|
2414
2421
|
(for tools that have an `execute` function) are finished.
|
2415
2422
|
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { IDGenerator } from '@ai-sdk/provider-utils';
|
2
2
|
export { CoreToolCall, CoreToolResult, IDGenerator, ToolCall, ToolResult, createIdGenerator, generateId } from '@ai-sdk/provider-utils';
|
3
3
|
import { DataStreamString, Message, Schema, DeepPartial, JSONValue as JSONValue$1, AssistantMessage, DataMessage } from '@ai-sdk/ui-utils';
|
4
|
-
export { AssistantMessage, AssistantStatus, Attachment, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DataStreamPart, DeepPartial, IdGenerator, JSONValue, Message, RequestOptions, Schema, ToolInvocation, UseAssistantOptions, formatAssistantStreamPart, formatDataStreamPart, jsonSchema, parseAssistantStreamPart, parseDataStreamPart, processDataStream, processTextStream } from '@ai-sdk/ui-utils';
|
4
|
+
export { AssistantMessage, AssistantStatus, Attachment, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DataStreamPart, DeepPartial, IdGenerator, JSONValue, Message, RequestOptions, Schema, ToolInvocation, UseAssistantOptions, formatAssistantStreamPart, formatDataStreamPart, jsonSchema, parseAssistantStreamPart, parseDataStreamPart, processDataStream, processTextStream, zodSchema } from '@ai-sdk/ui-utils';
|
5
5
|
import { JSONValue, EmbeddingModelV1, EmbeddingModelV1Embedding, ImageModelV1, ImageModelV1CallWarning, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning, LanguageModelV1ProviderMetadata, LanguageModelV1CallOptions, AISDKError, LanguageModelV1FunctionToolCall, JSONSchema7, ProviderV1, NoSuchModelError } from '@ai-sdk/provider';
|
6
6
|
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, LanguageModelV1, LanguageModelV1CallOptions, LanguageModelV1Prompt, LanguageModelV1StreamPart, LoadAPIKeyError, NoContentGeneratedError, NoSuchModelError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
7
7
|
import { ServerResponse } from 'node:http';
|
@@ -2322,6 +2322,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
2322
2322
|
@param experimental_generateMessageId - Generate a unique ID for each message.
|
2323
2323
|
|
2324
2324
|
@param onChunk - Callback that is called for each chunk of the stream. The stream processing will pause until the callback promise is resolved.
|
2325
|
+
@param onError - Callback that is called when an error occurs during streaming. You can use it to log errors.
|
2325
2326
|
@param onStepFinish - Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
2326
2327
|
@param onFinish - Callback that is called when the LLM response and all request tool executions
|
2327
2328
|
(for tools that have an `execute` function) are finished.
|
@@ -2329,7 +2330,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
2329
2330
|
@return
|
2330
2331
|
A result object for accessing different stream types and additional information.
|
2331
2332
|
*/
|
2332
|
-
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxSteps, experimental_generateMessageId: generateMessageId, experimental_output: output, experimental_continueSteps: continueSteps, experimental_telemetry: telemetry, experimental_providerMetadata, providerOptions, experimental_toolCallStreaming, toolCallStreaming, experimental_activeTools: activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
2333
|
+
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxSteps, experimental_generateMessageId: generateMessageId, experimental_output: output, experimental_continueSteps: continueSteps, experimental_telemetry: telemetry, experimental_providerMetadata, providerOptions, experimental_toolCallStreaming, toolCallStreaming, experimental_activeTools: activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onError, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
2333
2334
|
/**
|
2334
2335
|
The language model to use.
|
2335
2336
|
*/
|
@@ -2410,6 +2411,12 @@ Callback that is called for each chunk of the stream. The stream processing will
|
|
2410
2411
|
}>;
|
2411
2412
|
}) => Promise<void> | void;
|
2412
2413
|
/**
|
2414
|
+
Callback that is invoked when an error occurs during streaming. You can use it to log errors.
|
2415
|
+
*/
|
2416
|
+
onError?: (event: {
|
2417
|
+
error: unknown;
|
2418
|
+
}) => Promise<void> | void;
|
2419
|
+
/**
|
2413
2420
|
Callback that is called when the LLM response and all request tool executions
|
2414
2421
|
(for tools that have an `execute` function) are finished.
|
2415
2422
|
|
package/dist/index.js
CHANGED
@@ -86,7 +86,8 @@ __export(streams_exports, {
|
|
86
86
|
streamObject: () => streamObject,
|
87
87
|
streamText: () => streamText,
|
88
88
|
tool: () => tool,
|
89
|
-
wrapLanguageModel: () => wrapLanguageModel
|
89
|
+
wrapLanguageModel: () => wrapLanguageModel,
|
90
|
+
zodSchema: () => import_ui_utils10.zodSchema
|
90
91
|
});
|
91
92
|
module.exports = __toCommonJS(streams_exports);
|
92
93
|
|
@@ -4700,6 +4701,7 @@ function streamText({
|
|
4700
4701
|
experimental_repairToolCall: repairToolCall,
|
4701
4702
|
experimental_transform: transform,
|
4702
4703
|
onChunk,
|
4704
|
+
onError,
|
4703
4705
|
onFinish,
|
4704
4706
|
onStepFinish,
|
4705
4707
|
_internal: {
|
@@ -4730,6 +4732,7 @@ function streamText({
|
|
4730
4732
|
continueSteps,
|
4731
4733
|
providerOptions,
|
4732
4734
|
onChunk,
|
4735
|
+
onError,
|
4733
4736
|
onFinish,
|
4734
4737
|
onStepFinish,
|
4735
4738
|
now: now2,
|
@@ -4811,6 +4814,7 @@ var DefaultStreamTextResult = class {
|
|
4811
4814
|
continueSteps,
|
4812
4815
|
providerOptions,
|
4813
4816
|
onChunk,
|
4817
|
+
onError,
|
4814
4818
|
onFinish,
|
4815
4819
|
onStepFinish,
|
4816
4820
|
now: now2,
|
@@ -4862,6 +4866,9 @@ var DefaultStreamTextResult = class {
|
|
4862
4866
|
if (part.type === "text-delta" || part.type === "reasoning" || part.type === "tool-call" || part.type === "tool-result" || part.type === "tool-call-streaming-start" || part.type === "tool-call-delta") {
|
4863
4867
|
await (onChunk == null ? void 0 : onChunk({ chunk: part }));
|
4864
4868
|
}
|
4869
|
+
if (part.type === "error") {
|
4870
|
+
await (onError == null ? void 0 : onError({ error: part.error }));
|
4871
|
+
}
|
4865
4872
|
if (part.type === "text-delta") {
|
4866
4873
|
recordedStepText += part.textDelta;
|
4867
4874
|
recordedContinuationText += part.textDelta;
|
@@ -6614,6 +6621,7 @@ var StreamData = class {
|
|
6614
6621
|
streamObject,
|
6615
6622
|
streamText,
|
6616
6623
|
tool,
|
6617
|
-
wrapLanguageModel
|
6624
|
+
wrapLanguageModel,
|
6625
|
+
zodSchema
|
6618
6626
|
});
|
6619
6627
|
//# sourceMappingURL=index.js.map
|