A POC (Proof of Concept) AI chatbot web application desinged to interact with construction contractors and provide helpful information regarding fairfax county code and manuls.
- Interactive chat web interface
- Uses the LangGraph framework for natural language processing.
- Uses Rag and vectorstore to retrieve relevant information about fairfax county code and manuls
- Serverless backend API services
- Python 3.12
- Required Python libraries (see
requirements.txt
for details). - Google Cloud Vertex API Key
- Pinecone API Key
- Groq API Key
- Create a new project in the Google Cloud Console.
- Setup credentials and download credentials into
./service
directory
- Create Groq API key. You can retrieve the key from the GROQ Console.
- Create a Pinecone cluster. You can retrieve the API key from the Pinecone Console.
- Crawl the fairfax county website using the script
python ./scripts/vectorstores/my_crawler.py
- This will download all the fairfax county information in
service/consultation_company/vectorstores/web_scraping_data
- Then run
python ./scripts/vectorstores/pinecone_loader.py
to load the documents into the pinecone vectorstore.
-
Clone the repository:
git clone https://github.com/wonhs91/fairfax-construction-assistant.git cd fairfax-construction-assistant
-
Create a virtual environment (optional but recommended):
python -m venv .venv source venv/bin/activate # On Windows: .venv\Scripts\activate
-
Client setup
-
Install dependencies:
- from the workspace directory
cd client npm install
- from the workspace directory
-
Set up the .env file:
- Create a .env file in the
./client
directory of the project:
touch .env
- Add the server's endpoint
NEXT_PUBLIC_API_URL={server_endpoint}
replace server_endpoint with actual server endpoint from the server setup
- Create a .env file in the
-
Run the client application
cd client npm run dev
-
-
Server setup
- Install dependencies:
- from the workspace directory
cd service pip install -r requirements.txt
- Set up the .env file:
- Create a .env file in the
./service
directory of the project:
cp .env_sample .env
- Add the appropriate environment variables
- Create a .env file in the
- Run the server
cd service python app.py
- Install dependencies:
- Build docker image
docker build -t ffx-consultant-lambda .
- Test locally
docker run -p 9000:8080 ffx-consultant-lambda
-
test at `http://localhost:9000
-
Login to ECR
aws ecr get-login-password --region <your-region> | docker login --username AWS --password-stdin <account-id>.dkr.ecr.<your-region>.amazonaws.com
- Create a repository in ECR:
aws ecr create-repository --repository-name <repository-name>
- Tag the image
docker tag ffx-consultant-lambda:latest <account-id>.dkr.ecr.<your-region>.amazonaws.com/<repository-name>:latest
- Push the image
docker push <account-id>.dkr.ecr.<your-region>.amazonaws.com/<repository-name>:latest