|
| 1 | +# Perplexity Inspired LLM Answer Engine |
| 2 | + |
| 3 | +This repository contains the code and instructions needed to build a sophisticated answer engine that leverages the capabilities of Groq, Mixtral, Langchain.JS, Brave Search, and OpenAI. Designed to efficiently return sources, answers, and follow-up questions based on user queries, this project is an ideal starting point for developers interested in natural language processing and search technologies. |
| 4 | + |
| 5 | +## Technologies Used |
| 6 | + |
| 7 | +- **Express.js**: A web application framework for Node.js, used to create server-side applications. |
| 8 | +- **Body-Parser**: A middleware for Express.js, it's used to parse incoming request bodies before your handlers. |
| 9 | +- **Groq & Mixtral**: Technologies for processing and understanding user queries. |
| 10 | +- **Langchain.JS**: A JavaScript library focused on text operations, such as text splitting and embeddings. |
| 11 | +- **Brave Search**: A privacy-focused search engine used for sourcing relevant content. |
| 12 | +- **OpenAI**: Leveraged for generating coherent and contextually relevant answers and follow-up questions. |
| 13 | +- **Cheerio**: Utilized for HTML parsing, allowing the extraction of content from web pages. |
| 14 | + |
| 15 | +## Getting Started |
| 16 | + |
| 17 | +### Prerequisites |
| 18 | + |
| 19 | +- Ensure Node.js and npm are installed on your machine. |
| 20 | +- Obtain API keys from Groq, OpenAI, and Brave Search. |
| 21 | + |
| 22 | +### Obtaining API Keys |
| 23 | + |
| 24 | +- **Groq API Key**: [Get your Groq API key here](https://console.groq.com/playground). |
| 25 | +- **OpenAI API Key**: [Generate your OpenAI API key here](https://platform.openai.com/api-keys). |
| 26 | +- **Brave Search API Key**: [Obtain your Brave Search API key here](https://api.search.brave.com/app/dashboard). |
| 27 | + |
| 28 | +### Installation |
| 29 | + |
| 30 | +1. Clone the repository: |
| 31 | + ```git clone <repository-link>``` |
| 32 | +2. Install the required dependencies: |
| 33 | + ```npm install``` |
| 34 | + or |
| 35 | + ```bun install``` |
| 36 | +3. Create a `.env` file in the root of your project and add your API keys: |
| 37 | + ```GROQ_API_KEY=<your_groq_api_key> |
| 38 | + BRAVE_SEARCH_API_KEY=<your_brave_search_api_key> |
| 39 | + OPENAI_API_KEY=<your_openai_api_key>``` |
| 40 | +
|
| 41 | +### Running the Server |
| 42 | +
|
| 43 | +To start the server, execute: |
| 44 | +```npm start``` |
| 45 | +The server will be listening on port 3005. |
| 46 | +
|
| 47 | +## Usage |
| 48 | +
|
| 49 | +Make a POST request to `localhost:3005` with a JSON body containing your query and the desired parameters: |
| 50 | +
|
| 51 | +```{ |
| 52 | + "message": "Your question here", |
| 53 | + "returnSources": true, |
| 54 | + "returnFollowUpQuestions": true, |
| 55 | + "embedSourcesInLLMResponse": false, |
| 56 | + "textChunkSize": 800, |
| 57 | + "textChunkOverlap": 200, |
| 58 | + "numberOfSimilarityResults": 2, |
| 59 | + "numberOfPagesToScan": 4 |
| 60 | +}``` |
| 61 | +
|
| 62 | +The engine will process your query and return a comprehensive answer along with sources and, if requested, follow-up questions. |
| 63 | +
|
| 64 | +## YouTube Tutorial |
| 65 | +
|
| 66 | + |
| 67 | +
|
| 68 | +[Watch the tutorial here](https://youtu.be/43ZCeBTcsS8) for a detailed guide on setting up and running this project. The video covers every step of the process, from API key acquisition to server deployment. |
| 69 | +
|
| 70 | +## Contributing |
| 71 | +
|
| 72 | +Contributions to the project are welcome. Feel free to fork the repository, make your changes, and submit a pull request. You can also open issues to suggest improvements or report bugs. |
| 73 | +
|
| 74 | +## License |
| 75 | +
|
| 76 | +This project is licensed under the MIT License - see the LICENSE file for more details. |
| 77 | +
|
| 78 | +I'm the developer behind Developers Digest. If you find my work helpful or enjoy what I do, consider supporting me. Here are a few ways you can do that: |
| 79 | +
|
| 80 | +- **Patreon**: Support me on Patreon at [patreon.com/DevelopersDigest](https://www.patreon.com/DevelopersDigest) |
| 81 | +- **Buy Me A Coffee**: You can buy me a coffee at [buymeacoffee.com/developersdigest](https://www.buymeacoffee.com/developersdigest) |
| 82 | +- **Website**: Check out my website at [developersdigest.tech](https://developersdigest.tech) |
| 83 | +- **Github**: Follow me on GitHub at [github.com/developersdigest](https://github.com/developersdigest) |
| 84 | +- **Twitter**: Follow me on Twitter at [twitter.com/dev__digest](https://twitter.com/dev__digest) |
0 commit comments