ai 6.0.0-beta.149 → 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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.0-beta.151
4
+
5
+ ### Patch Changes
6
+
7
+ - dcdac8c: chore(ai): rename tool helpers
8
+
9
+ ## 6.0.0-beta.150
10
+
11
+ ### Patch Changes
12
+
13
+ - db62f7d: Added schema name and description for generateText and output
14
+
3
15
  ## 6.0.0-beta.149
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -603,41 +603,91 @@ declare const text: () => Output<string, string>;
603
603
  * When the model generates a text response, it will return an object that matches the schema.
604
604
  *
605
605
  * @param schema - The schema of the object to generate.
606
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
607
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
606
608
  *
607
609
  * @returns An output specification for generating objects with the specified schema.
608
610
  */
609
- declare const object: <OBJECT>({ schema: inputSchema, }: {
611
+ declare const object: <OBJECT>({ schema: inputSchema, name, description, }: {
610
612
  schema: FlexibleSchema<OBJECT>;
613
+ /**
614
+ * Optional name of the output that should be generated.
615
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
616
+ */
617
+ name?: string;
618
+ /**
619
+ * Optional description of the output that should be generated.
620
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
621
+ */
622
+ description?: string;
611
623
  }) => Output<OBJECT, DeepPartial<OBJECT>>;
612
624
  /**
613
625
  * Output specification for array generation.
614
626
  * When the model generates a text response, it will return an array of elements.
615
627
  *
616
628
  * @param element - The schema of the array elements to generate.
629
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
630
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
617
631
  *
618
632
  * @returns An output specification for generating an array of elements.
619
633
  */
620
- declare const array: <ELEMENT>({ element: inputElementSchema, }: {
634
+ declare const array: <ELEMENT>({ element: inputElementSchema, name, description, }: {
621
635
  element: FlexibleSchema<ELEMENT>;
636
+ /**
637
+ * Optional name of the output that should be generated.
638
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
639
+ */
640
+ name?: string;
641
+ /**
642
+ * Optional description of the output that should be generated.
643
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
644
+ */
645
+ description?: string;
622
646
  }) => Output<Array<ELEMENT>, Array<ELEMENT>>;
623
647
  /**
624
648
  * Output specification for choice generation.
625
649
  * When the model generates a text response, it will return a one of the choice options.
626
650
  *
627
651
  * @param options - The available choices.
652
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
653
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
628
654
  *
629
655
  * @returns An output specification for generating a choice.
630
656
  */
631
- declare const choice: <CHOICE extends string>({ options: choiceOptions, }: {
657
+ declare const choice: <CHOICE extends string>({ options: choiceOptions, name, description, }: {
632
658
  options: Array<CHOICE>;
659
+ /**
660
+ * Optional name of the output that should be generated.
661
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
662
+ */
663
+ name?: string;
664
+ /**
665
+ * Optional description of the output that should be generated.
666
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
667
+ */
668
+ description?: string;
633
669
  }) => Output<CHOICE, CHOICE>;
634
670
  /**
635
671
  * Output specification for unstructured JSON generation.
636
672
  * When the model generates a text response, it will return a JSON object.
637
673
  *
674
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
675
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
676
+ *
638
677
  * @returns An output specification for generating JSON.
639
678
  */
640
- declare const json: () => Output<JSONValue$1, JSONValue$1>;
679
+ declare const json: ({ name, description, }?: {
680
+ /**
681
+ * Optional name of the output that should be generated.
682
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
683
+ */
684
+ name?: string;
685
+ /**
686
+ * Optional description of the output that should be generated.
687
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
688
+ */
689
+ description?: string;
690
+ }) => Output<JSONValue$1, JSONValue$1>;
641
691
 
642
692
  type output_Output<OUTPUT = any, PARTIAL = any> = Output<OUTPUT, PARTIAL>;
643
693
  declare const output_array: typeof array;
@@ -1757,10 +1807,41 @@ declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part i
1757
1807
  * Type guard to check if a message part is a reasoning part.
1758
1808
  */
1759
1809
  declare function isReasoningUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is ReasoningUIPart;
1760
- declare function isToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS>;
1761
- declare function isToolOrDynamicToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS> | DynamicToolUIPart;
1762
- declare function getToolName<TOOLS extends UITools>(part: ToolUIPart<TOOLS>): keyof TOOLS;
1763
- declare function getToolOrDynamicToolName(part: ToolUIPart<UITools> | DynamicToolUIPart): string;
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;
1764
1845
  type InferUIMessageMetadata<T extends UIMessage> = T extends UIMessage<infer METADATA> ? METADATA : unknown;
1765
1846
  type InferUIMessageData<T extends UIMessage> = T extends UIMessage<unknown, infer DATA_TYPES> ? DATA_TYPES : UIDataTypes;
1766
1847
  type InferUIMessageTools<T extends UIMessage> = T extends UIMessage<unknown, UIDataTypes, infer TOOLS> ? TOOLS : UITools;
@@ -5321,4 +5402,4 @@ declare global {
5321
5402
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
5322
5403
  }
5323
5404
 
5324
- 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
@@ -603,41 +603,91 @@ declare const text: () => Output<string, string>;
603
603
  * When the model generates a text response, it will return an object that matches the schema.
604
604
  *
605
605
  * @param schema - The schema of the object to generate.
606
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
607
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
606
608
  *
607
609
  * @returns An output specification for generating objects with the specified schema.
608
610
  */
609
- declare const object: <OBJECT>({ schema: inputSchema, }: {
611
+ declare const object: <OBJECT>({ schema: inputSchema, name, description, }: {
610
612
  schema: FlexibleSchema<OBJECT>;
613
+ /**
614
+ * Optional name of the output that should be generated.
615
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
616
+ */
617
+ name?: string;
618
+ /**
619
+ * Optional description of the output that should be generated.
620
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
621
+ */
622
+ description?: string;
611
623
  }) => Output<OBJECT, DeepPartial<OBJECT>>;
612
624
  /**
613
625
  * Output specification for array generation.
614
626
  * When the model generates a text response, it will return an array of elements.
615
627
  *
616
628
  * @param element - The schema of the array elements to generate.
629
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
630
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
617
631
  *
618
632
  * @returns An output specification for generating an array of elements.
619
633
  */
620
- declare const array: <ELEMENT>({ element: inputElementSchema, }: {
634
+ declare const array: <ELEMENT>({ element: inputElementSchema, name, description, }: {
621
635
  element: FlexibleSchema<ELEMENT>;
636
+ /**
637
+ * Optional name of the output that should be generated.
638
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
639
+ */
640
+ name?: string;
641
+ /**
642
+ * Optional description of the output that should be generated.
643
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
644
+ */
645
+ description?: string;
622
646
  }) => Output<Array<ELEMENT>, Array<ELEMENT>>;
623
647
  /**
624
648
  * Output specification for choice generation.
625
649
  * When the model generates a text response, it will return a one of the choice options.
626
650
  *
627
651
  * @param options - The available choices.
652
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
653
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
628
654
  *
629
655
  * @returns An output specification for generating a choice.
630
656
  */
631
- declare const choice: <CHOICE extends string>({ options: choiceOptions, }: {
657
+ declare const choice: <CHOICE extends string>({ options: choiceOptions, name, description, }: {
632
658
  options: Array<CHOICE>;
659
+ /**
660
+ * Optional name of the output that should be generated.
661
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
662
+ */
663
+ name?: string;
664
+ /**
665
+ * Optional description of the output that should be generated.
666
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
667
+ */
668
+ description?: string;
633
669
  }) => Output<CHOICE, CHOICE>;
634
670
  /**
635
671
  * Output specification for unstructured JSON generation.
636
672
  * When the model generates a text response, it will return a JSON object.
637
673
  *
674
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
675
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
676
+ *
638
677
  * @returns An output specification for generating JSON.
639
678
  */
640
- declare const json: () => Output<JSONValue$1, JSONValue$1>;
679
+ declare const json: ({ name, description, }?: {
680
+ /**
681
+ * Optional name of the output that should be generated.
682
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
683
+ */
684
+ name?: string;
685
+ /**
686
+ * Optional description of the output that should be generated.
687
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
688
+ */
689
+ description?: string;
690
+ }) => Output<JSONValue$1, JSONValue$1>;
641
691
 
642
692
  type output_Output<OUTPUT = any, PARTIAL = any> = Output<OUTPUT, PARTIAL>;
643
693
  declare const output_array: typeof array;
@@ -1757,10 +1807,41 @@ declare function isFileUIPart(part: UIMessagePart<UIDataTypes, UITools>): part i
1757
1807
  * Type guard to check if a message part is a reasoning part.
1758
1808
  */
1759
1809
  declare function isReasoningUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is ReasoningUIPart;
1760
- declare function isToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS>;
1761
- declare function isToolOrDynamicToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS> | DynamicToolUIPart;
1762
- declare function getToolName<TOOLS extends UITools>(part: ToolUIPart<TOOLS>): keyof TOOLS;
1763
- declare function getToolOrDynamicToolName(part: ToolUIPart<UITools> | DynamicToolUIPart): string;
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;
1764
1845
  type InferUIMessageMetadata<T extends UIMessage> = T extends UIMessage<infer METADATA> ? METADATA : unknown;
1765
1846
  type InferUIMessageData<T extends UIMessage> = T extends UIMessage<unknown, infer DATA_TYPES> ? DATA_TYPES : UIDataTypes;
1766
1847
  type InferUIMessageTools<T extends UIMessage> = T extends UIMessage<unknown, UIDataTypes, infer TOOLS> ? TOOLS : UITools;
@@ -5321,4 +5402,4 @@ declare global {
5321
5402
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
5322
5403
  }
5323
5404
 
5324
- 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.149" : "0.0.0-test";
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 }) => {
@@ -2869,13 +2871,17 @@ var text = () => ({
2869
2871
  }
2870
2872
  });
2871
2873
  var object = ({
2872
- schema: inputSchema
2874
+ schema: inputSchema,
2875
+ name: name15,
2876
+ description
2873
2877
  }) => {
2874
2878
  const schema = (0, import_provider_utils11.asSchema)(inputSchema);
2875
2879
  return {
2876
2880
  responseFormat: (0, import_provider_utils11.resolve)(schema.jsonSchema).then((jsonSchema2) => ({
2877
2881
  type: "json",
2878
- schema: jsonSchema2
2882
+ schema: jsonSchema2,
2883
+ ...name15 != null && { name: name15 },
2884
+ ...description != null && { description }
2879
2885
  })),
2880
2886
  async parseCompleteOutput({ text: text2 }, context) {
2881
2887
  const parseResult = await (0, import_provider_utils11.safeParseJSON)({ text: text2 });
@@ -2924,7 +2930,9 @@ var object = ({
2924
2930
  };
2925
2931
  };
2926
2932
  var array = ({
2927
- element: inputElementSchema
2933
+ element: inputElementSchema,
2934
+ name: name15,
2935
+ description
2928
2936
  }) => {
2929
2937
  const elementSchema = (0, import_provider_utils11.asSchema)(inputElementSchema);
2930
2938
  return {
@@ -2941,7 +2949,9 @@ var array = ({
2941
2949
  },
2942
2950
  required: ["elements"],
2943
2951
  additionalProperties: false
2944
- }
2952
+ },
2953
+ ...name15 != null && { name: name15 },
2954
+ ...description != null && { description }
2945
2955
  };
2946
2956
  }),
2947
2957
  async parseCompleteOutput({ text: text2 }, context) {
@@ -3019,7 +3029,9 @@ var array = ({
3019
3029
  };
3020
3030
  };
3021
3031
  var choice = ({
3022
- options: choiceOptions
3032
+ options: choiceOptions,
3033
+ name: name15,
3034
+ description
3023
3035
  }) => {
3024
3036
  return {
3025
3037
  // JSON schema that describes an enumeration:
@@ -3033,7 +3045,9 @@ var choice = ({
3033
3045
  },
3034
3046
  required: ["result"],
3035
3047
  additionalProperties: false
3036
- }
3048
+ },
3049
+ ...name15 != null && { name: name15 },
3050
+ ...description != null && { description }
3037
3051
  }),
3038
3052
  async parseCompleteOutput({ text: text2 }, context) {
3039
3053
  const parseResult = await (0, import_provider_utils11.safeParseJSON)({ text: text2 });
@@ -3089,10 +3103,15 @@ var choice = ({
3089
3103
  }
3090
3104
  };
3091
3105
  };
3092
- var json = () => {
3106
+ var json = ({
3107
+ name: name15,
3108
+ description
3109
+ } = {}) => {
3093
3110
  return {
3094
3111
  responseFormat: Promise.resolve({
3095
- type: "json"
3112
+ type: "json",
3113
+ ...name15 != null && { name: name15 },
3114
+ ...description != null && { description }
3096
3115
  }),
3097
3116
  async parseCompleteOutput({ text: text2 }, context) {
3098
3117
  const parseResult = await (0, import_provider_utils11.safeParseJSON)({ text: text2 });
@@ -4407,21 +4426,23 @@ function isFileUIPart(part) {
4407
4426
  function isReasoningUIPart(part) {
4408
4427
  return part.type === "reasoning";
4409
4428
  }
4410
- function isToolUIPart(part) {
4429
+ function isStaticToolUIPart(part) {
4411
4430
  return part.type.startsWith("tool-");
4412
4431
  }
4413
4432
  function isDynamicToolUIPart(part) {
4414
4433
  return part.type === "dynamic-tool";
4415
4434
  }
4416
- function isToolOrDynamicToolUIPart(part) {
4417
- return isToolUIPart(part) || isDynamicToolUIPart(part);
4435
+ function isToolUIPart(part) {
4436
+ return isStaticToolUIPart(part) || isDynamicToolUIPart(part);
4418
4437
  }
4419
- function getToolName(part) {
4438
+ var isToolOrDynamicToolUIPart = isToolUIPart;
4439
+ function getStaticToolName(part) {
4420
4440
  return part.type.split("-").slice(1).join("-");
4421
4441
  }
4422
- function getToolOrDynamicToolName(part) {
4423
- return isDynamicToolUIPart(part) ? part.toolName : getToolName(part);
4442
+ function getToolName(part) {
4443
+ return isDynamicToolUIPart(part) ? part.toolName : getStaticToolName(part);
4424
4444
  }
4445
+ var getToolOrDynamicToolName = getToolName;
4425
4446
 
4426
4447
  // src/ui/process-ui-message-stream.ts
4427
4448
  function createStreamingUIMessageState({
@@ -4455,9 +4476,7 @@ function processUIMessageStream({
4455
4476
  await runUpdateMessageJob(async ({ state, write }) => {
4456
4477
  var _a15, _b, _c, _d;
4457
4478
  function getToolInvocation(toolCallId) {
4458
- const toolInvocations = state.message.parts.filter(
4459
- isToolOrDynamicToolUIPart
4460
- );
4479
+ const toolInvocations = state.message.parts.filter(isToolUIPart);
4461
4480
  const toolInvocation = toolInvocations.find(
4462
4481
  (invocation) => invocation.toolCallId === toolCallId
4463
4482
  );
@@ -4471,7 +4490,7 @@ function processUIMessageStream({
4471
4490
  function updateToolPart(options) {
4472
4491
  var _a16;
4473
4492
  const part = state.message.parts.find(
4474
- (part2) => isToolUIPart(part2) && part2.toolCallId === options.toolCallId
4493
+ (part2) => isStaticToolUIPart(part2) && part2.toolCallId === options.toolCallId
4475
4494
  );
4476
4495
  const anyOptions = options;
4477
4496
  const anyPart = part;
@@ -4643,7 +4662,7 @@ function processUIMessageStream({
4643
4662
  break;
4644
4663
  }
4645
4664
  case "tool-input-start": {
4646
- const toolInvocations = state.message.parts.filter(isToolUIPart);
4665
+ const toolInvocations = state.message.parts.filter(isStaticToolUIPart);
4647
4666
  state.partialToolCalls[chunk.toolCallId] = {
4648
4667
  text: "",
4649
4668
  toolName: chunk.toolName,
@@ -4784,7 +4803,7 @@ function processUIMessageStream({
4784
4803
  } else {
4785
4804
  updateToolPart({
4786
4805
  toolCallId: chunk.toolCallId,
4787
- toolName: getToolName(toolInvocation),
4806
+ toolName: getStaticToolName(toolInvocation),
4788
4807
  state: "output-available",
4789
4808
  input: toolInvocation.input,
4790
4809
  output: chunk.output,
@@ -4811,7 +4830,7 @@ function processUIMessageStream({
4811
4830
  } else {
4812
4831
  updateToolPart({
4813
4832
  toolCallId: chunk.toolCallId,
4814
- toolName: getToolName(toolInvocation),
4833
+ toolName: getStaticToolName(toolInvocation),
4815
4834
  state: "output-error",
4816
4835
  input: toolInvocation.input,
4817
4836
  rawInput: toolInvocation.rawInput,
@@ -7022,7 +7041,7 @@ function convertToModelMessages(messages, options) {
7022
7041
  messages = messages.map((message) => ({
7023
7042
  ...message,
7024
7043
  parts: message.parts.filter(
7025
- (part) => !isToolOrDynamicToolUIPart(part) || part.state !== "input-streaming" && part.state !== "input-available"
7044
+ (part) => !isToolUIPart(part) || part.state !== "input-streaming" && part.state !== "input-available"
7026
7045
  )
7027
7046
  }));
7028
7047
  }
@@ -7104,8 +7123,8 @@ function convertToModelMessages(messages, options) {
7104
7123
  text: part.text,
7105
7124
  providerOptions: part.providerMetadata
7106
7125
  });
7107
- } else if (isToolOrDynamicToolUIPart(part)) {
7108
- const toolName = getToolOrDynamicToolName(part);
7126
+ } else if (isToolUIPart(part)) {
7127
+ const toolName = getToolName(part);
7109
7128
  if (part.state !== "input-streaming") {
7110
7129
  content.push({
7111
7130
  type: "tool-call",
@@ -7154,7 +7173,7 @@ function convertToModelMessages(messages, options) {
7154
7173
  content
7155
7174
  });
7156
7175
  const toolParts = block.filter(
7157
- (part) => isToolOrDynamicToolUIPart(part) && part.providerExecuted !== true
7176
+ (part) => isToolUIPart(part) && part.providerExecuted !== true
7158
7177
  );
7159
7178
  if (toolParts.length > 0) {
7160
7179
  modelMessages.push({
@@ -7176,7 +7195,7 @@ function convertToModelMessages(messages, options) {
7176
7195
  outputs.push({
7177
7196
  type: "tool-result",
7178
7197
  toolCallId: toolPart.toolCallId,
7179
- toolName: getToolOrDynamicToolName(toolPart),
7198
+ toolName: getToolName(toolPart),
7180
7199
  output: {
7181
7200
  type: "error-text",
7182
7201
  value: (_b2 = toolPart.approval.reason) != null ? _b2 : "Tool execution denied."
@@ -7187,7 +7206,7 @@ function convertToModelMessages(messages, options) {
7187
7206
  }
7188
7207
  case "output-error":
7189
7208
  case "output-available": {
7190
- const toolName = getToolOrDynamicToolName(toolPart);
7209
+ const toolName = getToolName(toolPart);
7191
7210
  outputs.push({
7192
7211
  type: "tool-result",
7193
7212
  toolCallId: toolPart.toolCallId,
@@ -7212,7 +7231,7 @@ function convertToModelMessages(messages, options) {
7212
7231
  var processBlock = processBlock2;
7213
7232
  let block = [];
7214
7233
  for (const part of message.parts) {
7215
- if (isTextUIPart(part) || isReasoningUIPart(part) || isFileUIPart(part) || isToolOrDynamicToolUIPart(part) || isDataUIPart(part)) {
7234
+ if (isTextUIPart(part) || isReasoningUIPart(part) || isFileUIPart(part) || isToolUIPart(part) || isDataUIPart(part)) {
7216
7235
  block.push(part);
7217
7236
  } else if (part.type === "step-start") {
7218
7237
  processBlock2();
@@ -11150,7 +11169,7 @@ var AbstractChat = class {
11150
11169
  var _a15, _b;
11151
11170
  const messages = this.state.messages;
11152
11171
  const lastMessage = messages[messages.length - 1];
11153
- const updatePart = (part) => isToolOrDynamicToolUIPart(part) && part.state === "approval-requested" && part.approval.id === id ? {
11172
+ const updatePart = (part) => isToolUIPart(part) && part.state === "approval-requested" && part.approval.id === id ? {
11154
11173
  ...part,
11155
11174
  state: "approval-responded",
11156
11175
  approval: { id, approved, reason }
@@ -11179,7 +11198,7 @@ var AbstractChat = class {
11179
11198
  var _a15, _b;
11180
11199
  const messages = this.state.messages;
11181
11200
  const lastMessage = messages[messages.length - 1];
11182
- const updatePart = (part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? { ...part, state, output, errorText } : part;
11201
+ const updatePart = (part) => isToolUIPart(part) && part.toolCallId === toolCallId ? { ...part, state, output, errorText } : part;
11183
11202
  this.state.replaceMessage(messages.length - 1, {
11184
11203
  ...lastMessage,
11185
11204
  parts: lastMessage.parts.map(updatePart)
@@ -11394,7 +11413,7 @@ function lastAssistantMessageIsCompleteWithApprovalResponses({
11394
11413
  const lastStepStartIndex = message.parts.reduce((lastIndex, part, index) => {
11395
11414
  return part.type === "step-start" ? index : lastIndex;
11396
11415
  }, -1);
11397
- const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(isToolOrDynamicToolUIPart).filter((part) => !part.providerExecuted);
11416
+ const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(isToolUIPart).filter((part) => !part.providerExecuted);
11398
11417
  return (
11399
11418
  // has at least one tool approval response
11400
11419
  lastStepToolInvocations.filter((part) => part.state === "approval-responded").length > 0 && // all tool approvals must have a response
@@ -11418,7 +11437,7 @@ function lastAssistantMessageIsCompleteWithToolCalls({
11418
11437
  const lastStepStartIndex = message.parts.reduce((lastIndex, part, index) => {
11419
11438
  return part.type === "step-start" ? index : lastIndex;
11420
11439
  }, -1);
11421
- const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(isToolOrDynamicToolUIPart).filter((part) => !part.providerExecuted);
11440
+ const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(isToolUIPart).filter((part) => !part.providerExecuted);
11422
11441
  return lastStepToolInvocations.length > 0 && lastStepToolInvocations.every(
11423
11442
  (part) => part.state === "output-available" || part.state === "output-error"
11424
11443
  );
@@ -11531,6 +11550,7 @@ var TextStreamChatTransport = class extends HttpChatTransport {
11531
11550
  generateId,
11532
11551
  generateObject,
11533
11552
  generateText,
11553
+ getStaticToolName,
11534
11554
  getTextFromDataUrl,
11535
11555
  getToolName,
11536
11556
  getToolOrDynamicToolName,
@@ -11539,6 +11559,7 @@ var TextStreamChatTransport = class extends HttpChatTransport {
11539
11559
  isDeepEqualData,
11540
11560
  isFileUIPart,
11541
11561
  isReasoningUIPart,
11562
+ isStaticToolUIPart,
11542
11563
  isTextUIPart,
11543
11564
  isToolOrDynamicToolUIPart,
11544
11565
  isToolUIPart,