From 5892cb73dbe97f3c37356a38408063c6cea670bb Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Mon, 28 Oct 2024 20:53:25 +0000 Subject: [PATCH 1/2] Use westus endpoint for chat completions --- src/backend/fastapi_app/__init__.py | 2 +- src/backend/fastapi_app/openai_clients.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/fastapi_app/__init__.py b/src/backend/fastapi_app/__init__.py index c1be19e..95ba510 100644 --- a/src/backend/fastapi_app/__init__.py +++ b/src/backend/fastapi_app/__init__.py @@ -52,7 +52,7 @@ def create_app(testing: bool = False): else: if not testing: load_dotenv(override=True) - logging.basicConfig(level=logging.INFO) + logging.basicConfig(level=logging.DEBUG) # Turn off particularly noisy INFO level logs from Azure Core SDK: logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.WARNING) logging.getLogger("azure.identity").setLevel(logging.WARNING) diff --git a/src/backend/fastapi_app/openai_clients.py b/src/backend/fastapi_app/openai_clients.py index 10d2f50..4fb88bb 100644 --- a/src/backend/fastapi_app/openai_clients.py +++ b/src/backend/fastapi_app/openai_clients.py @@ -14,7 +14,7 @@ async def create_openai_chat_client( OPENAI_CHAT_HOST = os.getenv("OPENAI_CHAT_HOST") if OPENAI_CHAT_HOST == "azure": api_version = os.environ["AZURE_OPENAI_VERSION"] or "2024-03-01-preview" - azure_endpoint = os.environ["AZURE_OPENAI_ENDPOINT"] + azure_endpoint = "https://pf-openai-keylesslf653mu3fc22i-openai.openai.azure.com/" azure_deployment = os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT"] if api_key := os.getenv("AZURE_OPENAI_KEY"): logger.info( From 694e9837b702b2d65c694d41e56c7d569676cafe Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Mon, 28 Oct 2024 20:55:45 +0000 Subject: [PATCH 2/2] Rm unused workflows --- .github/workflows/azure-dev.yaml | 66 ---------------------- .github/workflows/bicep-security-scan.yaml | 40 ------------- .github/workflows/python-code-quality.yaml | 36 ------------ 3 files changed, 142 deletions(-) delete mode 100644 .github/workflows/azure-dev.yaml delete mode 100644 .github/workflows/bicep-security-scan.yaml delete mode 100644 .github/workflows/python-code-quality.yaml diff --git a/.github/workflows/azure-dev.yaml b/.github/workflows/azure-dev.yaml deleted file mode 100644 index 70675e6..0000000 --- a/.github/workflows/azure-dev.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: Deploy with azd - -on: - workflow_dispatch: - push: - branches: [ main ] - -# GitHub Actions workflow to deploy to Azure using azd -# To configure required secrets for connecting to Azure, simply run `azd pipeline config` - -# Set up permissions for deploying with secretless Azure federated credentials -# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication -permissions: - id-token: write - contents: read - -jobs: - build: - runs-on: ubuntu-latest - env: - # azd required - AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} - AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} - AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} - AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} - AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} - # project specific - DEPLOY_AZURE_OPENAI: ${{ vars.DEPLOY_AZURE_OPENAI }} - AZURE_OPENAI_CHAT_MODEL: ${{ vars.AZURE_OPENAI_CHAT_MODEL }} - AZURE_OPENAI_CHAT_DEPLOYMENT: ${{ vars.AZURE_OPENAI_CHAT_DEPLOYMENT }} - AZURE_OPENAI_CHAT_DEPLOYMENT_VERSION: ${{ vars.AZURE_OPENAI_CHAT_DEPLOYMENT_VERSION }} - AZURE_OPENAI_CHAT_DEPLOYMENT_CAPACITY: ${{ vars.AZURE_OPENAI_CHAT_DEPLOYMENT_CAPACITY }} - AZURE_OPENAI_EMBED_MODEL: ${{ vars.AZURE_OPENAI_EMBED_MODEL }} - AZURE_OPENAI_EMBED_DEPLOYMENT: ${{ vars.AZURE_OPENAI_EMBED_DEPLOYMENT }} - AZURE_OPENAI_EMBED_DEPLOYMENT_VERSION: ${{ vars.AZURE_OPENAI_EMBED_DEPLOYMENT_VERSION }} - AZURE_OPENAI_EMBED_DEPLOYMENT_CAPACITY: ${{ vars.AZURE_OPENAI_EMBED_DEPLOYMENT_CAPACITY }} - AZURE_OPENAI_EMBED_DIMENSIONS: ${{ vars.AZURE_OPENAI_EMBED_DIMENSIONS }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install azd - uses: Azure/setup-azd@v1.0.0 - - - name: Install Nodejs - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Log in with Azure (Federated Credentials) - if: ${{ env.AZURE_CLIENT_ID != '' }} - run: | - azd auth login ` - --client-id "$Env:AZURE_CLIENT_ID" ` - --federated-credential-provider "github" ` - --tenant-id "$Env:AZURE_TENANT_ID" - shell: pwsh - - - name: Provision Infrastructure - run: azd provision --no-prompt - env: - AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }} - - - name: Deploy Application - run: azd deploy --no-prompt diff --git a/.github/workflows/bicep-security-scan.yaml b/.github/workflows/bicep-security-scan.yaml deleted file mode 100644 index 5379309..0000000 --- a/.github/workflows/bicep-security-scan.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Bicep Security Scan -on: - push: - branches: [ main ] - paths: - - "infra/**" - pull_request: - branches: [ main ] - paths: - - "infra/**" - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - permissions: - security-events: write - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Build Bicep for linting - uses: azure/CLI@v2 - with: - inlineScript: | - export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 - az config set bicep.use_binary_from_path=false && az bicep build -f infra/main.bicep --stdout - - - name: Run Microsoft Security DevOps Analysis - uses: microsoft/security-devops-action@preview - id: msdo - continue-on-error: true - with: - tools: templateanalyzer - - - name: Upload alerts to Security tab - uses: github/codeql-action/upload-sarif@v3 - if: github.repository == 'Azure-Samples/azure-search-openai-demo' - with: - sarif_file: ${{ steps.msdo.outputs.sarifFile }} diff --git a/.github/workflows/python-code-quality.yaml b/.github/workflows/python-code-quality.yaml deleted file mode 100644 index fce62c6..0000000 --- a/.github/workflows/python-code-quality.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Python code quality - -on: - push: - branches: [ main ] - paths: - - '**.py' - - pull_request: - branches: [ main ] - paths: - - '**.py' - - workflow_dispatch: - -permissions: - contents: read - -jobs: - checks-format-and-lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - cache: 'pip' - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install ruff - - name: Lint with ruff - run: ruff check . - - name: Check formatting with ruff - run: ruff format . --check