This project develops an intelligent agent capable of interpreting natural language by turning it into queries for data extraction from Opensearch. It is designed to make searching and analyzing vast volumes of information more intuitive and accessible.
Before starting the installation, check that you have the following prerequisites:
- Git: needed to clone the repository.
- Poetry: used for Python dependency management.
- Docker and Docker Compose: to start Opensearch.
To get the project, clone the GitHub repository with the following command:
git clone https://indirizzo-del-tuo-repository.git
cd opensearch-agent
Install the necessary dependencies by running:
poetry install
Start an instance of Opensearch on your system with Docker Compose:
docker-compose up
This command starts Opensearch and the Opensearch Dashboard. The login credentials are admin/admin.
Run the following command to populate Opensearch with fake data:
poetry run python fake_data.py
After running the command, you will be able to display two indexes in your Opensearch Dashboard at http://localhost:5601
(user: admin, password: admin) using the command GET _cat/indices
. The transaction-related indexes are:
- transactions-2024-07
- transactions-2024-06
To configure the two variables in the .env file after renaming it from .env.example, enter the following lines, replacing the example values with your specific data:
OPENAI_API_KEY=sk-XXXXXXXXXXXXXXXXXXXXXXXX
FOLDER_PLOT_PATH=/Users/myuser/project/opensearch-agent/plots
Be sure to replace sk-.. with your actual OpenAI API key and /Users/myuser/project/opensearch-agent/plots with the actual path to the folder where you wish to work.
Start the agent with the command:
poetry run streamlit run agent_streamlit.py
By following these steps, you will be able to start the Opensearch agent to explore and analyze data through a simple user interface that interprets natural language. Below is an example of queries