This is a Next.js AI Chat App template with built-in integration for Testune, making it easy to experiment with and optimize your LLM prompts.
- ⚡ Next.js 14 (App Router)
- 📝 Pre-configured Testune SDK for prompt A/B testing
- 🔑 Bring Your Own LLM API key (OpenAI)
- 📊 Feedback & analytics pipeline via Testune
- 💬 Ready-to-use chat interface
.
├── app/ # Next.js app router pages
├── components/ # Reusable React components
├── lib/ # Testune + LLM utilities
├── styles/ # Global styles
└── package.jsongit clone https://github.com/your-org/nextjs-ai-chat-app.git
cd nextjs-ai-chat-appnpm install
# or
yarn installCreate a .env.local file with:
NEXT_PUBLIC_TESTUNE_API_KEY=your_testune_api_key
NEXT_PUBLIC_LLM_API_KEY=your_llm_api_keynpm run devThis template comes pre-wired with Testune analytics and A/B testing for LLM prompts.
Example usage:
import { testuneClient } from "@/lib/testune";
async function getResponse(userMessage: string) {
const response = await testuneClient.sendMessage({
message: userMessage,
promptGroup: "chat-prompt-v1",
});
return response;
}You can monitor performance and run A/B tests directly from the Testune dashboard.
- Run the app locally (
npm run dev). - Open the chat UI at http://localhost:3000.
- Enter a message and see the Testune-powered LLM respond.
- Check the dashboard for analytics.
MIT License. See LICENSE for details.