Hugo's Portfolio

Task Oriented Dialogue Assistant Model (ToDAM)

May 31, 2024 (5mo ago)

This is the project that I served as an Intern at eCloudValley in 2024/03-2024/05. The project is to build a ticket system for the customer service department.

TODAM Ticket System
TODAM Ticket System

Developing Requirements

Python version python3.11 or later with poetry to manage the dependencies.

Important

If you have not installed poetry, please install it by following the official guide

Required Dependencies

  • gradio = "^4.31.0"
  • uvicorn = "^0.29.0"
  • aws-cdk-lib = "^2.141.0"
  • constructs = "^10.3.0"
  • mangum = "^0.17.0"

Build venv for MacOS

1$ python3.11 -m venv venv 2$ source venv/bin/activate 3$ poetry install 4$ rm -rf venv # remove the venv

Build venv for Windows

1$ pip install virtualenv 2$ virtualenv venv 3$ venv\Scripts\activate 4$ poetry install 5$ rmdir /s venv # remove the venv

Run web app

Edit the .env file with your own token. Also need to follow the mode of the web app.

1$ cp .env.example .env.<MODE>
1# Ticket System Part 2DEPARTMENT_ID="MSP_ID" 3 4# API Endpoint Part 5SUBMIT_TICKET_API_URL="DEPLOYED_SUBMIT_TICKET_API_URL" 6LIST_LOG_SEGMENT_API_URL="DEPLOYED_LIST_LOG_SEGMENT_API_URL" 7LIST_CHAT_HISTORY_API_URL="DEPLOYED_LIST_CHAT_HISTORY_API_URL" 8BEDROCK_API_URL="DEPLOYED_BEDROCK_API_URL" 9 10# AWS CDK Part 11CDK_DEFAULT_ACCOUNT="YOUR_AWS_CDK_DEFAULT_ACCOUNT" 12CDK_DEFAULT_REGION="YOUR_AWS_CDK_DEFAULT_REGION"

Run the web app with the following command.

1# run the web app in development mode 2$ python app.py --port 8080 --dev 3# run the web app in test mode 4$ python app.py --port 8080 --test 5# run the web app in production mode 6$ python app.py --port 8080 --prod 7 8# Also you can customize the port number 9$ python app.py --port 8081 --dev

Note

If you want to run the app with the uvicorn server, so that you can design your own API and reload the app, you can run the following command.

1$ ./scripts/run.sh 2 3# or 4$ uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload

This will use the .env as the default configuration file.

Deployment

with docker installed, you can build and run the docker image.

Build the docker image

1$ docker build -t todam-ticket-system:<TAG_NAME> . 2 3$ docker run -p 8080:8080 todam-ticket-system:<TAG_NAME>

Deploy to AWS Lambda Function with AWS CDK

1$ cdk bootstrap 2$ cdk deploy

CONTACT INFO.

Cloud Engineer Intern, eCloudValley
Hugo ChunHo Lin

License

Released under Apache License by TODAM-tw.