A modern, responsive AI-powered search application that combines web search capabilities with conversational AI to provide comprehensive answers to user queries.
- 🔍 Intelligent Web Search: Uses Tavily API for real-time web search
- 🤖 AI-Powered Responses: Powered by Google Gemini 2.0 Flash model
- 💬 Real-time Streaming: Server-sent events for live response streaming
- 🎯 Search Progress Tracking: Visual indicators for search stages
- 📋 Copy Functionality: Easy copy-to-clipboard for AI responses
- 🔄 Session Management: Start fresh conversations anytime
- 🎨 Session Context: Custom prompt engineering for personalized AI responses
- 💡 Interactive UI: Modern design with smooth animations
The main chat interface showing real-time AI responses with web search integration
Session Context feature allowing users to customize AI behavior with predefined presets or custom prompts
- FastAPI: Modern web framework for building APIs
- LangGraph: State management for AI workflows
- LangChain: Integration with various AI models and tools
- Tavily: Web search API for real-time information retrieval
- Google Gemini: Advanced language model for responses
- Next.js 15: React framework with TypeScript
- Tailwind CSS: Utility-first CSS framework for responsive design
- Server-Sent Events: Real-time communication with backend
- TypeScript: Type-safe development
- Python 3.8+
- Node.js 18+
- API Keys for:
- Google Gemini API
- Tavily Search API
-
Navigate to the server directory:
cd server -
Create and activate a virtual environment:
# Windows python -m venv venv venv\Scripts\activate # macOS/Linux python -m venv venv source venv/bin/activate
python -m venv venv venv\Scripts\activate # Windows # or source venv/bin/activate # Linux/Mac
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables in
.env:GOOGLE_API_KEY=your_google_api_key_here TAVILY_API_KEY=your_tavily_api_key_here # Optional: LangSmith for debugging LANGSMITH_TRACING=true LANGSMITH_ENDPOINT="https://api.smith.langchain.com" LANGSMITH_API_KEY=your_langsmith_key LANGSMITH_PROJECT=your_project_name
-
Start the backend server:
uvicorn app:app --reload --host 0.0.0.0 --port 8000
-
Navigate to the client directory:
cd client -
Install dependencies:
npm install
-
Start the development server:
npm run dev
The application will be available at:
- Frontend: http://localhost:3000 (or next available port)
- Backend: http://localhost:8000
- Backend Health Check: http://localhost:8000/health
- Open the frontend application in your browser
- Type your question in the input field
- Watch as the AI searches the web and compiles a response
- Copy responses using the copy button
- Home Tab: Welcome page with project overview and "Perplexity 2.0" branding
- Chat Tab: Main conversational interface with AI search capabilities
- Settings Tab: Customize your experience (theme, search preferences, etc.)
- Click the large Session Context button (bottom-right corner)
- Choose from Quick Presets:
- General Assistant
- Technical Expert
- Research Assistant
- Simple Explainer
- Or write your own Custom Context to guide AI responses
- The context applies to all messages in the current session
- Ask Questions: Type your question in the input field
- Real-time Responses: Watch as the AI searches the web and streams responses
- Search Progress: Visual indicators show search stages (searching → reading → writing)
- Copy Responses: Click the copy button on any AI response
- Use the Session Context to specify your role or expertise level
- Ask specific questions for more targeted search results
- Try different contexts for the same question to get varied perspectives
- Backend: Add new endpoints in
app.pyor extend the LangGraph workflow - Frontend: Add new components in
src/components/or extend existing functionality
The application uses several environment variables:
GOOGLE_API_KEY: Required for AI responsesTAVILY_API_KEY: Required for web searchLANGSMITH_*: Optional for debugging and monitoring
- Use specific, focused queries for better search results
- Set appropriate session context to reduce token usage
- Monitor API usage in Google AI Studio and Tavily dashboards
-
Backend Deployment:
# Install production dependencies pip install gunicorn # Run with gunicorn gunicorn app:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
-
Frontend Build:
cd client npm run build npm start -
Environment Variables: Set production API keys and endpoints
-
Security: Configure CORS, rate limiting, and authentication as needed
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is for educational and development purposes.