Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
This Next.js chatbot uses the AI SDK's streamText function with maxSteps and a reasoning tool to reason on user queries.
This example demonstrates how to use the AI SDK with Next.js and the streamText function to automatically handle multi-step generations. It provides a Next.js chatbot that leverages the AI SDK's streamText function, specifically utilizing maxSteps and a reasoning tool to process and respond to complex user queries. This allows for more sophisticated AI interactions where the model can break down problems into multiple reasoning steps before providing a final answer.
To deploy your own version of this application, you can use the provided Vercel deploy button or clone the repository directly.
How to Use:
To get started with this example, you can bootstrap the project using create-next-app with your preferred package manager:
npx create-next-app --example https://github.com/vercel-labs/ai-sdk-preview-steps-reasoning ai-sdk-preview-steps-reasoning-example
# or
yarn create next-app --example https://github.com/vercel-labs/ai-sdk-preview-steps-reasoning ai-sdk-preview-steps-reasoning-example
# or
pnpm create next-app --example https://github.com/vercel-labs/ai-sdk-preview-steps-reasoning ai-sdk-preview-steps-reasoning-exampleRunning Locally:
To run the example locally, follow these steps:
.env file, mirroring the structure of the .env.example file.npm install.npm run dev.Key Features:
streamText function with maxSteps to enable the AI to perform complex reasoning over multiple steps.Learn More:
For further details, refer to these resources: