InquireAI is a sophisticated search assistant application that combines the power of web search, intelligent content ranking, and large language models to deliver precise, contextual answers to user queries. Built with Flutter and powered by cutting-edge APIs, it provides a Perplexity-like experience with real-time chat functionality.
Intelligent Web Search
- Leverages Tavily API for comprehensive web content retrieval
- Fetches relevant sources from across the internet in real-time
Smart Content Ranking
- Advanced similarity-based ranking using sentence transformers
- Vector embeddings and cosine similarity calculations
- Prioritizes most relevant sources for accurate responses
AI-Powered Response Generation
- Utilizes Gemini API for contextual, coherent answer generation
- Synthesizes information from multiple ranked sources
- Delivers concise, well-structured responses
Real-Time Communication
- WebSocket integration for instant chat functionality
- Seamless client-server communication
- Responsive user experience
InquireAI follows a three-stage RAG (Retrieval-Augmented Generation) pipeline:
- Web Search: Query processing through Tavily API
- Content Extraction: Retrieval of relevant web sources and snippets
- Data Preprocessing: Clean and structure retrieved content
- Vector Embedding: Convert queries and content to high-dimensional vectors
- Similarity Calculation: Compute cosine similarity scores
- Source Ranking: Order sources by relevance to user query
- Top-K Selection: Select highest-ranking sources for response generation
- Context Assembly: Combine top-ranked sources with user query
- LLM Processing: Generate response using Gemini API
- Response Optimization: Ensure coherence and accuracy
- Real-time Delivery: Stream response to user via WebSocket
Frontend
- Flutter - Cross-platform mobile development
- WebSocket Client - Real-time communication
Backend APIs
- Tavily API - Web search and content retrieval
- Gemini API - Large language model for response generation
AI/ML Components
- Sentence Transformers - Text vectorization
- Cosine Similarity - Content ranking algorithm
- Vector Embeddings - Semantic similarity computation
Communication
- WebSocket Protocol - Real-time bidirectional communication
-
Clone this repository:
git clone https://github.com/k3tikvats/perplexity_RAG.git
-
Navigate to the project directory:
cd perplexity_RAG
-
Install dependencies:
flutter pub get
-
Configure the APIs:
- Obtain API keys for Tavily and Gemini.
- Add them to the appropriate configuration file.
-
Run the application:
flutter run
- Enter your query in the search bar.
- The app will:
- Search the web for relevant sources.
- Rank the sources based on content similarity.
- Generate and display a concise response.
- View the ranked sources and the final response.
- Input Query: The user inputs a query in natural language.
- Web Search: Tavily API retrieves web search results.
- Similarity Ranking: The app calculates cosine similarity between the query and search results to rank sources.
- Response Generation: Gemini API uses the top-ranked sources to generate a response.
- WebSocket: For real-time chat functionality and communication between client and server.
"How does photosynthesis work?"
- Search Results: Fetch relevant links and snippets on photosynthesis.
- Rank Sources: Identify the most relevant sources by calculating similarity scores.
- Final Response: Generate an answer explaining photosynthesis in detail, leveraging LLM capabilities.
- Integrate more advanced ranking algorithms to improve source selection.
- Enable multi-modal support for images and videos.
- Optimize response generation time.
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.