Copyright (c) [2024] Kabeer Singh Thockchom. All rights reserved. This software and associated documentation files (the "Software") are the exclusive property of Kabeer Singh Thockchom. The Software is provided for viewing purposes only and is not open source. Unauthorized copying, modification, distribution, or use of this Software, via any medium, is strictly prohibited. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Any violation of this license may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law.RACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Welcome to the Restaurant AI Assistant, an intelligent chatbot designed to enhance the dining experience for customers of Bottega Restaurant.
- Menu Information: Fetch details about menu items, including descriptions and prices.
- Order Management: Place orders, modify cart contents, and check order status.
- Personalization: See your previous order, get recommendations from AI.
Check out our AI Assistant in action:
Check out our AI Assistant in action: Restaurant AI Assistant Demo
Enter your API keys in the env file
ANTHROPIC_API_KEY (https://console.anthropic.com/)
TWILIO_ACCOUNT_SID (https://console.twilio.com/)
TWILIO_AUTH_TOKEN (https://console.twilio.com/)
twilio_phone_number
restaurant_phone_number
(Recommended) Setup LangChain API for tracing and monitoring (https://smith.langchain.com)
LANGCHAIN_API_KEY
LANGCHAIN_TRACING_V2 = True
LANGCHAIN_PROJECT = "Project Name of Choice"
STRIPE_SECRET_KEY
-
Start the Flask server:
python app.py
-
Open your web browser and navigate to
http://localhost:5000
-
Start interacting with the AI Assistant to explore menu items, place orders, or get assistance with your dining experience.
- Python
- Flask
- SQLite
- LangChain + LangGraph
- Anthropic Claude Sonnet 3.5
- React (for the frontend)
- Twilio API for text messaging feature
- Stripe API for payments
We welcome contributions to improve the Restaurant AI Assistant. Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Mac M1 computer
- Docker Desktop installed and running
- Google Cloud SDK installed
- A Google Cloud Platform account with a project set up
- Git repository with the Aramex chatbot code
-
Open Terminal and navigate to your project directory.
-
Ensure you have a
.env
file in your project root with all necessary environment variables:ANTHROPIC_API_KEY=your_anthropic_api_key TWILIO_ACCOUNT_SID=your_twilio_account_sid TWILIO_AUTH_TOKEN=your_twilio_auth_token LANGCHAIN_API_KEY=your_langchain_api_key LANGCHAIN_TRACING_V2=true LANGCHAIN_PROJECT=ARABOT_DEMO_1 twilio_phone_number=your_twilio_phone_number restaurant_phone_number=your_restaurant_phone_number
-
Update the
app.py
to use the correct port:if __name__ == '__main__': app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
Create a Dockerfile
in your project root with the following content:
FROM --platform=linux/amd64 python:3.11-slim
WORKDIR /app
COPY build ./build
COPY app.py .
COPY requirements.txt .
COPY customer_chatbot_new.db .
COPY customer_chatbot_new_memory.db .
COPY .env .
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 8080
CMD ["python", "app.py"]
-
Enable Docker BuildKit:
export DOCKER_BUILDKIT=1
-
Create a new builder instance:
docker buildx create --name mybuilder --use
-
Build and push the Docker image:
docker buildx build --platform linux/amd64 -t gcr.io/[PROJECT-ID]/aramex-chatbot:latest . --push
Replace
[PROJECT-ID]
with your Google Cloud Project ID.
-
Authenticate with Google Cloud:
gcloud auth login gcloud config set project [PROJECT-ID]
-
Enable required GCP services:
gcloud services enable run.googleapis.com containerregistry.googleapis.com
-
Deploy to Cloud Run:
gcloud run deploy aramex-chatbot \ --image gcr.io/[PROJECT-ID]/aramex-chatbot:latest \ --platform managed \ --region [REGION] \ --allow-unauthenticated \ --port 8080
Replace
[REGION]
with your desired region (e.g.,us-central1
).
- After successful deployment, Cloud Run will provide a URL where your application is hosted.
- Open the provided URL in a web browser to verify that your Aramex chatbot is running correctly.
- Test the chatbot functionality to ensure it's working as expected in the cloud environment.
-
If you encounter issues with the build process, try removing the existing builder and creating a new one:
docker buildx rm mybuilder docker buildx create --name mybuilder --use
-
If environment variables are not being recognized, double-check that they are correctly set in the Cloud Run console or through the
gcloud
command. -
Monitor the application logs in the Google Cloud Console for any runtime errors or issues.
-
To update your application, make changes to your local code, rebuild the Docker image with a new tag, and redeploy using the same
gcloud run deploy
command with the new image tag. -
Regularly update your dependencies and base Docker image to ensure you have the latest security patches.
For any questions or support, please contact [email protected]