Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
An application that converts text inputs into structured objects and streams the expense as it’s being processed using the Vercel AI SDK.
This example showcases the power of the Vercel AI SDK's useObject hook for streaming structured object generation directly to the client. Built with Next.js, this application efficiently converts raw text inputs into well-defined JSON objects, demonstrating real-time processing of data like expenses. It provides a practical template for developers looking to integrate AI-powered object generation into their web applications, offering a seamless user experience by streaming data as it's being processed.
Key Features:
useObject hook to stream generated objects incrementally to the client.How to Use:
To get started with this template, you can bootstrap it using create-next-app:
npx create-next-app --example https://github.com/vercel-labs/ai-sdk-preview-use-object ai-sdk-preview-use-object-example
# or yarn create next-app --example https://github.com/vercel-labs/ai-sdk-preview-use-object ai-sdk-preview-use-object-example
# or pnpm create next-app --example https://github.com/vercel-labs/ai-sdk-preview-use-object ai-sdk-preview-use-object-exampleAfter cloning, ensure you have accounts with your desired AI providers (like OpenAI) and obtain their API keys. Set these keys as environment variables in a .env file, following the .env.example. Then, install dependencies with npm install and launch the development server using npm run dev.
Learn More: