This project demonstrates how to integrate the Qdrant vector database with the OpenAI language model to enable efficient processing and retrieval of information from large text datasets.
The goal of this project is to showcase how Qdrant can be used to store vectors representing text fragments and how OpenAI can be utilized to generate answers to questions based on the context provided by these fragments. This project can serve as an example for a LinkedIn post to demonstrate skills in integrating AI technologies.
- Node.js
- Packages:
dotenv,fs,@qdrant/js-client-rest,openai,uuid
- Clone the repository to your local machine.
- Install the required packages:
npm i
- Create a
.envfile and add your API keys:QDRANT_URL=your_qdrant_url QDRANT_KEY=your_qdrant_api_key OPENAI_KEY=your_openai_api_key
Remember about creating vector database via Qdrant: https://qdrant.tech/pricing
-
prepare-collection.js: Responsible for loading text from a file, chunking the text with overlap, creating a collection in Qdrant if it doesn't exist, generating vectors using OpenAI, and saving them in Qdrant. -
rag-search.js: Handles user input for questions, generates a vector for the question using OpenAI, retrieves relevant context from Qdrant, and generates an answer based on that context.
To run the project, execute the following command:
node prepare-collection.jsThis file create a collection in Qdrant
Then, to ask a question, run:
node rag-search.jsRemember about config.js - You can change name of collection
This project illustrates how to leverage Qdrant and OpenAI to create intelligent applications capable of processing and analyzing large text datasets. By integrating these technologies, users can obtain quick and accurate answers to their questions, opening new possibilities for data analysis and user interaction.
Thank you for reviewing the documentation! If you have any questions or need further information, feel free to reach out.