ai 6.0.0-beta.150 → 6.0.0-beta.151
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 +6 -0
- package/dist/index.d.mts +36 -5
- package/dist/index.d.ts +36 -5
- package/dist/index.js +29 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -25
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1807,10 +1807,41 @@ declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part i
|
|
|
1807
1807
|
* Type guard to check if a message part is a reasoning part.
|
|
1808
1808
|
*/
|
|
1809
1809
|
declare function isReasoningUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is ReasoningUIPart;
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1810
|
+
/**
|
|
1811
|
+
* Check if a message part is a static tool part.
|
|
1812
|
+
*
|
|
1813
|
+
* Static tools are tools for which the types are known at development time.
|
|
1814
|
+
*/
|
|
1815
|
+
declare function isStaticToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS>;
|
|
1816
|
+
/**
|
|
1817
|
+
* Check if a message part is a tool part.
|
|
1818
|
+
*
|
|
1819
|
+
* Tool parts are either static or dynamic tools.
|
|
1820
|
+
*
|
|
1821
|
+
* Use `isStaticToolUIPart` or `isDynamicToolUIPart` to check the type of the tool.
|
|
1822
|
+
*/
|
|
1823
|
+
declare function isToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS> | DynamicToolUIPart;
|
|
1824
|
+
/**
|
|
1825
|
+
* @deprecated Use isToolUIPart instead.
|
|
1826
|
+
*/
|
|
1827
|
+
declare const isToolOrDynamicToolUIPart: typeof isToolUIPart;
|
|
1828
|
+
/**
|
|
1829
|
+
* Returns the name of the static tool.
|
|
1830
|
+
*
|
|
1831
|
+
* The possible values are the keys of the tool set.
|
|
1832
|
+
*/
|
|
1833
|
+
declare function getStaticToolName<TOOLS extends UITools>(part: ToolUIPart<TOOLS>): keyof TOOLS;
|
|
1834
|
+
/**
|
|
1835
|
+
* Returns the name of the tool (static or dynamic).
|
|
1836
|
+
*
|
|
1837
|
+
* This function will not restrict the name to the keys of the tool set.
|
|
1838
|
+
* If you need to restrict the name to the keys of the tool set, use `getStaticToolName` instead.
|
|
1839
|
+
*/
|
|
1840
|
+
declare function getToolName(part: ToolUIPart<UITools> | DynamicToolUIPart): string;
|
|
1841
|
+
/**
|
|
1842
|
+
* @deprecated Use getToolName instead.
|
|
1843
|
+
*/
|
|
1844
|
+
declare const getToolOrDynamicToolName: typeof getToolName;
|
|
1814
1845
|
type InferUIMessageMetadata<T extends UIMessage> = T extends UIMessage<infer METADATA> ? METADATA : unknown;
|
|
1815
1846
|
type InferUIMessageData<T extends UIMessage> = T extends UIMessage<unknown, infer DATA_TYPES> ? DATA_TYPES : UIDataTypes;
|
|
1816
1847
|
type InferUIMessageTools<T extends UIMessage> = T extends UIMessage<unknown, UIDataTypes, infer TOOLS> ? TOOLS : UITools;
|
|
@@ -5371,4 +5402,4 @@ declare global {
|
|
|
5371
5402
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
5372
5403
|
}
|
|
5373
5404
|
|
|
5374
|
-
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapLanguageModel, wrapProvider };
|
|
5405
|
+
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapLanguageModel, wrapProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -1807,10 +1807,41 @@ declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part i
|
|
|
1807
1807
|
* Type guard to check if a message part is a reasoning part.
|
|
1808
1808
|
*/
|
|
1809
1809
|
declare function isReasoningUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is ReasoningUIPart;
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1810
|
+
/**
|
|
1811
|
+
* Check if a message part is a static tool part.
|
|
1812
|
+
*
|
|
1813
|
+
* Static tools are tools for which the types are known at development time.
|
|
1814
|
+
*/
|
|
1815
|
+
declare function isStaticToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS>;
|
|
1816
|
+
/**
|
|
1817
|
+
* Check if a message part is a tool part.
|
|
1818
|
+
*
|
|
1819
|
+
* Tool parts are either static or dynamic tools.
|
|
1820
|
+
*
|
|
1821
|
+
* Use `isStaticToolUIPart` or `isDynamicToolUIPart` to check the type of the tool.
|
|
1822
|
+
*/
|
|
1823
|
+
declare function isToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS> | DynamicToolUIPart;
|
|
1824
|
+
/**
|
|
1825
|
+
* @deprecated Use isToolUIPart instead.
|
|
1826
|
+
*/
|
|
1827
|
+
declare const isToolOrDynamicToolUIPart: typeof isToolUIPart;
|
|
1828
|
+
/**
|
|
1829
|
+
* Returns the name of the static tool.
|
|
1830
|
+
*
|
|
1831
|
+
* The possible values are the keys of the tool set.
|
|
1832
|
+
*/
|
|
1833
|
+
declare function getStaticToolName<TOOLS extends UITools>(part: ToolUIPart<TOOLS>): keyof TOOLS;
|
|
1834
|
+
/**
|
|
1835
|
+
* Returns the name of the tool (static or dynamic).
|
|
1836
|
+
*
|
|
1837
|
+
* This function will not restrict the name to the keys of the tool set.
|
|
1838
|
+
* If you need to restrict the name to the keys of the tool set, use `getStaticToolName` instead.
|
|
1839
|
+
*/
|
|
1840
|
+
declare function getToolName(part: ToolUIPart<UITools> | DynamicToolUIPart): string;
|
|
1841
|
+
/**
|
|
1842
|
+
* @deprecated Use getToolName instead.
|
|
1843
|
+
*/
|
|
1844
|
+
declare const getToolOrDynamicToolName: typeof getToolName;
|
|
1814
1845
|
type InferUIMessageMetadata<T extends UIMessage> = T extends UIMessage<infer METADATA> ? METADATA : unknown;
|
|
1815
1846
|
type InferUIMessageData<T extends UIMessage> = T extends UIMessage<unknown, infer DATA_TYPES> ? DATA_TYPES : UIDataTypes;
|
|
1816
1847
|
type InferUIMessageTools<T extends UIMessage> = T extends UIMessage<unknown, UIDataTypes, infer TOOLS> ? TOOLS : UITools;
|
|
@@ -5371,4 +5402,4 @@ declare global {
|
|
|
5371
5402
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
5372
5403
|
}
|
|
5373
5404
|
|
|
5374
|
-
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapLanguageModel, wrapProvider };
|
|
5405
|
+
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapLanguageModel, wrapProvider };
|
package/dist/index.js
CHANGED
|
@@ -91,6 +91,7 @@ __export(src_exports, {
|
|
|
91
91
|
generateId: () => import_provider_utils36.generateId,
|
|
92
92
|
generateObject: () => generateObject,
|
|
93
93
|
generateText: () => generateText,
|
|
94
|
+
getStaticToolName: () => getStaticToolName,
|
|
94
95
|
getTextFromDataUrl: () => getTextFromDataUrl,
|
|
95
96
|
getToolName: () => getToolName,
|
|
96
97
|
getToolOrDynamicToolName: () => getToolOrDynamicToolName,
|
|
@@ -99,6 +100,7 @@ __export(src_exports, {
|
|
|
99
100
|
isDeepEqualData: () => isDeepEqualData,
|
|
100
101
|
isFileUIPart: () => isFileUIPart,
|
|
101
102
|
isReasoningUIPart: () => isReasoningUIPart,
|
|
103
|
+
isStaticToolUIPart: () => isStaticToolUIPart,
|
|
102
104
|
isTextUIPart: () => isTextUIPart,
|
|
103
105
|
isToolOrDynamicToolUIPart: () => isToolOrDynamicToolUIPart,
|
|
104
106
|
isToolUIPart: () => isToolUIPart,
|
|
@@ -962,7 +964,7 @@ function detectMediaType({
|
|
|
962
964
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
963
965
|
|
|
964
966
|
// src/version.ts
|
|
965
|
-
var VERSION = true ? "6.0.0-beta.
|
|
967
|
+
var VERSION = true ? "6.0.0-beta.151" : "0.0.0-test";
|
|
966
968
|
|
|
967
969
|
// src/util/download/download.ts
|
|
968
970
|
var download = async ({ url }) => {
|
|
@@ -4424,21 +4426,23 @@ function isFileUIPart(part) {
|
|
|
4424
4426
|
function isReasoningUIPart(part) {
|
|
4425
4427
|
return part.type === "reasoning";
|
|
4426
4428
|
}
|
|
4427
|
-
function
|
|
4429
|
+
function isStaticToolUIPart(part) {
|
|
4428
4430
|
return part.type.startsWith("tool-");
|
|
4429
4431
|
}
|
|
4430
4432
|
function isDynamicToolUIPart(part) {
|
|
4431
4433
|
return part.type === "dynamic-tool";
|
|
4432
4434
|
}
|
|
4433
|
-
function
|
|
4434
|
-
return
|
|
4435
|
+
function isToolUIPart(part) {
|
|
4436
|
+
return isStaticToolUIPart(part) || isDynamicToolUIPart(part);
|
|
4435
4437
|
}
|
|
4436
|
-
|
|
4438
|
+
var isToolOrDynamicToolUIPart = isToolUIPart;
|
|
4439
|
+
function getStaticToolName(part) {
|
|
4437
4440
|
return part.type.split("-").slice(1).join("-");
|
|
4438
4441
|
}
|
|
4439
|
-
function
|
|
4440
|
-
return isDynamicToolUIPart(part) ? part.toolName :
|
|
4442
|
+
function getToolName(part) {
|
|
4443
|
+
return isDynamicToolUIPart(part) ? part.toolName : getStaticToolName(part);
|
|
4441
4444
|
}
|
|
4445
|
+
var getToolOrDynamicToolName = getToolName;
|
|
4442
4446
|
|
|
4443
4447
|
// src/ui/process-ui-message-stream.ts
|
|
4444
4448
|
function createStreamingUIMessageState({
|
|
@@ -4472,9 +4476,7 @@ function processUIMessageStream({
|
|
|
4472
4476
|
await runUpdateMessageJob(async ({ state, write }) => {
|
|
4473
4477
|
var _a15, _b, _c, _d;
|
|
4474
4478
|
function getToolInvocation(toolCallId) {
|
|
4475
|
-
const toolInvocations = state.message.parts.filter(
|
|
4476
|
-
isToolOrDynamicToolUIPart
|
|
4477
|
-
);
|
|
4479
|
+
const toolInvocations = state.message.parts.filter(isToolUIPart);
|
|
4478
4480
|
const toolInvocation = toolInvocations.find(
|
|
4479
4481
|
(invocation) => invocation.toolCallId === toolCallId
|
|
4480
4482
|
);
|
|
@@ -4488,7 +4490,7 @@ function processUIMessageStream({
|
|
|
4488
4490
|
function updateToolPart(options) {
|
|
4489
4491
|
var _a16;
|
|
4490
4492
|
const part = state.message.parts.find(
|
|
4491
|
-
(part2) =>
|
|
4493
|
+
(part2) => isStaticToolUIPart(part2) && part2.toolCallId === options.toolCallId
|
|
4492
4494
|
);
|
|
4493
4495
|
const anyOptions = options;
|
|
4494
4496
|
const anyPart = part;
|
|
@@ -4660,7 +4662,7 @@ function processUIMessageStream({
|
|
|
4660
4662
|
break;
|
|
4661
4663
|
}
|
|
4662
4664
|
case "tool-input-start": {
|
|
4663
|
-
const toolInvocations = state.message.parts.filter(
|
|
4665
|
+
const toolInvocations = state.message.parts.filter(isStaticToolUIPart);
|
|
4664
4666
|
state.partialToolCalls[chunk.toolCallId] = {
|
|
4665
4667
|
text: "",
|
|
4666
4668
|
toolName: chunk.toolName,
|
|
@@ -4801,7 +4803,7 @@ function processUIMessageStream({
|
|
|
4801
4803
|
} else {
|
|
4802
4804
|
updateToolPart({
|
|
4803
4805
|
toolCallId: chunk.toolCallId,
|
|
4804
|
-
toolName:
|
|
4806
|
+
toolName: getStaticToolName(toolInvocation),
|
|
4805
4807
|
state: "output-available",
|
|
4806
4808
|
input: toolInvocation.input,
|
|
4807
4809
|
output: chunk.output,
|
|
@@ -4828,7 +4830,7 @@ function processUIMessageStream({
|
|
|
4828
4830
|
} else {
|
|
4829
4831
|
updateToolPart({
|
|
4830
4832
|
toolCallId: chunk.toolCallId,
|
|
4831
|
-
toolName:
|
|
4833
|
+
toolName: getStaticToolName(toolInvocation),
|
|
4832
4834
|
state: "output-error",
|
|
4833
4835
|
input: toolInvocation.input,
|
|
4834
4836
|
rawInput: toolInvocation.rawInput,
|
|
@@ -7039,7 +7041,7 @@ function convertToModelMessages(messages, options) {
|
|
|
7039
7041
|
messages = messages.map((message) => ({
|
|
7040
7042
|
...message,
|
|
7041
7043
|
parts: message.parts.filter(
|
|
7042
|
-
(part) => !
|
|
7044
|
+
(part) => !isToolUIPart(part) || part.state !== "input-streaming" && part.state !== "input-available"
|
|
7043
7045
|
)
|
|
7044
7046
|
}));
|
|
7045
7047
|
}
|
|
@@ -7121,8 +7123,8 @@ function convertToModelMessages(messages, options) {
|
|
|
7121
7123
|
text: part.text,
|
|
7122
7124
|
providerOptions: part.providerMetadata
|
|
7123
7125
|
});
|
|
7124
|
-
} else if (
|
|
7125
|
-
const toolName =
|
|
7126
|
+
} else if (isToolUIPart(part)) {
|
|
7127
|
+
const toolName = getToolName(part);
|
|
7126
7128
|
if (part.state !== "input-streaming") {
|
|
7127
7129
|
content.push({
|
|
7128
7130
|
type: "tool-call",
|
|
@@ -7171,7 +7173,7 @@ function convertToModelMessages(messages, options) {
|
|
|
7171
7173
|
content
|
|
7172
7174
|
});
|
|
7173
7175
|
const toolParts = block.filter(
|
|
7174
|
-
(part) =>
|
|
7176
|
+
(part) => isToolUIPart(part) && part.providerExecuted !== true
|
|
7175
7177
|
);
|
|
7176
7178
|
if (toolParts.length > 0) {
|
|
7177
7179
|
modelMessages.push({
|
|
@@ -7193,7 +7195,7 @@ function convertToModelMessages(messages, options) {
|
|
|
7193
7195
|
outputs.push({
|
|
7194
7196
|
type: "tool-result",
|
|
7195
7197
|
toolCallId: toolPart.toolCallId,
|
|
7196
|
-
toolName:
|
|
7198
|
+
toolName: getToolName(toolPart),
|
|
7197
7199
|
output: {
|
|
7198
7200
|
type: "error-text",
|
|
7199
7201
|
value: (_b2 = toolPart.approval.reason) != null ? _b2 : "Tool execution denied."
|
|
@@ -7204,7 +7206,7 @@ function convertToModelMessages(messages, options) {
|
|
|
7204
7206
|
}
|
|
7205
7207
|
case "output-error":
|
|
7206
7208
|
case "output-available": {
|
|
7207
|
-
const toolName =
|
|
7209
|
+
const toolName = getToolName(toolPart);
|
|
7208
7210
|
outputs.push({
|
|
7209
7211
|
type: "tool-result",
|
|
7210
7212
|
toolCallId: toolPart.toolCallId,
|
|
@@ -7229,7 +7231,7 @@ function convertToModelMessages(messages, options) {
|
|
|
7229
7231
|
var processBlock = processBlock2;
|
|
7230
7232
|
let block = [];
|
|
7231
7233
|
for (const part of message.parts) {
|
|
7232
|
-
if (isTextUIPart(part) || isReasoningUIPart(part) || isFileUIPart(part) ||
|
|
7234
|
+
if (isTextUIPart(part) || isReasoningUIPart(part) || isFileUIPart(part) || isToolUIPart(part) || isDataUIPart(part)) {
|
|
7233
7235
|
block.push(part);
|
|
7234
7236
|
} else if (part.type === "step-start") {
|
|
7235
7237
|
processBlock2();
|
|
@@ -11167,7 +11169,7 @@ var AbstractChat = class {
|
|
|
11167
11169
|
var _a15, _b;
|
|
11168
11170
|
const messages = this.state.messages;
|
|
11169
11171
|
const lastMessage = messages[messages.length - 1];
|
|
11170
|
-
const updatePart = (part) =>
|
|
11172
|
+
const updatePart = (part) => isToolUIPart(part) && part.state === "approval-requested" && part.approval.id === id ? {
|
|
11171
11173
|
...part,
|
|
11172
11174
|
state: "approval-responded",
|
|
11173
11175
|
approval: { id, approved, reason }
|
|
@@ -11196,7 +11198,7 @@ var AbstractChat = class {
|
|
|
11196
11198
|
var _a15, _b;
|
|
11197
11199
|
const messages = this.state.messages;
|
|
11198
11200
|
const lastMessage = messages[messages.length - 1];
|
|
11199
|
-
const updatePart = (part) =>
|
|
11201
|
+
const updatePart = (part) => isToolUIPart(part) && part.toolCallId === toolCallId ? { ...part, state, output, errorText } : part;
|
|
11200
11202
|
this.state.replaceMessage(messages.length - 1, {
|
|
11201
11203
|
...lastMessage,
|
|
11202
11204
|
parts: lastMessage.parts.map(updatePart)
|
|
@@ -11411,7 +11413,7 @@ function lastAssistantMessageIsCompleteWithApprovalResponses({
|
|
|
11411
11413
|
const lastStepStartIndex = message.parts.reduce((lastIndex, part, index) => {
|
|
11412
11414
|
return part.type === "step-start" ? index : lastIndex;
|
|
11413
11415
|
}, -1);
|
|
11414
|
-
const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(
|
|
11416
|
+
const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(isToolUIPart).filter((part) => !part.providerExecuted);
|
|
11415
11417
|
return (
|
|
11416
11418
|
// has at least one tool approval response
|
|
11417
11419
|
lastStepToolInvocations.filter((part) => part.state === "approval-responded").length > 0 && // all tool approvals must have a response
|
|
@@ -11435,7 +11437,7 @@ function lastAssistantMessageIsCompleteWithToolCalls({
|
|
|
11435
11437
|
const lastStepStartIndex = message.parts.reduce((lastIndex, part, index) => {
|
|
11436
11438
|
return part.type === "step-start" ? index : lastIndex;
|
|
11437
11439
|
}, -1);
|
|
11438
|
-
const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(
|
|
11440
|
+
const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(isToolUIPart).filter((part) => !part.providerExecuted);
|
|
11439
11441
|
return lastStepToolInvocations.length > 0 && lastStepToolInvocations.every(
|
|
11440
11442
|
(part) => part.state === "output-available" || part.state === "output-error"
|
|
11441
11443
|
);
|
|
@@ -11548,6 +11550,7 @@ var TextStreamChatTransport = class extends HttpChatTransport {
|
|
|
11548
11550
|
generateId,
|
|
11549
11551
|
generateObject,
|
|
11550
11552
|
generateText,
|
|
11553
|
+
getStaticToolName,
|
|
11551
11554
|
getTextFromDataUrl,
|
|
11552
11555
|
getToolName,
|
|
11553
11556
|
getToolOrDynamicToolName,
|
|
@@ -11556,6 +11559,7 @@ var TextStreamChatTransport = class extends HttpChatTransport {
|
|
|
11556
11559
|
isDeepEqualData,
|
|
11557
11560
|
isFileUIPart,
|
|
11558
11561
|
isReasoningUIPart,
|
|
11562
|
+
isStaticToolUIPart,
|
|
11559
11563
|
isTextUIPart,
|
|
11560
11564
|
isToolOrDynamicToolUIPart,
|
|
11561
11565
|
isToolUIPart,
|