This project implements a system for retrieving arguments using the "Retrieve and Generate" (RAG) technique. The code is capable of extracting information from a Word document (in .docx
format) and generating answers based on the questions asked. The goal is to facilitate the consultation of information contained in the document, allowing users to obtain answers quickly and efficiently.
To execute the project, follow the steps below:
-
Clone the repository:
git clone https://github.com/jonhnatta/retrieve-generate.git cd retrieve-generate
-
Install the dependencies: Make sure you have Python and
pip
installed. Then, install the necessary dependencies:pip install -r requirements.txt
-
Prepare the document: The file you want to read must be present in the root of the project.
- The file must be of the
.docx
type.
- The file must be of the
-
Change the code:
-
Look for the variable
document_link
in the code and change the file name to what you placed in the root of the project.document_link = "./<file_name>.docx" # Change the path
-
Configure the template: In addition to changing the
document_link
, you should also modify the instructions in the template. Look for the following line in the code:TEMPLATE = """ <agent instruction> ... """
Replace the instruction with another that fits your agent.
-
Configure the API key: Create a
.env
file in the root of the project and add the following line:OPENAI_API_KEY=<your_api_key>
-
Run the code: After ensuring that the document is in the correct place and that all dependencies are installed, you can run the code:
python main.py
Feel free to contribute with improvements or fixes. To do this, create a fork of the repository and submit a pull request with your changes.