Skip to content

Commit 332167b

Browse files
authored
chore (ai): move maxSteps into UseChatOptions (vercel#6113)
## Background `maxSteps` is available in all `useChat` implementations. ## Summary Add `maxSteps` to `UseChatOptions`.
1 parent d897a19 commit 332167b

File tree

5 files changed

+15
-26
lines changed

5 files changed

+15
-26
lines changed

.changeset/great-mangos-scream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'ai': patch
3+
---
4+
5+
chore (ai): move maxSteps into UseChatOptions

packages/ai/core/types/ui-messages.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,16 @@ Custom fetch implementation. You can use it as a middleware to intercept request
339339
or to provide a custom fetch implementation for e.g. testing.
340340
*/
341341
fetch?: FetchFunction;
342+
343+
/**
344+
Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.
345+
Must be at least 1.
346+
347+
A maximum number is required to prevent infinite loops in the case of misconfigured tools.
348+
349+
By default, it's set to 1, which means that only a single LLM call is made.
350+
*/
351+
maxSteps?: number;
342352
};
343353

344354
export type UseCompletionOptions = {

packages/react/src/use-chat.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,6 @@ Default is undefined, which disables throttling.
170170
*/
171171
experimental_throttle?: number;
172172

173-
/**
174-
Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.
175-
Must be at least 1.
176-
177-
A maximum number is required to prevent infinite loops in the case of misconfigured tools.
178-
179-
By default, it's set to 1, which means that only a single LLM call is made.
180-
*/
181-
maxSteps?: number;
182-
183173
'~internal'?: {
184174
currentDate?: () => Date;
185175
};

packages/svelte/src/chat.svelte.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@ import {
2424

2525
export type ChatOptions = Readonly<
2626
Omit<UseChatOptions, 'keepLastMessageOnError'> & {
27-
/**
28-
* Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.
29-
* Must be at least 1.
30-
* A maximum number is required to prevent infinite loops in the case of misconfigured tools.
31-
* By default, it's set to 1, which means that only a single LLM call is made.
32-
* @default 1
33-
*/
34-
maxSteps?: number;
35-
3627
'~internal'?: {
3728
currentDate?: () => Date;
3829
};

packages/vue/src/use-chat.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@ export function useChat(
130130
experimental_prepareRequestBody,
131131
...options
132132
}: UseChatOptions & {
133-
/**
134-
* Maximum number of sequential LLM calls (steps), e.g. when you use tool calls. Must be at least 1.
135-
* A maximum number is required to prevent infinite loops in the case of misconfigured tools.
136-
* By default, it's set to 1, which means that only a single LLM call is made.
137-
*/
138-
maxSteps?: number;
139-
140133
/**
141134
* Experimental (Vue only). When a function is provided, it will be used
142135
* to prepare the request body for the chat API. This can be useful for

0 commit comments

Comments
 (0)