Skip to content

Commit

Permalink
Resolved conflicts new branch and merge in new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lperezmo committed Jan 17, 2024
2 parents 8f7a84e + efdce17 commit 5a2a8af
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 12 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/azure-functions-app-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This workflow will build a Python app and deploy it to an Azure Functions App on Linux when a commit is pushed to your default branch.
#
# This workflow assumes you have already created the target Azure Functions app.
# For instructions see https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python?pivots=python-mode-configuration
#
# To configure this workflow:
# 1. Set up the following secrets in your repository:
# - AZURE_FUNCTIONAPP_PUBLISH_PROFILE
# 2. Change env variables for your configuration.
#
# For more information on:
# - GitHub Actions for Azure: https://github.com/Azure/Actions
# - Azure Functions Action: https://github.com/Azure/functions-action
# - Publish Profile: https://github.com/Azure/functions-action#using-publish-profile-as-deployment-credential-recommended
# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential
#
# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp

name: Deploy Python project to Azure Function App

on:
push:
branches: ["main"]

env:
AZURE_FUNCTIONAPP_NAME: 'UniqueLuisGithubFunction' # set this to your function app name on Azure
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root
PYTHON_VERSION: '3.11' # set this to the python version to use (e.g. '3.6', '3.7', '3.8')

jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: dev
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

# If you want to use Azure RBAC instead of Publish Profile, then uncomment the task below
# - name: 'Login via Azure CLI'
# uses: azure/login@v1
# with:
# creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository

- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: 'Resolve Project Dependencies Using Pip'
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
python -m pip install --upgrade pip
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC
scm-do-build-during-deployment: true
enable-oryx-build: true
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ SMS Helper is an AI-powered, function-calling text assistant designed to process
2. Create required environment variables on your function.
- `ACCOUNT_SID`
- `AUTH_TOKEN`
- `TWIL_NUMBER`
- `TWIL_EXAMPLE_NUMBER`
- `OPENAI_API_KEY`
- `SENTRY_DSN`

![Setting Env variables in Azure](images\azure_func_env_variables.png)
<img src="images\azure_func_env_variables.png" alt="Setting Env variables in Azure">
2. In VS Code, install the Azure Functions extension (this will make it way easier).

<img src="images\extension.png" alt="Extension" width="200">
Expand All @@ -29,7 +27,7 @@ SMS Helper is an AI-powered, function-calling text assistant designed to process
* **(Optional)** If using the 'schedule reminders' function, edit system message and API call to get the current time and date if you want something different than pacific time.
4. Go to the extension, and under 'Workspace' click on the little thunder sign and select 'Deploy to existing function...'.

![Deploy](images\deploy.png)
<img src="images\deploy.png" alt="Deploy">

5. Follow the prompts and done. Get your URL endpoint from Azure & load on Twilio.

Expand All @@ -40,7 +38,7 @@ SMS Helper is an AI-powered, function-calling text assistant designed to process
2. Go to Phone Numbers > Manage > Active Numbers > Your number > Messaging configuration.
3. Set when a message comes in to use a webhook with your Azure Function endpoint (see image below)

![Twilio config](images\messaging_configuration.png)
<img src="images\messaging_configuration.png" alt="Twilio config">

*Note: Your endpoint will look like this:
`https://YOUR-FUNCTION-NAME.azurewebsites.net/api/sms_helper`*
Expand Down
2 changes: 0 additions & 2 deletions alternative_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#------------------------------------#
ACCOUNT_SID = os.environ["ACCOUNT_SID"]
AUTH_TOKEN = os.environ["AUTH_TOKEN"]
TWIL_NUMBER = os.environ["TWIL_NUMBER"]
TWIL_EXAMPLE_NUMBER = os.environ["TWIL_EXAMPLE_NUMBER"]

#------------------------------------#
# OpenAI and Twilio Clients
Expand Down
2 changes: 0 additions & 2 deletions helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#------------------------------------#
ACCOUNT_SID = os.environ["ACCOUNT_SID"]
AUTH_TOKEN = os.environ["AUTH_TOKEN"]
TWIL_NUMBER = os.environ["TWIL_NUMBER"]
TWIL_EXAMPLE_NUMBER = os.environ["TWIL_EXAMPLE_NUMBER"]

#------------------------------------#
# OpenAI and Twilio Clients
Expand Down
4 changes: 1 addition & 3 deletions sms-helper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# For initial testing capture 100% of transactions for monitoring
traces_sample_rate=1.0,
)
ACCOUNT_SID = os.environ["ACCOUNT_SID"]


#------------------------------------#
# Main function
Expand Down Expand Up @@ -48,4 +46,4 @@ def main(req: func.HttpRequest) -> func.HttpResponse:
send_to,
send_from,
incoming_message)
return func.HttpResponse(response_for_user, status_code=200)
return func.HttpResponse(response_for_user, status_code=200)

0 comments on commit 5a2a8af

Please sign in to comment.