文档
CodeRabbit
Cloudflare
AG Grid
Netlify
Neon
WorkOS
Clerk
Convex
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
Netlify
Neon
WorkOS
Clerk
Convex
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
类引用
函数引用
接口引用
类型别名引用
变量引用
函数引用

maxIterations

函数: maxIterations()

ts
function maxIterations(max): AgentLoopStrategy;

定义于: activities/chat/agent-loop-strategies.ts:20

创建一个策略,该策略将继续进行最大迭代次数

参数

max

number

允许的最大迭代次数

Returns (返回)

AgentLoopStrategy

在达到最大迭代次数后停止的 AgentLoopStrategy

示例

typescript
const stream = chat({
  adapter: openaiText(),
  model: "gpt-4o",
  messages: [...],
  tools: [weatherTool],
  agentLoopStrategy: maxIterations(3), // Max 3 iterations
});