Skip to content
Snippets Groups Projects
Commit 4cd0de0e authored by abir.chebbi's avatar abir.chebbi
Browse files

readme part2

parent 0af66991
Branches
No related tags found
No related merge requests found
......@@ -15,9 +15,9 @@ Create an S3 bucket and upload a few PDF files by running:
`python3 create-S3-and-put-docs.py --bucket_name [YourBucketName] --local_path [PathToYourPDFFiles]`
Where:
- **--bucket_name**: The name for the new S3 bucket to be created.
- **--local_path**: The local directory path where the PDF files are stored.
Where placeholders:
- **[YourBucketName]**: The name for the new S3 bucket to be created.
- **[PathToYourPDFFiles]**: The local directory path where the PDF files are stored.
### Step 2: Vector Store Creation
......@@ -25,9 +25,9 @@ Create a vector database for storing embeddings by running:
`python3 create-vector-db.py --collection_name [Name_of_colletion] --iam_user [YourIAM_user]`
Where:
- **--collection_name**: Name of the collection that you want to create to store embeddings.
- **--iam_user** : For example for group 14 the iam_user is `master-group-14`
Where placeholders:
- **[Name_of_colletion]**: Name of the collection that you want to create to store embeddings.
- **[YourIAM_user]** : For example for group 14 the iam_user is `master-group-14`
This script performs the following actions:
......@@ -43,12 +43,12 @@ Run:
`python3 main.py --bucket_name [YourBucketName] --endpoint [YourVectorDBEndpoint] --index_name [Index_name] --local_path [local_path]`
Where:
Where placeholders:
- **--bucket_name**: The name of the S3 bucket containing the PDF files.
- **--endpoint**: Endpoint for the vector database.
- **--index_name**: The index_name where to store the embeddings in the collection.
- **--local_path**: local_path
- **[YourBucketName]**: The name of the S3 bucket containing the PDF files.
- **[YourVectorDBEndpoint]**: Endpoint for the vector database.
- **[Index_name]**: The index_name where to store the embeddings in the collection.
- **[local_path]**: local_path
The main.py script will:
......@@ -61,25 +61,46 @@ The main.py script will:
## Part 2:
### Set up environment
### Step 1: Preparation
Before deploying the chatbot on an EC2 instance, complete the following preliminary steps:
Install required python libraries listed in the 'requirements.txt':
1. Create a Key Pair: This key pair will be used for SSH access to your EC2 instance whe you need it.
`pip3 install -r requirements.txt`
2. Create a Security Group: Define rules to allow the instance to be accessible externally. The security group should include the following rules:
- For inbound rules: you need to allow SSH traffic, HTTP/HTTPs trafic and 8501 for streamlit.
- Outbound Rules: Allow all traffic.
* Prepare config.ini:
Ensure your config.ini file includes your AWS credentials (aws_access_key_id, aws_secret_access_key, region), with the region set to 'us-east-1'. Also, include the endpoint and index_name for the OpenSearch service established earlier.
### Step 2: Launching the Instance
Utilize the provided create_instance.py script to deploy your EC2 instance with the essential startup configurations. Before executing this, adjust Security Group and Key Pair already created in the first step.
In the `ec2.create_instance` we have the following parameters:
### Step 1: Create VM
- ImageId: `ami-03a1012f7ddc87219`, this is a custom Amazon Machine Image (AMI) that contains all the configurations and dependencies required for the chatbot application.
- UserData: is used to run script after the instance starts. The script will put the credentials in the instance so that the instance can aceess other services in AWS, and the endpoint for the Vector DB, index name. Then the script will run the application.
## Step 2: Running the app
This is the script:
Launch the Streamlit application which interacts with the Vector Store , LLM for embeddings and LLM for text generation:
```yaml
script = f"""#!/bin/bash
cat <<EOT > /home/ubuntu/chatbot-lab/Part\ 2/config.ini
{config_content}
EOT
source /home/ubuntu/chatbotlab/bin/activate
## Run the apllication
cd /home/ubuntu/chatbot-lab/Part\ 2
streamlit run main.py
`streamlit run main.py -- --endpoint [YourVectorDBEndpoint] --index_name [YourIndexName]`
````
Where:
Run the following command to create your instance:
- **--endpoint**: Endpoint for the vector database.
- **--index_name**: The index_name where to store the embeddings in the collection.
`python3 create_instance.py`
## Step 3: Accessing the app:
Once the app starts, navigate to this URL `http://[public_ip_adress_of_yourVM]:8501` in your web browser to start interacting with your chatbot.
\ No newline at end of file
Once the app starts, navigate to this URL `http://[public_ip_adress_of_yourVM]:8501` in your web browser to start interacting with your chatbot
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment