Comparison to check the UX improvement between streamed vs normal responses.
- Install the pakages
pnpm i
- Create env file
touch .env.local
- Add key in
.env.local
file
OPENAI_API_KEY=xxxxxxxxx
- Run the server
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
The repo has 4 branches: main
, structured-data
, streamed-generation
,compare
main
branch - Has the comparison example between streamed vs normal responsesstreamed-generation
branch - Has the code to check streamed generation examplestructured-data
branch - Has the code to check structured data example
To learn more about Next.js AI SDK features
- Streaming object - learn about streaming llm responses
- Structured data generation - check how to generate structured objects from LLMs