From b9167e0e511fd31ad4553ef8fcb8fdd40814e547 Mon Sep 17 00:00:00 2001 From: Yoom Lam Date: Fri, 7 Jun 2024 18:07:07 -0500 Subject: [PATCH] add Initialize app step --- .github/workflows/push-image.yml | 18 ++++++++++++++++-- .../chatbot/llms/groq_client.py | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push-image.yml b/.github/workflows/push-image.yml index 51568b8..c72b491 100644 --- a/.github/workflows/push-image.yml +++ b/.github/workflows/push-image.yml @@ -92,8 +92,11 @@ jobs: # The ENV_FILE_CONTENTS contains API keys, like LITERAL_API_KEY and OPENAI_API_KEY # As such, make sure the built image is not publicly accessible cd ${{ inputs.dockerfile_folder }} - echo "${{ secrets[env.SECRET_NAME] }}" > .env - wc .env + # TODO: Remove conditional once "Initialize app" step works + if [ "${{ inputs.dockerfile_folder }}" != "05-assistive-chatbot" ]; then + echo "${{ secrets[env.SECRET_NAME] }}" > .env + wc .env + fi - name: "Build image: ${{ github.sha }}" if: inputs.build_image @@ -173,4 +176,15 @@ jobs: sleep 10 ./.github/workflows/waitForLightsail.sh deployment + + - name: "Initialize app" + if: inputs.deploy_image + run: | + # The ENV_FILE_CONTENTS contains API keys, like LITERAL_API_KEY and OPENAI_API_KEY + # As such, make sure the built image is not publicly accessible + echo "${{ secrets[env.SECRET_NAME] }}" > .env + + SVC_URL=$(aws lightsail get-container-services --service-name "$SERVICE_NAME" | jq -r '.containerServices[0].url') + curl -X POST "SVC_URL/initenvs" --data-binary '@.env' + # TODO: warm up vector DB on startup diff --git a/05-assistive-chatbot/chatbot/llms/groq_client.py b/05-assistive-chatbot/chatbot/llms/groq_client.py index 5a65f08..7d941e8 100644 --- a/05-assistive-chatbot/chatbot/llms/groq_client.py +++ b/05-assistive-chatbot/chatbot/llms/groq_client.py @@ -24,6 +24,7 @@ def __init__(self, model_name, settings): self.model_name = model_name self.settings = settings logger.info("Creating LLM client '%s' with %s", model_name, self.settings) + # TODO: remove temperature from settings self.client = Groq(**self.settings) def generate_reponse(self, message):