@ai-sdk/svelte
Advanced tools
Comparing version 0.0.47 to 0.0.48
@@ -138,3 +138,4 @@ "use strict"; | ||
keepLastMessageOnError = false, | ||
maxToolRoundtrips = 0 | ||
maxToolRoundtrips = 0, | ||
maxSteps = maxToolRoundtrips != null ? maxToolRoundtrips + 1 : 1 | ||
} = {}) { | ||
@@ -223,5 +224,5 @@ if (streamMode) { | ||
lastMessage != null && // check if the feature is enabled: | ||
maxToolRoundtrips > 0 && // check that roundtrip is possible: | ||
isAssistantMessageWithCompletedToolCalls(lastMessage) && // limit the number of automatic roundtrips: | ||
countTrailingAssistantMessages(newMessagesSnapshot) <= maxToolRoundtrips | ||
maxSteps > 1 && // check that next step is possible: | ||
isAssistantMessageWithCompletedToolCalls(lastMessage) && // limit the number of automatic steps: | ||
countTrailingAssistantMessages(newMessagesSnapshot) < maxSteps | ||
) { | ||
@@ -228,0 +229,0 @@ await triggerRequest({ messages: newMessagesSnapshot }); |
# @ai-sdk/svelte | ||
## 0.0.48 | ||
### Patch Changes | ||
- Updated dependencies [1f590ef] | ||
- @ai-sdk/ui-utils@0.0.43 | ||
## 0.0.47 | ||
@@ -4,0 +11,0 @@ |
@@ -7,3 +7,3 @@ import { UseChatOptions as UseChatOptions$1, Message, CreateMessage, ChatRequestOptions, JSONValue, RequestOptions, UseCompletionOptions, AssistantStatus, UseAssistantOptions } from '@ai-sdk/ui-utils'; | ||
/** | ||
Maximal number of automatic roundtrips for tool calls. | ||
Maximum number of automatic roundtrips for tool calls. | ||
@@ -18,4 +18,14 @@ An automatic tool call roundtrip is a call to the server with the | ||
By default, it's set to 0, which will disable the feature. | ||
*/ | ||
@deprecated Use `maxSteps` instead (which is `maxToolRoundtrips` + 1). | ||
*/ | ||
maxToolRoundtrips?: number; | ||
/** | ||
Maximum number of sequential LLM calls (steps), e.g. when you use tool calls. Must be at least 1. | ||
A maximum number is required to prevent infinite loops in the case of misconfigured tools. | ||
By default, it's set to 1, which means that only a single LLM call is made. | ||
*/ | ||
maxSteps?: number; | ||
}; | ||
@@ -61,17 +71,4 @@ type UseChatHelpers = { | ||
data: Readable<JSONValue[] | undefined>; | ||
/** | ||
Maximal number of automatic roundtrips for tool calls. | ||
An automatic tool call roundtrip is a call to the server with the | ||
tool call results when all tool calls in the last assistant | ||
message have results. | ||
A maximum number is required to prevent infinite loops in the | ||
case of misconfigured tools. | ||
By default, it's set to 0, which will disable the feature. | ||
*/ | ||
maxToolRoundtrips?: number; | ||
}; | ||
declare function useChat({ api, id, initialMessages, initialInput, sendExtraMessageFields, experimental_onFunctionCall, experimental_onToolCall, streamMode, streamProtocol, onResponse, onFinish, onError, onToolCall, credentials, headers, body, generateId, fetch, keepLastMessageOnError, maxToolRoundtrips, }?: UseChatOptions): UseChatHelpers & { | ||
declare function useChat({ api, id, initialMessages, initialInput, sendExtraMessageFields, experimental_onFunctionCall, experimental_onToolCall, streamMode, streamProtocol, onResponse, onFinish, onError, onToolCall, credentials, headers, body, generateId, fetch, keepLastMessageOnError, maxToolRoundtrips, maxSteps, }?: UseChatOptions): UseChatHelpers & { | ||
addToolResult: ({ toolCallId, result, }: { | ||
@@ -78,0 +75,0 @@ toolCallId: string; |
@@ -138,3 +138,4 @@ "use strict"; | ||
keepLastMessageOnError = false, | ||
maxToolRoundtrips = 0 | ||
maxToolRoundtrips = 0, | ||
maxSteps = maxToolRoundtrips != null ? maxToolRoundtrips + 1 : 1 | ||
} = {}) { | ||
@@ -223,5 +224,5 @@ if (streamMode) { | ||
lastMessage != null && // check if the feature is enabled: | ||
maxToolRoundtrips > 0 && // check that roundtrip is possible: | ||
isAssistantMessageWithCompletedToolCalls(lastMessage) && // limit the number of automatic roundtrips: | ||
countTrailingAssistantMessages(newMessagesSnapshot) <= maxToolRoundtrips | ||
maxSteps > 1 && // check that next step is possible: | ||
isAssistantMessageWithCompletedToolCalls(lastMessage) && // limit the number of automatic steps: | ||
countTrailingAssistantMessages(newMessagesSnapshot) < maxSteps | ||
) { | ||
@@ -228,0 +229,0 @@ await triggerRequest({ messages: newMessagesSnapshot }); |
{ | ||
"name": "@ai-sdk/svelte", | ||
"version": "0.0.47", | ||
"version": "0.0.48", | ||
"license": "Apache-2.0", | ||
@@ -23,3 +23,3 @@ "sideEffects": false, | ||
"@ai-sdk/provider-utils": "1.0.18", | ||
"@ai-sdk/ui-utils": "0.0.42", | ||
"@ai-sdk/ui-utils": "0.0.43", | ||
"sswr": "2.1.0" | ||
@@ -26,0 +26,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160407
+ Added@ai-sdk/ui-utils@0.0.43(transitive)
- Removed@ai-sdk/ui-utils@0.0.42(transitive)
Updated@ai-sdk/ui-utils@0.0.43