Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

feat: Use Container Apps instead of Functions Apps for hosting

Clémence Lesné821f80efa28b
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..ed20015
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,4 @@
+APPLICATIONINSIGHTS_CONNECTION_STRING=xxx
+AZURE_CLIENT_ID=xxx
+AZURE_CLIENT_SECRET=xxx
+AZURE_TENANT_ID=xxx
diff --git a/.funcignore b/.funcignore
deleted file mode 100644
index f6c013e..0000000
--- a/.funcignore
+++ /dev/null
@@ -1,41 +0,0 @@
-# Local dev
-__pycache__/
-.devcontainer/
-.gitmodules/
-.python_packages/
-.python-version
-.ruff_cache/
-.syft.yaml
-.venv/
-.version.cache
-.version.config
-.vscode/
-*.egg-info/
-*.pyc
-*.sqlite*
-build/
-configs/
-DevTunnels/
-Makefile
-requirements-dev.txt
-
-# CICD
-.github/
-bicep/
-cicd/
-
-# Config
-*.env
-*.settings.json
-config.*
-
-# Tests
-.pytest_cache/
-sbom-reports/
-test-reports/
-tests/
-
-# Documentation
-*.md
-docs/
-examples/
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 7aeb83d..83ebfc8 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -15,3 +15,8 @@ updates:
target-branch: develop
schedule:
interval: weekly
+ - package-ecosystem: docker
+ directory: ""
+ target-branch: develop
+ schedule:
+ interval: weekly
diff --git a/.github/workflows/pipeline.yaml b/.github/workflows/pipeline.yaml
index 957cbfb..ba8db6c 100644
--- a/.github/workflows/pipeline.yaml
+++ b/.github/workflows/pipeline.yaml
@@ -14,6 +14,13 @@ on:
- hotfix/*
- main
+env:
+ CONTAINER_NAME: ${{ github.repository }}
+ CONTAINER_REGISTRY_GHCR: ghcr.io
+ CONTAINER_PLATFORMS: linux/amd64,linux/arm64/v8
+ # https://github.com/docker/buildx/releases
+ BUILDX_VERSION: 0.17.1
+
jobs:
init:
name: Init
@@ -71,7 +78,7 @@ jobs:
# Semgrep can be used to break the build when it detects security issues. In this case we want to upload the issues to GitHub Security
continue-on-error: true
env:
- SEMGREP_RULES: p/cwe-top-25 p/owasp-top-ten
+ SEMGREP_RULES: p/cwe-top-25 p/owasp-top-ten p/dockerfile
run: semgrep ci --sarif --output=semgrep.sarif
- name: Upload results to GitHub Security
@@ -79,12 +86,80 @@ jobs:
with:
sarif_file: semgrep.sarif
- create-release:
- name: Create release
+ build-image:
+ name: Build & publish image
needs:
- init
- sast-creds
- sast-semgrep
+ runs-on: ubuntu-22.04
+ permissions:
+ # Allow to write to GitHub Packages
+ packages: write
+ steps:
+ - name: Checkout
+ uses: actions/[email protected]
+
+ - name: Configure Git
+ run: |
+ git config user.name "${{ github.actor }}"
+ git config user.email "${{ github.actor }}@users.noreply.github.com"
+
+ - name: Setup QEMU
+ id: setup-qemu
+ uses: docker/[email protected]
+ with:
+ platforms: ${{ env.CONTAINER_PLATFORMS }}
+
+ - name: Setup Docker Buildx
+ uses: docker/[email protected]
+ with:
+ version: v${{ env.BUILDX_VERSION }}
+
+ - name: Login to registry - GitHub
+ uses: docker/[email protected]
+ with:
+ registry: ${{ env.CONTAINER_REGISTRY_GHCR }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Container meta
+ id: meta
+ uses: docker/[email protected]
+ with:
+ images: ${{ env.CONTAINER_REGISTRY_GHCR }}/${{ env.CONTAINER_NAME }}
+ tags: |
+ type=raw,value=latest,enable={{is_default_branch}}
+ type=ref,event=branch
+ type=ref,event=pr
+ type=schedule
+ type=schedule,pattern={{date 'YYYYMMDD'}}
+ type=semver,pattern={{version}},value=${{ needs.init.outputs.VERSION_FULL }}
+ type=sha
+ labels: |
+ org.opencontainers.image.documentation=https://github.com/${{ env.CONTAINER_NAME }}
+ org.opencontainers.image.vendor=${{ github.actor }}
+
+ - name: Build/push container
+ uses: docker/[email protected]
+ with:
+ build-args: |
+ VERSION=${{ needs.init.outputs.VERSION_FULL }}
+ cache-from: type=gha
+ cache-to: type=gha
+ context: .
+ labels: ${{ steps.meta.outputs.labels }}
+ platforms: ${{ env.CONTAINER_PLATFORMS }}
+ provenance: true
+ push: true
+ sbom: true
+ tags: ${{ steps.meta.outputs.tags }}
+
+ create-release:
+ name: Create release
+ needs:
+ - init
+ - build-image
permissions:
# Allow to create releases
contents: write
@@ -119,45 +194,6 @@ jobs:
});
return data.id
- attest-dependencies:
- name: Attest - Dependencies
- permissions:
- # Allow to write to GitHub Security
- contents: write
- runs-on: ubuntu-22.04
- needs:
- - create-release
- steps:
- - name: Checkout
- uses: actions/[email protected]
-
- - name: Run attestation
- uses: advanced-security/[email protected]
- with:
- directoryExclusionList: tests,docs,examples
-
- attest-sbom:
- name: Attest - SBOM
- runs-on: ubuntu-22.04
- needs:
- - create-release
- - init
- steps:
- - name: Checkout
- uses: actions/[email protected]
-
- - name: Init Syft
- uses: anchore/sbom-action/[email protected]
-
- - name: Run attestation
- run: make sbom version_full=${{ needs.init.outputs.VERSION_FULL }}
-
- - name: Upload results to release
- uses: actions/[email protected]
- with:
- name: sbom
- path: sbom-reports/*
-
publish-release:
name: Publish release
permissions:
diff --git a/.gitignore b/.gitignore
index 5a25a30..574e1ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,5 @@
-# Created by https://www.toptal.com/developers/gitignore/api/osx,linux,dotenv,eclipse,windows,visualstudio,azurefunctions,jupyternotebooks,visualstudiocode,python
-# Edit at https://www.toptal.com/developers/gitignore?templates=osx,linux,dotenv,eclipse,windows,visualstudio,azurefunctions,jupyternotebooks,visualstudiocode,python
-
-### AzureFunctions ###
-# Azure Functions localsettings file
-local.settings.json
+# Created by https://www.toptal.com/developers/gitignore/api/osx,linux,dotenv,python,eclipse,windows,visualstudio,jupyternotebooks,visualstudiocode
+# Edit at https://www.toptal.com/developers/gitignore?templates=osx,linux,dotenv,python,eclipse,windows,visualstudio,jupyternotebooks,visualstudiocode
### dotenv ###
.env
@@ -731,7 +727,7 @@ FodyWeavers.xsd
### VisualStudio Patch ###
# Additional files built by Visual Studio
-# End of https://www.toptal.com/developers/gitignore/api/osx,linux,dotenv,eclipse,windows,visualstudio,azurefunctions,jupyternotebooks,visualstudiocode,python
+# End of https://www.toptal.com/developers/gitignore/api/osx,linux,dotenv,python,eclipse,windows,visualstudio,jupyternotebooks,visualstudiocode
# See: https://github.com/clemlesne/gitops-version
.version.cache
@@ -748,9 +744,6 @@ config*.yaml
# Tests reports
test-reports/
-# SBOM reports
-sbom-reports/
-
# Azure Functions
.python_packages/
diff --git a/.python-version b/.python-version
index ff7de60..9a941ac 100644
--- a/.python-version
+++ b/.python-version
@@ -1 +1 @@
-callcenterai311
+callcenterai312
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..7ca8f22
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,45 @@
+# Base container
+FROM docker.io/library/python:3.12-slim-bookworm@sha256:541d45d3d675fb8197f534525a671e2f8d66c882b89491f9dda271f4f94dcd06 AS base
+
+# Build container
+FROM base AS build
+
+RUN rm -f /etc/apt/apt.conf.d/docker-clean \
+ && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
+RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked --mount=target=/root/.cache/pip,type=cache,sharing=locked \
+ apt-get update -q \
+ && apt-get install -y -q --no-install-recommends \
+ gcc \
+ python3-dev \
+ && python3 -m pip install --upgrade \
+ pip \
+ setuptools \
+ wheel
+
+RUN python -m venv /venv
+ENV PATH=/venv/bin:$PATH
+
+COPY requirements.txt .
+RUN --mount=target=/root/.cache/pip,type=cache,sharing=locked \
+ python3 -m pip install --requirement requirements.txt
+
+# Output container
+FROM base
+
+ARG VERSION
+ENV VERSION=${VERSION}
+
+RUN useradd -m appuser \
+ && mkdir /app \
+ && chown -R appuser:appuser /app
+
+USER appuser
+
+COPY --from=build /venv /venv
+ENV PATH=/venv/bin:$PATH
+
+COPY --chown=appuser:appuser . /app
+
+WORKDIR /app
+
+CMD ["bash", "-c", "gunicorn main:api --bind 0.0.0.0:8080 --proxy-protocol --workers 4 --worker-class uvicorn.workers.UvicornWorker"]
diff --git a/Makefile b/Makefile
index bf60e6a..dafbfa1 100644
--- a/Makefile
+++ b/Makefile
@@ -4,10 +4,13 @@ version_small ?= $(shell $(MAKE) --silent version)
# Dev tunnels configuration
tunnel_name := call-center-ai-$(shell hostname | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
tunnel_url ?= $(shell res=$$(devtunnel show $(tunnel_name) | grep -o 'http[s]*://[^"]*' | xargs) && echo $${res%/})
+# Container configuration
+container_name := ghcr.io/clemlesne/call-center-ai
+docker := docker
+image_version := main
# App location
cognitive_communication_location := westeurope
default_location := swedencentral
-functionapp_location := swedencentral
openai_location := swedencentral
search_location := francecentral
# Sanitize variables
@@ -19,7 +22,6 @@ prompt_content_filter ?= true
# Bicep outputs
app_url ?= $(shell az deployment sub show --name $(name_sanitized) | yq '.properties.outputs["appUrl"].value')
blob_storage_public_name ?= $(shell az deployment sub show --name $(name_sanitized) | yq '.properties.outputs["blobStoragePublicName"].value')
-function_app_name ?= $(shell az deployment sub show --name $(name_sanitized) | yq '.properties.outputs["functionAppName"].value')
version:
@bash ./cicd/version/version.sh -g . -c
@@ -40,9 +42,6 @@ brew:
@echo "➡️ Installing Azure Dev tunnels..."
curl -sL https://aka.ms/DevTunnelCliInstall | bash
- @echo "➡️ Installing Syft..."
- brew install syft
-
@echo "➡️ Installing Twilio CLI..."
brew tap twilio/brew && brew install twilio
@@ -107,20 +106,26 @@ tunnel:
devtunnel host $(tunnel_name)
dev:
- VERSION=$(version_full) PUBLIC_DOMAIN=$(tunnel_url) func start
+ VERSION=$(version_full) PUBLIC_DOMAIN=$(tunnel_url) python3 -m gunicorn main:api \
+ --access-logfile - \
+ --bind 0.0.0.0:8080 \
+ --proxy-protocol \
+ --reload \
+ --reload-extra-file .env \
+ --reload-extra-file config.yaml \
+ --workers 2 \
+ --worker-class uvicorn.workers.UvicornWorker
+
+build:
+ $(docker) build \
+ --build-arg VERSION=$(version_full) \
+ --tag $(container_name):$(version_small) \
+ --tag $(container_name):latest \
+ .
deploy:
$(MAKE) deploy-bicep
- @echo "💤 Wait 10 secs for output to be available..."
- sleep 10
-
- @echo "🛠️ Deploying Function App..."
- func azure functionapp publish $(function_app_name) \
- --build local \
- --build-native-deps \
- --python
-
@echo "🚀 Call Center AI is running on $(app_url)"
@$(MAKE) deploy-post
@@ -134,12 +139,11 @@ deploy-bicep:
--location $(default_location) \
--parameters \
'cognitiveCommunicationLocation=$(cognitive_communication_location)' \
- 'functionappLocation=$(functionapp_location)' \
+ 'imageVersion=$(image_version)' \
'instance=$(name)' \
'openaiLocation=$(openai_location)' \
'promptContentFilter=$(prompt_content_filter)' \
'searchLocation=$(search_location)' \
- 'version=$(version_full)' \
--template-file bicep/main.bicep \
--name $(name_sanitized)
@@ -163,8 +167,12 @@ destroy:
az deployment sub delete --name $(name_sanitized)
logs:
- func azure functionapp logstream $(function_app_name) \
- --browser
+ az containerapp logs show \
+ --follow \
+ --format text \
+ --name call-center-ai \
+ --resource-group $(name) \
+ --tail 100
twilio-register:
@echo "⚙️ Registering Twilio webhook..."
@@ -175,6 +183,7 @@ copy-resources:
@echo "📦 Copying resources to Azure storage account..."
az storage blob upload-batch \
--account-name $(name_sanitized) \
+ --auth-mode login \
--destination '$$web' \
--no-progress \
--output none \
@@ -189,13 +198,6 @@ watch-call:
sleep 3; \
done
-sbom:
- @echo "🔍 Generating SBOM..."
- syft scan \
- --source-version $(version_full) \
- --output spdx-json=./sbom-reports/$(version_full).json \
- .
-
sync-local-config:
@echo "📥 Copying remote CONFIG_JSON to local config..."
az functionapp config appsettings list --name $(function_app_name) --resource-group $(name_sanitized) --query "[?name=='CONFIG_JSON'].value" --output tsv | yq --prettyPrint --output-format yaml > config.yaml
diff --git a/README.md b/README.md
index aa861cd..dc05cf6 100644
--- a/README.md
+++ b/README.md
@@ -281,6 +281,11 @@ Now that the prerequisites are configured (local + Azure), the deployment can be
### Remote (on Azure)
+A pre-built container image is available on GitHub Actions, it will be used to deploy the solution on Azure:
+
+- Latest version from a branch: `ghcr.io/clemlesne/call-center-ai:main`
+- Specific tag: `ghcr.io/clemlesne/call-center-ai:0.1.0` (recommended)
+
#### 1. Create the light config file
Local config file is named `config.yaml`. It will be used by install scripts (incl. Makefile and Bicep) to configure the Azure resources.
@@ -380,7 +385,6 @@ llm:
fast:
mode: azure_openai
azure_openai:
- api_key: xxx
context: 16385
deployment: gpt-4o-mini-2024-07-18
endpoint: https://xxx.openai.azure.com
@@ -389,7 +393,6 @@ llm:
slow:
mode: azure_openai
azure_openai:
- api_key: xxx
context: 128000
deployment: gpt-4o-2024-08-06
endpoint: https://xxx.openai.azure.com
@@ -615,7 +618,6 @@ llm:
fast:
mode: openai
openai:
- api_key: xxx
context: 128000
endpoint: https://api.openai.com
model: gpt-4o-mini
@@ -623,7 +625,6 @@ llm:
slow:
mode: openai
openai:
- api_key: xxx
context: 128000
endpoint: https://api.openai.com
model: gpt-4o
diff --git a/bicep/app.bicep b/bicep/app.bicep
index 87e1e32..b284ad6 100644
--- a/bicep/app.bicep
+++ b/bicep/app.bicep
@@ -3,7 +3,7 @@ param embeddingDeploymentType string
param embeddingModel string
param embeddingQuota int
param embeddingVersion string
-param functionappLocation string
+param imageVersion string
param llmFastContext int
param llmFastDeploymentType string
param llmFastModel string
@@ -19,12 +19,10 @@ param openaiLocation string
param promptContentFilter bool
param searchLocation string
param tags object
-param version string
var appName = 'call-center-ai'
var prefix = deployment().name
-var functionAppName = '${prefix}-${appName}'
-var appUrl = 'https://${functionAppName}.azurewebsites.net'
+var appUrl = 'https://call-center-ai.${acaEnv.properties.defaultDomain}'
var llmFastModelFullName = toLower('${llmFastModel}-${llmFastVersion}')
var llmSlowModelFullName = toLower('${llmSlowModel}-${llmSlowVersion}')
var embeddingModelFullName = toLower('${embeddingModel}-${embeddingVersion}')
@@ -36,7 +34,6 @@ var config = {
database: {
mode: 'cosmos_db'
cosmos_db: {
- access_key: cosmos.listKeys().primaryMasterKey
container: container.name
database: database.name
endpoint: cosmos.properties.documentEndpoint
@@ -55,14 +52,17 @@ var config = {
}
communication_services: {
access_key: communicationServices.listKeys().primaryKey
- call_queue_name: callQueue.name
endpoint: communicationServices.properties.hostName
phone_number: localConfig.communication_services.phone_number
- post_queue_name: postQueue.name
recording_container_url: '${storageAccount.properties.primaryEndpoints.blob}${recordingsBlob.name}'
resource_id: communicationServices.properties.immutableResourceId
- sms_queue_name: smsQueue.name
- trainings_queue_name: trainingsQueue.name
+ }
+ queue: {
+ account_url: storageAccount.properties.primaryEndpoints.queue
+ call_name: callQueue.name
+ post_name: postQueue.name
+ sms_name: smsQueue.name
+ training_name: trainingsQueue.name
}
sms: localConfig.sms
cognitive_service: {
@@ -72,7 +72,6 @@ var config = {
fast: {
mode: 'azure_openai'
azure_openai: {
- api_key: cognitiveOpenai.listKeys().key1
context: llmFastContext
deployment: llmFast.name
endpoint: cognitiveOpenai.properties.endpoint
@@ -83,7 +82,6 @@ var config = {
slow: {
mode: 'azure_openai'
azure_openai: {
- api_key: cognitiveOpenai.listKeys().key1
context: llmSlowContext
deployment: llmSlow.name
endpoint: cognitiveOpenai.properties.endpoint
@@ -93,7 +91,6 @@ var config = {
}
}
ai_search: {
- access_key: search.listAdminKeys().primaryKey
endpoint: 'https://${search.name}.search.windows.net'
index: 'trainings'
}
@@ -114,13 +111,12 @@ var config = {
}
}
app_configuration: {
- connection_string: configStore.listKeys().value[0].connectionString
+ endpoint: configStore.properties.endpoint
}
}
output appUrl string = appUrl
output blobStoragePublicName string = storageAccount.name
-output functionAppName string = functionAppName
output logAnalyticsCustomerId string = logAnalytics.properties.customerId
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
@@ -146,85 +142,123 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
}
}
-resource flexFuncPlan 'Microsoft.Web/serverfarms@2023-12-01' = {
+resource acaEnv 'Microsoft.App/managedEnvironments@2024-02-02-preview' = {
name: prefix
- location: functionappLocation
+ location: location
tags: tags
- sku: {
- tier: 'FlexConsumption'
- name: 'FC1'
- }
properties: {
- reserved: true
+ appLogsConfiguration: {
+ destination: 'log-analytics'
+ logAnalyticsConfiguration: {
+ customerId: logAnalytics.properties.customerId
+ sharedKey: logAnalytics.listKeys().primarySharedKey
+ }
+ }
+ workloadProfiles: [
+ {
+ name: 'Consumption'
+ workloadProfileType: 'Consumption'
+ }
+ ]
}
}
-resource functionApp 'Microsoft.Web/sites@2023-12-01' = {
- name: functionAppName
- location: functionappLocation
+var containerAppScaleRules = [
+ for queue in [
+ callQueue.name
+ postQueue.name
+ smsQueue.name
+ trainingsQueue.name
+ ]: {
+ name: 'queue-${queue}'
+ azureQueue: {
+ accountName: storageAccount.name
+ identity: 'system'
+ queueLength: 1
+ queueName: queue
+ }
+ }
+]
+
+resource containerApp 'Microsoft.App/containerApps@2024-02-02-preview' = {
+ name: appName
+ location: location
tags: tags
- kind: 'functionapp,linux'
identity: {
type: 'SystemAssigned'
}
properties: {
- serverFarmId: flexFuncPlan.id
- siteConfig: {
- appSettings: [
- // See: https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings#azurewebjobsstorage
- {
- name: 'AzureWebJobsStorage'
- value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${storageAccount.listKeys().keys[0].value};EndpointSuffix=${environment().suffixes.storage}'
- }
- // See: https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings#applicationinsights_connection_string
- {
- name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
- value: applicationInsights.properties.ConnectionString
- }
- // See: https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-configuration?tabs=python#enable-sampling
- {
- name: 'OTEL_TRACES_SAMPLER_ARG'
- value: '0.5'
- }
- {
- name: 'CONFIG_JSON'
- value: string(config)
- }
- {
- name: 'VERSION'
- value: version
- }
- ]
+ configuration: {
+ activeRevisionsMode: 'Single'
+ ingress: {
+ external: true
+ targetPort: 8080
+ }
}
- functionAppConfig: {
- deployment: {
- storage: {
- type: 'blobContainer'
- value: '${storageAccount.properties.primaryEndpoints.blob}${functionAppBlob.name}'
- authentication: {
- storageAccountConnectionStringName: 'AzureWebJobsStorage'
- type: 'StorageAccountConnectionString'
+ environmentId: acaEnv.id
+ template: {
+ containers: [
+ {
+ image: 'ghcr.io/microsoft/call-center-ai:${imageVersion}'
+ name: 'call-center-ai'
+ env: [
+ // App configuration
+ {
+ name: 'CONFIG_JSON'
+ value: string(config)
+ }
+ // Application Insights
+ {
+ name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
+ value: applicationInsights.properties.ConnectionString
+ }
+ ]
+ resources: {
+ cpu: 1
+ memory: '2Gi'
}
+ probes: [
+ {
+ type: 'Startup'
+ tcpSocket: {
+ port: 8080
+ }
+ }
+ {
+ type: 'Liveness'
+ httpGet: {
+ path: '/health/liveness'
+ port: 8080
+ }
+ periodSeconds: 10 // 2x the timeout
+ timeoutSeconds: 5 // Fast to check if the app is running
+ }
+ {
+ type: 'Readiness'
+ httpGet: {
+ path: '/health/readiness'
+ port: 8080
+ }
+ periodSeconds: 20 // 2x the timeout
+ timeoutSeconds: 10 // Database can take a while to be ready, query is necessary but expensive to run
+ }
+ ]
}
- }
- scaleAndConcurrency: {
- instanceMemoryMB: 2048 // Default and recommended
- maximumInstanceCount: 100 // TODO: Avoid billing surprises, delete when sure
- alwaysReady: [
+ ]
+ scale: {
+ minReplicas: 1
+ rules: concat(containerAppScaleRules, [
{
- instanceCount: 2
- name: 'http' // Handle "conversation" events
- }
- ]
- triggers: {
- http: {
- perInstanceConcurrency: 4
+ name: 'cpu-utilization'
+ custom: {
+ type: 'cpu'
+ metadata: {
+ type: 'Utilization'
+ value: '80'
+ }
+ }
}
- }
- }
- runtime: {
- name: 'python'
- version: '3.11'
+ ])
}
}
}
@@ -239,7 +273,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
}
kind: 'StorageV2'
properties: {
- allowSharedKeyAccess: true // In some companies policies enable this by default if not specified, we are not compatible, force disable
+ allowSharedKeyAccess: false
supportsHttpsTrafficOnly: true
}
}
@@ -284,11 +318,6 @@ resource recordingsBlob 'Microsoft.Storage/storageAccounts/blobServices/containe
name: 'recordings'
}
-resource functionAppBlob 'Microsoft.Storage/storageAccounts/blobServices/containers@2023-05-01' = {
- parent: blobService
- name: toLower(functionAppName)
-}
-
// Storage Blob Data Contributor
resource roleDataContributor 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
name: 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'
@@ -304,6 +333,21 @@ resource assignmentCommunicationServicesContributor 'Microsoft.Authorization/rol
}
}
+// Storage Queue Data Contributor
+resource roleQueueContributor 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
+ name: '974c5e8b-45b9-4653-ba55-5f855dd0fb88'
+}
+
+resource assignmentContainerAppQueueContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
+ name: guid(subscription().id, prefix, storageAccount.name, 'assignmentContainerAppQueueContributor')
+ scope: storageAccount
+ properties: {
+ principalId: containerApp.identity.principalId
+ principalType: 'ServicePrincipal'
+ roleDefinitionId: roleQueueContributor.id
+ }
+}
+
resource communicationServices 'Microsoft.Communication/CommunicationServices@2023-06-01-preview' existing = {
name: prefix
}
@@ -434,6 +478,21 @@ resource cognitiveCommunication 'Microsoft.CognitiveServices/accounts@2024-06-01
}
}
+// Cognitive Services OpenAI Contributor
+resource roleOpenaiContributor 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
+ name: 'a001fd3d-188f-4b5d-821b-7da978bf7442'
+}
+
+resource assignmentsContainerAppOpenaiContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
+ name: guid(subscription().id, prefix, cognitiveOpenai.name, 'assignmentsContainerAppOpenaiContributor')
+ scope: cognitiveOpenai
+ properties: {
+ principalId: containerApp.identity.principalId
+ principalType: 'ServicePrincipal'
+ roleDefinitionId: roleOpenaiContributor.id
+ }
+}
+
resource cognitiveOpenai 'Microsoft.CognitiveServices/accounts@2024-06-01-preview' = {
name: '${prefix}-${openaiLocation}-openai'
location: openaiLocation
@@ -622,7 +681,7 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
maxStalenessPrefix: 1000 // 1000 requests lags at max
}
databaseAccountOfferType: 'Standard'
- disableLocalAuth: false // In some companies policies enable this by default if not specified, we are not compatible, force disable
+ disableLocalAuth: true
locations: [
{
locationName: location
@@ -692,6 +751,22 @@ resource container 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/container
}
}
+// Cosmos DB Built-in Data Contributor
+resource sqlRoleDefinition 'Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions@2024-05-15' existing = {
+ parent: cosmos
+ name: '00000000-0000-0000-0000-000000000002'
+}
+
+resource assignmentContainerAppCosmosBuiltinDataContributor 'Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments@2024-05-15' = {
+ parent: cosmos
+ name: guid(cosmos.id, containerApp.id, sqlRoleDefinition.id)
+ properties: {
+ principalId: containerApp.identity.principalId
+ roleDefinitionId: sqlRoleDefinition.id
+ scope: cosmos.id
+ }
+}
+
resource search 'Microsoft.Search/searchServices@2024-06-01-preview' = {
name: prefix
location: searchLocation
@@ -703,10 +778,26 @@ resource search 'Microsoft.Search/searchServices@2024-06-01-preview' = {
type: 'SystemAssigned'
}
properties: {
+ disableLocalAuth: true
semanticSearch: 'standard'
}
}
+// Search Index Data Reader
+resource roleSearchDataReader 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
+ name: '1407120a-92aa-4202-b7e9-c0e197c71c8f'
+}
+
+resource assignmentSearchDataReader 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
+ name: guid(subscription().id, prefix, search.name, 'assignmentSearchDataReader')
+ scope: search
+ properties: {
+ principalId: containerApp.identity.principalId
+ principalType: 'ServicePrincipal'
+ roleDefinitionId: roleSearchDataReader.id
+ }
+}
+
resource translate 'Microsoft.CognitiveServices/accounts@2024-06-01-preview' = {
name: '${prefix}-${location}-translate'
location: location
@@ -743,6 +834,21 @@ resource configStore 'Microsoft.AppConfiguration/configurationStores@2023-03-01'
}
}
+// App Configuration Data Reader
+resource roleAppConfigurationDataReader 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
+ name: '516239f1-63e1-4d78-a4de-a74fb236a071'
+}
+
+resource assignmentAppConfigurationDataReader 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
+ name: guid(subscription().id, prefix, configStore.name, 'assignmentAppConfigurationDataReader')
+ scope: configStore
+ properties: {
+ principalId: containerApp.identity.principalId
+ principalType: 'ServicePrincipal'
+ roleDefinitionId: roleAppConfigurationDataReader.id
+ }
+}
+
resource configValues 'Microsoft.AppConfiguration/configurationStores/keyValues@2023-03-01' = [
for item in items({
answer_hard_timeout_sec: 180
diff --git a/bicep/main.bicep b/bicep/main.bicep
index f6c62d6..2b686b8 100644
--- a/bicep/main.bicep
+++ b/bicep/main.bicep
@@ -3,7 +3,7 @@ param embeddingDeploymentType string = 'Standard' // Pay-as-you-go in a single r
param embeddingModel string = 'text-embedding-ada-002'
param embeddingQuota int = 100
param embeddingVersion string = '2'
-param functionappLocation string
+param imageVersion string = 'main'
param instance string
param llmFastContext int = 128000
param llmFastDeploymentType string = 'GlobalStandard' // Pay-as-you-go in all regions
@@ -19,13 +19,11 @@ param location string = deployment().location
param openaiLocation string
param promptContentFilter bool = true // Should be set to false but requires a custom approval from Microsoft
param searchLocation string
-param version string
targetScope = 'subscription'
output appUrl string = app.outputs.appUrl
output blobStoragePublicName string = app.outputs.blobStoragePublicName
-output functionAppName string = app.outputs.functionAppName
output logAnalyticsCustomerId string = app.outputs.logAnalyticsCustomerId
var tags = {
@@ -33,7 +31,7 @@ var tags = {
instance: instance
managed_by: 'Bicep'
sources: 'https://github.com/clemlesne/call-center-ai'
- version: version
+ version: imageVersion
}
resource sub 'Microsoft.Resources/resourceGroups@2021-04-01' = {
@@ -51,7 +49,7 @@ module app 'app.bicep' = {
embeddingModel: embeddingModel
embeddingQuota: embeddingQuota
embeddingVersion: embeddingVersion
- functionappLocation: functionappLocation
+ imageVersion: imageVersion
llmFastContext: llmFastContext
llmFastDeploymentType: llmFastDeploymentType
llmFastModel: llmFastModel
@@ -67,6 +65,5 @@ module app 'app.bicep' = {
promptContentFilter: promptContentFilter
searchLocation: searchLocation
tags: tags
- version: version
}
}
diff --git a/helpers/call_events.py b/helpers/call_events.py
index 9844463..e26b956 100644
--- a/helpers/call_events.py
+++ b/helpers/call_events.py
@@ -91,7 +91,7 @@ async def on_call_connected(
client: CallAutomationClient,
post_callback: Callable[[CallStateModel], Awaitable[None]],
server_call_id: str,
- trainings_callback: Callable[[CallStateModel], Awaitable[None]],
+ training_callback: Callable[[CallStateModel], Awaitable[None]],
) -> None:
logger.info("Call connected, asking for language")
call.recognition_retry = 0 # Reset recognition retry counter
@@ -107,7 +107,7 @@ async def on_call_connected(
call=call,
client=client,
post_callback=post_callback,
- trainings_callback=trainings_callback,
+ training_callback=training_callback,
), # First, every time a call is answered, confirm the language
_db.call_aset(
call
@@ -140,7 +140,7 @@ async def on_speech_recognized(
client: CallAutomationClient,
post_callback: Callable[[CallStateModel], Awaitable[None]],
text: str,
- trainings_callback: Callable[[CallStateModel], Awaitable[None]],
+ training_callback: Callable[[CallStateModel], Awaitable[None]],
) -> None:
logger.info("Voice recognition: %s", text)
span_attribute(CallAttributes.CALL_CHANNEL, "voice")
@@ -161,7 +161,7 @@ async def on_speech_recognized(
call=call,
client=client,
post_callback=post_callback,
- trainings_callback=trainings_callback,
+ training_callback=training_callback,
), # Second, the LLM should be loaded to continue the conversation
_db.call_aset(
call
@@ -325,7 +325,7 @@ async def on_ivr_recognized(
client: CallAutomationClient,
label: str,
post_callback: Callable[[CallStateModel], Awaitable[None]],
- trainings_callback: Callable[[CallStateModel], Awaitable[None]],
+ training_callback: Callable[[CallStateModel], Awaitable[None]],
) -> None:
logger.info("IVR recognized: %s", label)
span_attribute(CallAttributes.CALL_CHANNEL, "ivr")
@@ -356,7 +356,7 @@ async def on_ivr_recognized(
call=call,
client=client,
post_callback=post_callback,
- trainings_callback=trainings_callback,
+ training_callback=training_callback,
), # Third, the LLM should be loaded to continue the conversation
) # All in parallel to lower the response latency
@@ -373,7 +373,7 @@ async def on_ivr_recognized(
call=call,
client=client,
post_callback=post_callback,
- trainings_callback=trainings_callback,
+ training_callback=training_callback,
), # Third, the LLM should be loaded to continue the conversation
)
@@ -406,7 +406,7 @@ async def on_sms_received(
client: CallAutomationClient,
message: str,
post_callback: Callable[[CallStateModel], Awaitable[None]],
- trainings_callback: Callable[[CallStateModel], Awaitable[None]],
+ training_callback: Callable[[CallStateModel], Awaitable[None]],
) -> bool:
logger.info("SMS received from %s: %s", call.initiate.phone_number, message)
span_attribute(CallAttributes.CALL_CHANNEL, "sms")
@@ -427,7 +427,7 @@ async def on_sms_received(
call=call,
client=client,
post_callback=post_callback,
- trainings_callback=trainings_callback,
+ training_callback=training_callback,
)
return True
@@ -586,7 +586,7 @@ async def _handle_ivr_language(
call: CallStateModel,
client: CallAutomationClient,
post_callback: Callable[[CallStateModel], Awaitable[None]],
- trainings_callback: Callable[[CallStateModel], Awaitable[None]],
+ training_callback: Callable[[CallStateModel], Awaitable[None]],
) -> None:
# If only one language is available, skip the IVR
if len(CONFIG.conversation.initiate.lang.availables) == 1:
@@ -597,7 +597,7 @@ async def _handle_ivr_language(
client=client,
label=short_code,
post_callback=post_callback,
- trainings_callback=trainings_callback,
+ training_callback=training_callback,
)
return
diff --git a/helpers/call_llm.py b/helpers/call_llm.py
index 4efd01b..6a8416a 100644
--- a/helpers/call_llm.py
+++ b/helpers/call_llm.py
@@ -42,7 +42,7 @@ async def load_llm_chat( # noqa: PLR0912, PLR0915
call: CallStateModel,
client: CallAutomationClient,
post_callback: Callable[[CallStateModel], Awaitable[None]],
- trainings_callback: Callable[[CallStateModel], Awaitable[None]],
+ training_callback: Callable[[CallStateModel], Awaitable[None]],
_iterations_remaining: int = 3,
) -> CallStateModel:
"""
@@ -146,7 +146,7 @@ async def load_llm_chat( # noqa: PLR0912, PLR0915
is_error, continue_chat, call = (
chat_task.result()
) # Store updated chat model
- await trainings_callback(call) # Trigger trainings generation
+ await training_callback(call) # Trigger trainings generation
await _db.call_aset(
call
) # Save ASAP in DB allowing (1) user to cut off the Assistant and (2) SMS answers to be in order
@@ -206,7 +206,7 @@ async def load_llm_chat( # noqa: PLR0912, PLR0915
call=call,
client=client,
post_callback=post_callback,
- trainings_callback=trainings_callback,
+ training_callback=training_callback,
_iterations_remaining=_iterations_remaining - 1,
)
else:
@@ -216,7 +216,7 @@ async def load_llm_chat( # noqa: PLR0912, PLR0915
call=call,
client=client,
post_callback=post_callback,
- trainings_callback=trainings_callback,
+ training_callback=training_callback,
_iterations_remaining=_iterations_remaining - 1,
) # Recursive chat (like for for retry or tools)
diff --git a/helpers/config_models/ai_search.py b/helpers/config_models/ai_search.py
index 6825091..8eaca36 100644
--- a/helpers/config_models/ai_search.py
+++ b/helpers/config_models/ai_search.py
@@ -1,12 +1,11 @@
from functools import cache
-from pydantic import BaseModel, Field, SecretStr
+from pydantic import BaseModel, Field
from persistence.isearch import ISearch
class AiSearchModel(BaseModel, frozen=True):
- access_key: SecretStr
endpoint: str
expansion_n_messages: int = Field(default=10, ge=1)
index: str
diff --git a/helpers/config_models/app_configuration.py b/helpers/config_models/app_configuration.py
index 75b9ae3..ffd8a0b 100644
--- a/helpers/config_models/app_configuration.py
+++ b/helpers/config_models/app_configuration.py
@@ -1,6 +1,6 @@
-from pydantic import BaseModel, SecretStr
+from pydantic import BaseModel
class AppConfigurationModel(BaseModel):
- connection_string: SecretStr
+ endpoint: str
ttl_sec: int = 60 # 1 min
diff --git a/helpers/config_models/communication_services.py b/helpers/config_models/communication_services.py
index dab4579..2298ea1 100644
--- a/helpers/config_models/communication_services.py
+++ b/helpers/config_models/communication_services.py
@@ -5,11 +5,7 @@ from helpers.pydantic_types.phone_numbers import PhoneNumber
class CommunicationServicesModel(BaseModel):
access_key: SecretStr
- call_queue_name: str
endpoint: str
phone_number: PhoneNumber
- post_queue_name: str
recording_container_url: str
resource_id: str
- sms_queue_name: str
- trainings_queue_name: str
diff --git a/helpers/config_models/database.py b/helpers/config_models/database.py
index 0be2adf..597004e 100644
--- a/helpers/config_models/database.py
+++ b/helpers/config_models/database.py
@@ -1,7 +1,7 @@
from enum import Enum
from functools import cache
-from pydantic import BaseModel, SecretStr, ValidationInfo, field_validator
+from pydantic import BaseModel, ValidationInfo, field_validator
from persistence.istore import IStore
@@ -12,7 +12,6 @@ class ModeEnum(str, Enum):
class CosmosDbModel(BaseModel, frozen=True):
- access_key: SecretStr
container: str
database: str
endpoint: str
diff --git a/helpers/config_models/llm.py b/helpers/config_models/llm.py
index fc5c544..1e5bbe7 100644
--- a/helpers/config_models/llm.py
+++ b/helpers/config_models/llm.py
@@ -1,9 +1,12 @@
+from abc import abstractmethod
from enum import Enum
from typing import Any
from openai import AsyncAzureOpenAI, AsyncOpenAI
from pydantic import BaseModel, Field, SecretStr, ValidationInfo, field_validator
+from helpers.identity import token
+
class ModeEnum(str, Enum):
AZURE_OPENAI = "azure_openai"
@@ -20,14 +23,19 @@ class AbstractPlatformModel(BaseModel):
model: str
streaming: bool
+ @abstractmethod
+ async def instance(
+ self,
+ ) -> tuple[AsyncAzureOpenAI | AsyncOpenAI, "AbstractPlatformModel"]:
+ pass
+
class AzureOpenaiPlatformModel(AbstractPlatformModel):
_client: AsyncAzureOpenAI | None = None
- api_key: SecretStr
deployment: str
endpoint: str
- def instance(self) -> tuple[AsyncAzureOpenAI, AbstractPlatformModel]:
+ async def instance(self) -> tuple[AsyncAzureOpenAI, AbstractPlatformModel]:
if not self._client:
self._client = AsyncAzureOpenAI(
**self._client_kwargs,
@@ -36,7 +44,9 @@ class AzureOpenaiPlatformModel(AbstractPlatformModel):
azure_deployment=self.deployment,
azure_endpoint=self.endpoint,
# Authentication
- api_key=self.api_key.get_secret_value(),
+ azure_ad_token_provider=await token(
+ "https://cognitiveservices.azure.com/.default"
+ ),
)
return self._client, self
@@ -46,7 +56,7 @@ class OpenaiPlatformModel(AbstractPlatformModel):
api_key: SecretStr
endpoint: str
- def instance(self) -> tuple[AsyncOpenAI, AbstractPlatformModel]:
+ async def instance(self) -> tuple[AsyncOpenAI, AbstractPlatformModel]:
if not self._client:
self._client = AsyncOpenAI(
**self._client_kwargs,
diff --git a/helpers/config_models/queue.py b/helpers/config_models/queue.py
new file mode 100644
index 0000000..778f6e6
--- /dev/null
+++ b/helpers/config_models/queue.py
@@ -0,0 +1,47 @@
+from functools import cache
+
+from pydantic import BaseModel
+
+
+class QueueModel(BaseModel, frozen=True):
+ account_url: str
+ call_name: str
+ post_name: str
+ sms_name: str
+ training_name: str
+
+ @cache
+ def call(self):
+ from persistence.azure_queue_storage import AzureQueueStorage
+
+ return AzureQueueStorage(
+ account_url=self.account_url,
+ name=self.call_name,
+ )
+
+ @cache
+ def post(self):
+ from persistence.azure_queue_storage import AzureQueueStorage
+
+ return AzureQueueStorage(
+ account_url=self.account_url,
+ name=self.post_name,
+ )
+
+ @cache
+ def sms(self):
+ from persistence.azure_queue_storage import AzureQueueStorage
+
+ return AzureQueueStorage(
+ account_url=self.account_url,
+ name=self.sms_name,
+ )
+
+ @cache
+ def training(self):
+ from persistence.azure_queue_storage import AzureQueueStorage
+
+ return AzureQueueStorage(
+ account_url=self.account_url,
+ name=self.training_name,
+ )
diff --git a/helpers/config_models/root.py b/helpers/config_models/root.py
index 9be326a..8567453 100644
--- a/helpers/config_models/root.py
+++ b/helpers/config_models/root.py
@@ -16,6 +16,7 @@ from helpers.config_models.database import DatabaseModel
from helpers.config_models.llm import LlmModel
from helpers.config_models.monitoring import MonitoringModel
from helpers.config_models.prompts import PromptsModel
+from helpers.config_models.queue import QueueModel
from helpers.config_models.resources import ResourcesModel
from helpers.config_models.sms import SmsModel
@@ -51,6 +52,7 @@ class RootModel(BaseSettings):
serialization_alias="workflow"
) # Compatibility with v7
app_configuration: AppConfigurationModel
+ queue: QueueModel
@classmethod
def settings_customise_sources(
diff --git a/helpers/features.py b/helpers/features.py
index 95b702b..8e326ba 100644
--- a/helpers/features.py
+++ b/helpers/features.py
@@ -1,6 +1,7 @@
from typing import TypeVar, cast
from azure.appconfiguration.aio import AzureAppConfigurationClient
+from helpers.identity import credential
from helpers.config import CONFIG
from helpers.config_models.cache import MemoryModel
@@ -14,39 +15,39 @@ T = TypeVar("T", bool, int, str)
async def answer_hard_timeout_sec() -> int:
- return await _get(key="answer_hard_timeout_sec", type=int) or 180
+ return await _get(key="answer_hard_timeout_sec", type_res=int) or 180
async def answer_soft_timeout_sec() -> int:
- return await _get(key="answer_soft_timeout_sec", type=int) or 120
+ return await _get(key="answer_soft_timeout_sec", type_res=int) or 120
async def callback_timeout_hour() -> int:
- return await _get(key="callback_timeout_hour", type=int) or 24
+ return await _get(key="callback_timeout_hour", type_res=int) or 24
async def phone_silence_timeout_sec() -> int:
- return await _get(key="phone_silence_timeout_sec", type=int) or 10
+ return await _get(key="phone_silence_timeout_sec", type_res=int) or 10
async def recording_enabled() -> bool:
- return await _get(key="recording_enabled", type=bool) or False
+ return await _get(key="recording_enabled", type_res=bool) or False
async def slow_llm_for_chat() -> bool:
- return await _get(key="slow_llm_for_chat", type=bool) or True
+ return await _get(key="slow_llm_for_chat", type_res=bool) or True
async def voice_recognition_retry_max() -> int:
- return await _get(key="voice_recognition_retry_max", type=int) or 3
+ return await _get(key="voice_recognition_retry_max", type_res=int) or 3
-async def _get(key: str, type: type[T]) -> T | None:
+async def _get(key: str, type_res: type[T]) -> T | None:
# Try cache
cache_key = _cache_key(key)
cached = await _cache.aget(cache_key)
if cached:
- return _parse(value=cached.decode(), type=type)
+ return _parse(value=cached.decode(), type_res=type_res)
# Try live
async with await _use_client() as client:
setting = await client.get_configuration_setting(key)
@@ -60,7 +61,7 @@ async def _get(key: str, type: type[T]) -> T | None:
value=setting.value,
)
# Return
- return _parse(value=setting.value, type=type)
+ return _parse(value=setting.value, type_res=type_res)
async def _use_client() -> AzureAppConfigurationClient:
@@ -69,11 +70,13 @@ async def _use_client() -> AzureAppConfigurationClient:
"""
global _client # noqa: PLW0603
if not _client:
- _client = AzureAppConfigurationClient.from_connection_string(
+ _client = AzureAppConfigurationClient(
# Performance
transport=await azure_transport(),
+ # Deployment
+ base_url=CONFIG.app_configuration.endpoint,
# Authentication
- connection_string=CONFIG.app_configuration.connection_string.get_secret_value(),
+ credential=await credential(),
)
return _client
@@ -82,11 +85,11 @@ def _cache_key(key: str) -> str:
return f"{__name__}-{key}"
-def _parse(value: str, type: type[T]) -> T:
- if type is bool:
+def _parse(value: str, type_res: type[T]) -> T:
+ if type_res is bool:
return cast(T, value.lower() == "true")
- if type is int:
+ if type_res is int:
return cast(T, int(value))
- if type is str:
+ if type_res is str:
return cast(T, str(value))
- raise ValueError(f"Unsupported type: {type}")
+ raise ValueError(f"Unsupported type: {type_res}")
diff --git a/helpers/identity.py b/helpers/identity.py
new file mode 100644
index 0000000..ecd3d58
--- /dev/null
+++ b/helpers/identity.py
@@ -0,0 +1,21 @@
+from collections.abc import Awaitable, Callable
+
+from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider
+
+from helpers.http import azure_transport
+
+_client: DefaultAzureCredential | None = None
+
+
+async def credential() -> DefaultAzureCredential:
+ global _client
+ if not _client:
+ _client = DefaultAzureCredential(
+ # Performance
+ transport=await azure_transport(),
+ )
+ return _client
+
+
+async def token(service: str) -> Callable[[], Awaitable[str]]:
+ return get_bearer_token_provider(await credential(), service)
diff --git a/helpers/llm_worker.py b/helpers/llm_worker.py
index 5b8269f..6dfa2fe 100644
--- a/helpers/llm_worker.py
+++ b/helpers/llm_worker.py
@@ -148,7 +148,7 @@ async def _completion_stream_worker( # noqa: PLR0912
"""
Returns a stream of completions.
"""
- client, platform = _use_llm(is_fast)
+ client, platform = await _use_llm(is_fast)
extra = {}
if tools:
extra["tools"] = tools # Add tools if any
@@ -313,7 +313,7 @@ async def _completion_sync_worker(
"""
Returns a completion.
"""
- client, platform = _use_llm(is_fast)
+ client, platform = await _use_llm(is_fast)
extra = {}
if json_output:
extra["response_format"] = {"type": "json_object"}
@@ -437,7 +437,7 @@ def _count_tokens(content: str, model: str) -> int:
return len(tiktoken.get_encoding(encoding_name).encode(content))
-def _use_llm(
+async def _use_llm(
is_fast: bool,
) -> tuple[AsyncAzureOpenAI | AsyncOpenAI, LlmAbstractPlatformModel]:
"""
@@ -445,4 +445,4 @@ def _use_llm(
The client is either an Azure OpenAI or an OpenAI client, depending on the configuration.
"""
- return CONFIG.llm.selected(is_fast).instance()
+ return await CONFIG.llm.selected(is_fast).instance()
diff --git a/host.json b/host.json
deleted file mode 100644
index 7f429b1..0000000
--- a/host.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "version": "2.0",
- "extensionBundle": {
- "id": "Microsoft.Azure.Functions.ExtensionBundle",
- "version": "[4.*, 5.0.0)"
- },
- "functionTimeout": "00:03:00",
- "logging": {
- "logLevel": {
- "default": "Warning",
- "Function": "Information"
- },
- "applicationInsights": {
- "samplingSettings": {
- "isEnabled": true,
- "excludedTypes": "Request"
- },
- "enableLiveMetricsFilters": true
- }
- },
- "telemetryMode": "openTelemetry",
- "extensions": {
- "http": {
- "routePrefix": ""
- },
- "queues": {
- "batchSize": 32,
- "maxDequeueCount": 4,
- "maxPollingInterval": "00:00:00.250",
- "visibilityTimeout": "00:00:01"
- }
- },
- "watchFiles": [
- "config.yaml",
- ".env"
- ]
-}
diff --git a/local.example.settings.json b/local.example.settings.json
deleted file mode 100644
index d41304d..0000000
--- a/local.example.settings.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "IsEncrypted": false,
- "Values": {
- "APPLICATIONINSIGHTS_CONNECTION_STRING": "InstrumentationKey=xxx;IngestionEndpoint=xxx;LiveEndpoint=xxx",
- "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=xxx;EndpointSuffix=core.windows.net",
- "FUNCTIONS_WORKER_RUNTIME": "python"
- },
- "Host": {
- "CORS": "*",
- "CORSCredentials": false,
- "LocalHttpPort": 8080
- },
- "ConnectionStrings": {}
-}
diff --git a/function_app.py b/main.py
similarity index 68%
rename from function_app.py
rename to main.py
index 20f88bf..9cc3430 100644
--- a/function_app.py
+++ b/main.py
@@ -1,12 +1,13 @@
import asyncio
import json
+from contextlib import asynccontextmanager
from datetime import timedelta
from http import HTTPStatus
from os import getenv
+from typing import Annotated
from urllib.parse import quote_plus, urljoin
from uuid import UUID
-import azure.functions as func
import jwt
import mistune
from azure.communication.callautomation import PhoneNumberIdentifier
@@ -14,9 +15,17 @@ from azure.communication.callautomation.aio import CallAutomationClient
from azure.core.credentials import AzureKeyCredential
from azure.core.messaging import CloudEvent
from azure.eventgrid import EventGridEvent, SystemEventNames
+from fastapi import (
+ FastAPI,
+ Form,
+ HTTPException,
+ Request,
+ Response,
+)
+from fastapi.responses import HTMLResponse, JSONResponse
from htmlmin.minify import html_minify
from jinja2 import Environment, FileSystemLoader
-from pydantic import TypeAdapter, ValidationError
+from pydantic import Field, TypeAdapter, ValidationError
from twilio.twiml.messaging_response import MessagingResponse
from helpers.call_events import (
@@ -40,15 +49,16 @@ from helpers.http import azure_transport
from helpers.logging import logger
from helpers.monitoring import CallAttributes, span_attribute, tracer
from helpers.pydantic_types.phone_numbers import PhoneNumber
-from helpers.resources import resources_dir
from models.call import CallGetModel, CallInitiateModel, CallStateModel
+from models.error import ErrorInnerModel, ErrorModel
from models.next import ActionEnum as NextActionEnum
from models.readiness import ReadinessCheckModel, ReadinessEnum, ReadinessModel
+from persistence.azure_queue_storage import Message as AzureQueueStorageMessage
+# First log
logger.info(
- "call-center-ai v%s (Azure Functions v%s)",
+ "call-center-ai v%s",
CONFIG.version,
- getattr(func, "__version__"),
)
# Jinja configuration
@@ -75,12 +85,13 @@ _communication_services_jwks_client = jwt.PyJWKClient(
# Persistences
_cache = CONFIG.cache.instance()
+_call_queue = CONFIG.queue.call()
_db = CONFIG.database.instance()
+_post_queue = CONFIG.queue.post()
_search = CONFIG.ai_search.instance()
_sms = CONFIG.sms.instance()
-
-# Azure Functions
-app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)
+_sms_queue = CONFIG.queue.sms()
+_training_queue = CONFIG.queue.training()
# Communication Services callback
assert CONFIG.public_domain, "public_domain config is not set"
@@ -91,48 +102,58 @@ _COMMUNICATIONSERVICES_CALLABACK_TPL = urljoin(
logger.info("Using call event URL %s", _COMMUNICATIONSERVICES_CALLABACK_TPL)
- "openapi.json",
- methods=["GET"],
-)
[email protected]_as_current_span("openapi_get")
-async def openapi_get(
- req: func.HttpRequest, # noqa: ARG001
-) -> func.HttpResponse:
- """
- Generate the OpenAPI specification for the API.
-
- No parameters are expected.
-
- Returns a JSON object with the OpenAPI specification.
- """
- with open( # noqa: ASYNC230
- encoding="utf-8",
- file=resources_dir("openapi.json"),
- ) as f:
- openapi = json.load(f)
- openapi["info"]["version"] = CONFIG.version
- openapi["servers"] = [
- {
- "description": "Public endpoint",
- "url": str(CONFIG.public_domain),
- }
- ]
- return func.HttpResponse(
- body=json.dumps(openapi),
- mimetype="application/json",
- status_code=HTTPStatus.OK,
+@asynccontextmanager
+async def lifespan(app: FastAPI):
+ call_task = asyncio.create_task(
+ _call_queue.trigger(
+ arg="call",
+ func=call_event,
+ )
+ )
+ post_task = asyncio.create_task(
+ _post_queue.trigger(
+ arg="post",
+ func=post_event,
+ )
+ )
+ sms_task = asyncio.create_task(
+ _sms_queue.trigger(
+ arg="sms",
+ func=sms_event,
+ )
+ )
+ training_task = asyncio.create_task(
+ _training_queue.trigger(
+ arg="training",
+ func=training_event,
)
+ )
+ yield
+ call_task.cancel()
+ post_task.cancel()
+ sms_task.cancel()
+ training_task.cancel()
+
+
+# FastAPI
+api = FastAPI(
+ contact={
+ "url": "https://github.com/microsoft/call-center-ai",
+ },
+ description="Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!",
+ license_info={
+ "name": "Apache-2.0",
+ "url": "https://github.com/microsoft/call-center-ai/blob/master/LICENSE",
+ },
+ lifespan=lifespan,
+ title="call-center-ai",
+ version=CONFIG.version,
+)
- "health/liveness",
- methods=["GET"],
-)
[email protected]("/health/liveness")
@tracer.start_as_current_span("health_liveness_get")
-async def health_liveness_get(
- req: func.HttpRequest, # noqa: ARG001
-) -> func.HttpResponse:
+async def health_liveness_get() -> None:
"""
Check if the service is running.
@@ -140,17 +161,15 @@ async def health_liveness_get(
Returns a 200 OK if the service is technically running.
"""
- return func.HttpResponse(status_code=HTTPStatus.NO_CONTENT)
+ return
- "health/readiness",
- methods=["GET"],
+ "/health/readiness",
+ status_code=HTTPStatus.OK,
)
@tracer.start_as_current_span("health_readiness_get")
-async def health_readiness_get(
- req: func.HttpRequest, # noqa: ARG001
-) -> func.HttpResponse:
+async def health_readiness_get() -> JSONResponse:
"""
Check if the service is ready to serve requests.
@@ -187,20 +206,18 @@ async def health_readiness_get(
readiness.status = ReadinessEnum.FAIL
status_code = HTTPStatus.SERVICE_UNAVAILABLE
break
- return func.HttpResponse(
- body=readiness.model_dump_json(),
- mimetype="application/json",
+ return JSONResponse(
+ content=readiness.model_dump_json(),
status_code=status_code,
)
- "report",
- methods=["GET"],
- trigger_arg_name="req",
+ "/report",
+ response_class=HTMLResponse,
)
@tracer.start_as_current_span("report_get")
-async def report_get(req: func.HttpRequest) -> func.HttpResponse:
+async def report_get(phone_number: str | None = None) -> HTMLResponse:
"""
List all calls with a web interface.
@@ -210,21 +227,18 @@ async def report_get(req: func.HttpRequest) -> func.HttpResponse:
Returns a list of calls with a web interface.
"""
try:
- phone_number = (
- PhoneNumber(req.params["phone_number"])
- if "phone_number" in req.params
- else None
- )
+ phone_number = PhoneNumber(phone_number) if phone_number else None
except ValueError as e:
- return _validation_error(e)
+ return HTMLResponse(
+ content=f"Invalid phone number: {e}",
+ status_code=HTTPStatus.BAD_REQUEST,
+ )
+
count = 100
calls, total = (
- await _db.call_asearch_all(
- count=count,
- phone_number=phone_number or None,
- )
- or []
+ await _db.call_asearch_all(count=count, phone_number=phone_number) or []
)
+
template = _jinja.get_template("list.html.jinja")
render = await template.render_async(
applicationinsights_connection_string=getenv(
@@ -238,20 +252,18 @@ async def report_get(req: func.HttpRequest) -> func.HttpResponse:
version=CONFIG.version,
)
render = html_minify(render) # Minify HTML
- return func.HttpResponse(
- body=render,
- mimetype="text/html",
+ return HTMLResponse(
+ content=render,
status_code=HTTPStatus.OK,
)
- "report/{call_id:guid}",
- methods=["GET"],
- trigger_arg_name="req",
+ "/report/{call_id}",
+ response_class=HTMLResponse,
)
@tracer.start_as_current_span("report_single_get")
-async def report_single_get(req: func.HttpRequest) -> func.HttpResponse:
+async def report_single_get(call_id: UUID) -> HTMLResponse:
"""
Show a single call with a web interface.
@@ -259,16 +271,13 @@ async def report_single_get(req: func.HttpRequest) -> func.HttpResponse:
Returns a single call with a web interface.
"""
- try:
- call_id = UUID(req.route_params["call_id"])
- except ValueError as e:
- return _validation_error(e)
call = await _db.call_aget(call_id)
if not call:
- return _standard_error(
- message=f"Call {call_id} not found",
+ return HTMLResponse(
+ content=f"Call {call_id} not found",
status_code=HTTPStatus.NOT_FOUND,
)
+
template = _jinja.get_template("single.html.jinja")
render = await template.render_async(
applicationinsights_connection_string=getenv(
@@ -282,21 +291,14 @@ async def report_single_get(req: func.HttpRequest) -> func.HttpResponse:
version=CONFIG.version,
)
render = html_minify(render) # Minify HTML
- return func.HttpResponse(
- body=render,
- mimetype="text/html",
- status_code=HTTPStatus.OK,
- )
+ return HTMLResponse(content=render, status_code=HTTPStatus.OK)
-# TODO: Add total (int) and calls (list) as a wrapper for the list of calls
- "call",
- methods=["GET"],
- trigger_arg_name="req",
-)
@tracer.start_as_current_span("call_list_get")
-async def call_list_get(req: func.HttpRequest) -> func.HttpResponse:
+async def call_list_get(
+ phone_number: str | None = None,
+) -> list[CallGetModel] | ErrorModel:
"""
REST API to list all calls.
@@ -306,13 +308,10 @@ async def call_list_get(req: func.HttpRequest) -> func.HttpResponse:
Returns a list of calls objects `CallGetModel`, for a phone number, in JSON format.
"""
try:
- phone_number = (
- PhoneNumber(req.params["phone_number"])
- if "phone_number" in req.params
- else None
- )
+ phone_number = PhoneNumber(phone_number) if phone_number else None
except ValueError as e:
return _validation_error(e)
+
count = 100
calls, _ = await _db.call_asearch_all(phone_number=phone_number, count=count)
if not calls:
@@ -320,21 +319,14 @@ async def call_list_get(req: func.HttpRequest) -> func.HttpResponse:
message=f"Calls {phone_number} not found",
status_code=HTTPStatus.NOT_FOUND,
)
+
output = [CallGetModel.model_validate(call) for call in calls or []]
- return func.HttpResponse(
- body=TypeAdapter(list[CallGetModel]).dump_json(output),
- mimetype="application/json",
- status_code=HTTPStatus.OK,
- )
+ return TypeAdapter(list[CallGetModel]).dump_python(output)
- "call/{phone_number}",
- methods=["GET"],
- trigger_arg_name="req",
-)
[email protected]("/call/{phone_number}")
@tracer.start_as_current_span("call_phone_number_get")
-async def call_phone_number_get(req: func.HttpRequest) -> func.HttpResponse:
+async def call_phone_number_get(phone_number: str) -> CallGetModel | ErrorModel:
"""
REST API to search for calls by phone number.
@@ -344,30 +336,24 @@ async def call_phone_number_get(req: func.HttpRequest) -> func.HttpResponse:
Returns a single call object `CallGetModel`, in JSON format.
"""
try:
- phone_number = PhoneNumber(req.route_params["phone_number"])
+ phone_number = PhoneNumber(phone_number)
except ValueError as e:
return _validation_error(e)
+
call = await _db.call_asearch_one(phone_number=phone_number)
if not call:
return _standard_error(
- message=f"Call {phone_number} not found",
+ message=f"Calls {phone_number} not found",
status_code=HTTPStatus.NOT_FOUND,
)
- return func.HttpResponse(
- body=TypeAdapter(CallGetModel).dump_json(call),
- mimetype="application/json",
- status_code=HTTPStatus.OK,
- )
+ return TypeAdapter(CallGetModel).dump_python(call)
- "call/{call_id:guid}",
- methods=["GET"],
- trigger_arg_name="req",
-)
+
[email protected]("/call/{call_id}")
@tracer.start_as_current_span("call_id_get")
-async def call_id_get(req: func.HttpRequest) -> func.HttpResponse:
- """ "
+async def call_id_get(call_id: UUID) -> CallGetModel | ErrorModel:
+ """
REST API to get a single call by call ID.
Parameters:
@@ -375,30 +361,21 @@ async def call_id_get(req: func.HttpRequest) -> func.HttpResponse:
Returns a single call object `CallGetModel`, in JSON format.
"""
- try:
- call_id = UUID(req.route_params["call_id"])
- except ValueError as e:
- return _validation_error(e)
call = await _db.call_aget(call_id)
if not call:
return _standard_error(
- message=f"Call {call_id} not found",
+ message=f"Calls {call_id} not found",
status_code=HTTPStatus.NOT_FOUND,
)
- return func.HttpResponse(
- body=TypeAdapter(CallGetModel).dump_json(call),
- mimetype="application/json",
- status_code=HTTPStatus.OK,
- )
+ return TypeAdapter(CallGetModel).dump_python(call)
- "call",
- methods=["POST"],
- trigger_arg_name="req",
+ "/call",
+ status_code=HTTPStatus.CREATED,
)
@tracer.start_as_current_span("call_post")
-async def call_post(req: func.HttpRequest) -> func.HttpResponse:
+async def call_post(request: Request) -> CallGetModel | ErrorModel:
"""
REST API to initiate a call.
@@ -407,9 +384,11 @@ async def call_post(req: func.HttpRequest) -> func.HttpResponse:
Returns a single call object `CallGetModel`, in JSON format.
"""
try:
- initiate = CallInitiateModel.model_validate_json(req.get_body())
+ body = await request.json()
+ initiate = CallInitiateModel.model_validate(body)
except ValidationError as e:
return _validation_error(e)
+
url, call = await _communicationservices_event_url(initiate.phone_number, initiate)
span_attribute(CallAttributes.CALL_ID, str(call.call_id))
span_attribute(CallAttributes.CALL_PHONE_NUMBER, call.initiate.phone_number)
@@ -418,28 +397,18 @@ async def call_post(req: func.HttpRequest) -> func.HttpResponse:
callback_url=url,
cognitive_services_endpoint=CONFIG.cognitive_service.endpoint,
source_caller_id_number=_source_caller,
- # deepcode ignore AttributeLoadOnNone: Phone number is validated with Pydantic
target_participant=PhoneNumberIdentifier(initiate.phone_number), # pyright: ignore
)
logger.info(
"Created call with connection id: %s",
call_connection_properties.call_connection_id,
)
- return func.HttpResponse(
- body=TypeAdapter(CallGetModel).dump_json(call),
- mimetype="application/json",
- status_code=HTTPStatus.CREATED,
- )
+ return TypeAdapter(CallGetModel).dump_python(call)
- arg_name="call",
- connection="Storage",
- queue_name=CONFIG.communication_services.call_queue_name,
-)
@tracer.start_as_current_span("call_event")
async def call_event(
- call: func.QueueMessage,
+ call: AzureQueueStorageMessage,
) -> None:
"""
Handle incoming call event from Azure Communication Services.
@@ -448,7 +417,7 @@ async def call_event(
Queue message is a JSON object `EventGridEvent` with an event type of `AcsIncomingCallEventName`.
"""
- event = EventGridEvent.from_json(call.get_body())
+ event = EventGridEvent.from_json(call.content)
event_type = event.event_type
logger.debug("Call event with data %s", event.data)
@@ -469,35 +438,18 @@ async def call_event(
)
- arg_name="sms",
- connection="Storage",
- queue_name=CONFIG.communication_services.sms_queue_name,
-)
- arg_name="trainings",
- connection="Storage",
- queue_name=CONFIG.communication_services.trainings_queue_name,
-)
- arg_name="post",
- connection="Storage",
- queue_name=CONFIG.communication_services.post_queue_name,
-)
@tracer.start_as_current_span("sms_event")
async def sms_event(
- post: func.Out[str],
- sms: func.QueueMessage,
- trainings: func.Out[str],
+ sms: AzureQueueStorageMessage,
) -> None:
"""
Handle incoming SMS event from Azure Communication Services.
The event will trigger the workflow to handle a new SMS message.
- Returns None. Can trigger additional events to `trainings` and `post` queues.
+ Returns None. Can trigger additional events to `training` and `post` queues.
"""
- event = EventGridEvent.from_json(sms.get_body())
+ event = EventGridEvent.from_json(sms.content)
event_type = event.event_type
logger.debug("SMS event with data %s", event.data)
@@ -515,55 +467,42 @@ async def sms_event(
span_attribute(CallAttributes.CALL_ID, str(call.call_id))
async def _post_callback(_call: CallStateModel) -> None:
- _trigger_post_event(call=_call, post=post)
+ await _trigger_post_event(_call)
- async def _trainings_callback(_call: CallStateModel) -> None:
- _trigger_trainings_event(call=_call, trainings=trainings)
+ async def _training_callback(_call: CallStateModel) -> None:
+ await _trigger_training_event(_call)
await on_sms_received(
call=call,
client=await _use_automation_client(),
message=message,
post_callback=_post_callback,
- trainings_callback=_trainings_callback,
+ training_callback=_training_callback,
)
- "communicationservices/event/{call_id:guid}/{secret:length(16)}",
- methods=["POST"],
- trigger_arg_name="req",
-)
- arg_name="trainings",
- connection="Storage",
- queue_name=CONFIG.communication_services.trainings_queue_name,
-)
- arg_name="post",
- connection="Storage",
- queue_name=CONFIG.communication_services.post_queue_name,
-)
[email protected]("/communicationservices/event/{call_id}/{secret}")
@tracer.start_as_current_span("communicationservices_event_post")
async def communicationservices_event_post(
- post: func.Out[str],
- req: func.HttpRequest,
- trainings: func.Out[str],
-) -> func.HttpResponse:
+ call_id: UUID,
+ secret: Annotated[str, Field(min_length=16, max_length=16)],
+ request: Request,
+) -> None | ErrorModel:
"""
Handle direct events from Azure Communication Services for a running call.
No parameters are expected. The body is a list of JSON objects `CloudEvent`.
- Returns a 204 No Content if the events are properly fomatted. A 401 Unauthorized if the JWT token is invalid. Otherwise, returns a 400 Bad Request.
+ Returns a 204 No Content if the events are properly formatted. A 401 Unauthorized if the JWT token is invalid. Otherwise, returns a 400 Bad Request.
"""
# Validate JWT token
- service_jwt: str | None = req.headers.get("Authorization")
+ service_jwt: str | None = request.headers.get("Authorization")
if not service_jwt:
return _standard_error(
message="Authorization header missing",
status_code=HTTPStatus.UNAUTHORIZED,
)
+
service_jwt = str(service_jwt).replace("Bearer ", "")
try:
jwt.decode(
@@ -580,23 +519,24 @@ async def communicationservices_event_post(
)
except jwt.PyJWTError:
logger.warning("Invalid JWT token", exc_info=True)
- return _standard_error(
- message="Invalid JWT token",
+ raise HTTPException(
status_code=HTTPStatus.UNAUTHORIZED,
+ detail="Invalid JWT token",
)
# Validate request
try:
- call_id = UUID(req.route_params["call_id"])
- secret: str = req.route_params["secret"]
- except ValueError as e:
- return _validation_error(e)
- try:
- events = req.get_json()
+ events = await request.json()
except ValueError:
- return _validation_error(Exception("Invalid JSON format"))
+ return _standard_error(
+ message="Invalid JSON format",
+ status_code=HTTPStatus.BAD_REQUEST,
+ )
if not events or not isinstance(events, list):
- return _validation_error(Exception("Events must be a list"))
+ return _standard_error(
+ message="Events must be a list",
+ status_code=HTTPStatus.BAD_REQUEST,
+ )
# Process events in parallel
await asyncio.gather(
@@ -604,25 +544,21 @@ async def communicationservices_event_post(
_communicationservices_event_worker(
call_id=call_id,
event_dict=event,
- post=post,
secret=secret,
- trainings=trainings,
)
for event in events
]
)
# Return default response
- return func.HttpResponse(status_code=HTTPStatus.NO_CONTENT)
+ return
# TODO: Refacto, too long (and remove PLR0912/PLR0915 ignore)
async def _communicationservices_event_worker( # noqa: PLR0912, PLR0915
call_id: UUID,
event_dict: dict,
- post: func.Out[str],
secret: str,
- trainings: func.Out[str],
) -> None:
"""
Worker to handle a single event from Azure Communication Services.
@@ -637,7 +573,7 @@ async def _communicationservices_event_worker( # noqa: PLR0912, PLR0915
- Recognize completed
- Recognize failed
- Returns None. Can trigger additional events to `trainings` and `post` queues.
+ Returns None. Can trigger additional events to `training` and `post` queues.
"""
span_attribute(CallAttributes.CALL_ID, str(call_id))
call = await _db.call_aget(call_id)
@@ -667,10 +603,10 @@ async def _communicationservices_event_worker( # noqa: PLR0912, PLR0915
logger.debug(event.data)
async def _post_callback(_call: CallStateModel) -> None:
- _trigger_post_event(call=_call, post=post)
+ await _trigger_post_event(_call)
- async def _trainings_callback(_call: CallStateModel) -> None:
- _trigger_trainings_event(call=_call, trainings=trainings)
+ async def _training_callback(_call: CallStateModel) -> None:
+ await _trigger_training_event(_call)
if event_type == "Microsoft.Communication.CallConnected": # Call answered
server_call_id = event.data["serverCallId"]
@@ -679,7 +615,7 @@ async def _communicationservices_event_worker( # noqa: PLR0912, PLR0915
client=automation_client,
post_callback=_post_callback,
server_call_id=server_call_id,
- trainings_callback=_trainings_callback,
+ training_callback=_training_callback,
)
elif event_type == "Microsoft.Communication.CallDisconnected": # Call hung up
@@ -702,7 +638,7 @@ async def _communicationservices_event_worker( # noqa: PLR0912, PLR0915
client=automation_client,
post_callback=_post_callback,
text=speech_text,
- trainings_callback=_trainings_callback,
+ training_callback=_training_callback,
)
elif recognition_result == "choices": # Handle IVR
@@ -712,7 +648,7 @@ async def _communicationservices_event_worker( # noqa: PLR0912, PLR0915
client=automation_client,
label=label_detected,
post_callback=_post_callback,
- trainings_callback=_trainings_callback,
+ training_callback=_training_callback,
)
elif (
@@ -777,68 +713,52 @@ async def _communicationservices_event_worker( # noqa: PLR0912, PLR0915
) # TODO: Do not persist on every event, this is simpler but not efficient
- arg_name="trainings",
- connection="Storage",
- queue_name=CONFIG.communication_services.trainings_queue_name,
-)
[email protected]_as_current_span("trainings_event")
-async def trainings_event(
- trainings: func.QueueMessage,
[email protected]_as_current_span("training_event")
+async def training_event(
+ training: AzureQueueStorageMessage,
) -> None:
"""
- Handle trainings event from the queue.
+ Handle training event from the queue.
- Queue message is a JSON object `CallStateModel`. The event will load asynchroniously the trainings for a call.
+ Queue message is a JSON object `CallStateModel`. The event will load asynchroniously the training for a call.
Returns None.
"""
- call = CallStateModel.model_validate_json(trainings.get_body())
- logger.debug("Trainings event received for call %s", call)
+ call = CallStateModel.model_validate_json(training.content)
+ logger.debug("Training event received for call %s", call)
span_attribute(CallAttributes.CALL_ID, str(call.call_id))
span_attribute(CallAttributes.CALL_PHONE_NUMBER, call.initiate.phone_number)
await call.trainings(cache_only=False) # Get trainings by advance to populate cache
- arg_name="post",
- connection="Storage",
- queue_name=CONFIG.communication_services.post_queue_name,
-)
@tracer.start_as_current_span("post_event")
async def post_event(
- post: func.QueueMessage,
+ post: AzureQueueStorageMessage,
) -> None:
"""
Handle post-call intelligence event from the queue.
Queue message is a JSON object `CallStateModel`. The event will load asynchroniously the `on_end_call` workflow.
"""
- call = CallStateModel.model_validate_json(post.get_body())
+ call = CallStateModel.model_validate_json(post.content)
logger.debug("Post event received for call %s", call)
span_attribute(CallAttributes.CALL_ID, str(call.call_id))
span_attribute(CallAttributes.CALL_PHONE_NUMBER, call.initiate.phone_number)
await on_end_call(call)
-def _trigger_trainings_event(
- call: CallStateModel,
- trainings: func.Out[str],
-) -> None:
+async def _trigger_training_event(call: CallStateModel) -> None:
"""
- Shortcut to add trainings to the queue.
+ Shortcut to add training to the queue.
"""
- trainings.set(call.model_dump_json(exclude_none=True))
+ await _training_queue.send_message(call.model_dump_json(exclude_none=True))
-def _trigger_post_event(
- call: CallStateModel,
- post: func.Out[str],
-) -> None:
+async def _trigger_post_event(call: CallStateModel) -> None:
"""
Shortcut to add post-call intelligence to the queue.
"""
- post.set(call.model_dump_json(exclude_none=True))
+ await _post_queue.send_message(call.model_dump_json(exclude_none=True))
async def _communicationservices_event_url(
@@ -869,27 +789,14 @@ async def _communicationservices_event_url(
# TODO: Secure this endpoint with a secret, either in the Authorization header or in the URL
- "twilio/sms",
- methods=["POST"],
- trigger_arg_name="req",
-)
- arg_name="trainings",
- connection="Storage",
- queue_name=CONFIG.communication_services.trainings_queue_name,
-)
- arg_name="post",
- connection="Storage",
- queue_name=CONFIG.communication_services.post_queue_name,
+ "/twilio/sms",
+ status_code=HTTPStatus.OK,
)
@tracer.start_as_current_span("twilio_sms_post")
async def twilio_sms_post(
- post: func.Out[str],
- req: func.HttpRequest,
- trainings: func.Out[str],
-) -> func.HttpResponse:
+ Body: Annotated[str, Form()], From: Annotated[PhoneNumber, Form()]
+) -> Response:
"""
Handle incoming SMS event from Twilio.
@@ -897,45 +804,38 @@ async def twilio_sms_post(
Returns a 200 OK if the SMS is properly formatted. Otherwise, returns a 400 Bad Request.
"""
- if not req.form:
- return _validation_error(Exception("No form data"))
- try:
- phone_number = PhoneNumber(req.form["From"])
- message: str = req.form["Body"]
- except ValueError as e:
- return _validation_error(e)
-
- span_attribute(CallAttributes.CALL_PHONE_NUMBER, phone_number)
- call = await _db.call_asearch_one(phone_number)
+ span_attribute(CallAttributes.CALL_PHONE_NUMBER, From)
+ call = await _db.call_asearch_one(From)
if not call:
- logger.warning("Call for phone number %s not found", phone_number)
-
+ logger.warning("Call for phone number %s not found", From)
else:
span_attribute(CallAttributes.CALL_ID, str(call.call_id))
async def _post_callback(_call: CallStateModel) -> None:
- _trigger_post_event(call=_call, post=post)
+ await _trigger_post_event(_call)
- async def _trainings_callback(_call: CallStateModel) -> None:
- _trigger_trainings_event(call=_call, trainings=trainings)
+ async def _training_callback(_call: CallStateModel) -> None:
+ await _trigger_training_event(_call)
event_status = await on_sms_received(
call=call,
client=await _use_automation_client(),
- message=message,
+ message=Body,
post_callback=_post_callback,
- trainings_callback=_trainings_callback,
+ training_callback=_training_callback,
)
if not event_status:
- return _standard_error(
- message="SMS event failed",
- status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
+ return JSONResponse(
+ content=_standard_error(
+ message="SMS event failed",
+ status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
+ )
)
- return func.HttpResponse(
- body=str(MessagingResponse()), # Twilio expects an empty response everytime
- mimetype="application/xml",
+ return Response(
+ content=str(MessagingResponse()), # Twilio expects an empty response every time
+ media_type="application/xml",
status_code=HTTPStatus.OK,
)
@@ -963,19 +863,9 @@ def _str_to_contexts(value: str | None) -> set[CallContextEnum] | None:
return res or None
-def _validation_error(
- e: Exception,
-) -> func.HttpResponse:
+def _validation_error(e: Exception) -> ErrorModel:
"""
Generate a standard validation error response.
-
- Response body is a JSON object with the following structure:
-
- ```
- {"error": {"message": "Validation error", "details": ["Error message"]}}
- ```
-
- Returns a 400 Bad Request with a JSON body.
"""
messages = []
if isinstance(e, ValidationError):
@@ -995,28 +885,15 @@ def _standard_error(
message: str,
details: list[str] | None = None,
status_code: HTTPStatus = HTTPStatus.BAD_REQUEST,
-) -> func.HttpResponse:
+) -> ErrorModel:
"""
Generate a standard error response.
-
- Response body is a JSON object with the following structure:
-
- ```
- {"error": {"message": "Error message", "details": ["Error details"]}}
- ```
-
- Returns a JOSN with a JSON body and the specified status code.
"""
- res_json = {
- "error": {
- "message": message,
- "details": details or [],
- }
- }
- return func.HttpResponse(
- body=json.dumps(res_json),
- mimetype="application/json",
- status_code=status_code,
+ return ErrorModel(
+ error=ErrorInnerModel(
+ details=details or [],
+ message=message,
+ )
)
diff --git a/models/error.py b/models/error.py
new file mode 100644
index 0000000..345c318
--- /dev/null
+++ b/models/error.py
@@ -0,0 +1,10 @@
+from pydantic import BaseModel
+
+
+class ErrorInnerModel(BaseModel):
+ message: str
+ details: list[str]
+
+
+class ErrorModel(BaseModel):
+ error: ErrorInnerModel
diff --git a/models/training.py b/models/training.py
index 2642bbc..29a0a27 100644
--- a/models/training.py
+++ b/models/training.py
@@ -1,4 +1,3 @@
-from datetime import datetime
from functools import total_ordering
from uuid import UUID
@@ -11,13 +10,8 @@ class TrainingModel(BaseModel, frozen=True):
Represents a training document from AI Search.
"""
- answer: str
- context: str
- created_at: datetime
- document_synthesis: str
- file_path: str
+ content: str
id: UUID
- question: str
score: float
def __hash__(self) -> int:
@@ -38,4 +32,4 @@ class TrainingModel(BaseModel, frozen=True):
"""
Returns fields that should be excluded from sending to LLM because they are not relevant for document understanding.
"""
- return {"id", "file_path", "score", "created_at"}
+ return {"id", "score"}
diff --git a/persistence/ai_search.py b/persistence/ai_search.py
index f4f7bfa..ac9b6b0 100644
--- a/persistence/ai_search.py
+++ b/persistence/ai_search.py
@@ -1,4 +1,3 @@
-from azure.core.credentials import AzureKeyCredential
from azure.core.exceptions import (
HttpResponseError,
ResourceNotFoundError,
@@ -25,6 +24,7 @@ from tenacity import (
from helpers.config_models.ai_search import AiSearchModel
from helpers.http import azure_transport
+from helpers.identity import credential
from helpers.logging import logger
from models.readiness import ReadinessEnum
from models.training import TrainingModel
@@ -164,8 +164,6 @@ class AiSearchSearch(ISearch):
# Performance
transport=await azure_transport(),
# Authentication
- credential=AzureKeyCredential(
- self._config.access_key.get_secret_value()
- ),
+ credential=await credential(),
)
return self._client
diff --git a/persistence/azure_queue_storage.py b/persistence/azure_queue_storage.py
new file mode 100644
index 0000000..8d348ab
--- /dev/null
+++ b/persistence/azure_queue_storage.py
@@ -0,0 +1,138 @@
+import asyncio
+from base64 import b64decode, b64encode
+from binascii import Error as BinasciiError
+from collections.abc import AsyncGenerator, Awaitable, Callable
+from contextlib import asynccontextmanager
+
+from azure.core.exceptions import ServiceRequestError
+from azure.storage.queue.aio import QueueClient, QueueServiceClient
+from pydantic import BaseModel
+from tenacity import (
+ retry,
+ retry_if_exception_type,
+ stop_after_attempt,
+ wait_random_exponential,
+)
+
+from helpers.http import azure_transport
+from helpers.identity import credential
+from helpers.logging import logger
+
+
+class Message(BaseModel):
+ content: str
+ delete_token: str | None
+ dequeue_count: int | None
+ message_id: str
+
+
+class AzureQueueStorage:
+ _account_url: str
+ _encoding = "utf-8"
+ _name: str
+
+ def __init__(
+ self,
+ account_url: str,
+ name: str,
+ ) -> None:
+ logger.info('Azure Queue Storage "%s" is configured', name)
+ self._account_url = account_url
+ self._name = name
+
+ @retry(
+ reraise=True,
+ retry=retry_if_exception_type(ServiceRequestError), # Catch for network errors
+ stop=stop_after_attempt(8),
+ wait=wait_random_exponential(multiplier=0.8, max=60),
+ )
+ async def send_message(
+ self,
+ message: str,
+ ) -> None:
+ async with self._use_client() as client:
+ await client.send_message(self._escape(message))
+
+ @retry(
+ reraise=True,
+ retry=retry_if_exception_type(ServiceRequestError), # Catch for network errors
+ stop=stop_after_attempt(8),
+ wait=wait_random_exponential(multiplier=0.8, max=60),
+ )
+ async def receive_messages(
+ self,
+ max_messages: int,
+ visibility_timeout: int,
+ ) -> AsyncGenerator[Message, None]:
+ async with self._use_client() as client:
+ messages = client.receive_messages(
+ max_messages=max_messages,
+ visibility_timeout=visibility_timeout,
+ )
+ async for message in messages:
+ yield Message(
+ content=self._unescape(message.content),
+ delete_token=message.pop_receipt,
+ dequeue_count=message.dequeue_count,
+ message_id=message.id,
+ )
+
+ async def delete_message(
+ self,
+ message: Message,
+ ) -> None:
+ async with self._use_client() as client:
+ await client.delete_message(
+ message=message.message_id,
+ pop_receipt=message.delete_token,
+ )
+
+ def _escape(self, value: str) -> str:
+ """
+ Escape value to base64 encoding.
+ """
+ return b64encode(value.encode(self._encoding)).decode(self._encoding)
+
+ def _unescape(self, value: str) -> str:
+ """
+ Unescape value from base64 encoding.
+
+ If the value is not base64 encoded, return the original value as string. This will handle retro-compatibility with old messages.
+ """
+ try:
+ return b64decode(value.encode(self._encoding)).decode(self._encoding)
+ except (UnicodeDecodeError, BinasciiError):
+ return value
+
+ @asynccontextmanager
+ async def _use_client(self) -> AsyncGenerator[QueueClient, None]:
+ async with QueueServiceClient(
+ # Performance
+ transport=await azure_transport(),
+ # Deployment
+ account_url=self._account_url,
+ # Authentication
+ credential=await credential(),
+ ) as service:
+ yield service.get_queue_client(
+ # Performance
+ transport=await azure_transport(),
+ # Deployment
+ queue=self._name,
+ )
+
+ async def trigger(
+ self,
+ arg: str,
+ func: Callable[..., Awaitable],
+ ):
+ while messages := self.receive_messages(
+ max_messages=32,
+ visibility_timeout=32 * 5, # 5 secs per message
+ ):
+ async for message in messages:
+ kwargs = {}
+ kwargs[arg] = message
+ await func(**kwargs)
+ await self.delete_message(message)
+ await asyncio.sleep(1) # Add a small delay to avoid tight loop
diff --git a/persistence/cosmos_db.py b/persistence/cosmos_db.py
index e0b8484..44b2cb2 100644
--- a/persistence/cosmos_db.py
+++ b/persistence/cosmos_db.py
@@ -1,17 +1,17 @@
import asyncio
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
-from http import HTTPStatus
from uuid import UUID, uuid4
from azure.cosmos import ConsistencyLevel
from azure.cosmos.aio import ContainerProxy, CosmosClient
-from azure.cosmos.exceptions import CosmosHttpResponseError
+from azure.cosmos.exceptions import CosmosResourceNotFoundError
from pydantic import ValidationError
from helpers.config_models.database import CosmosDbModel
from helpers.features import callback_timeout_hour
from helpers.http import azure_transport
+from helpers.identity import credential
from helpers.logging import logger
from models.call import CallStateModel
from models.readiness import ReadinessEnum
@@ -79,10 +79,8 @@ class CosmosDbStore(IStore):
try:
await db.read_item(item=test_id, partition_key=partition_key)
exist = True
- except CosmosHttpResponseError as e:
- if e.status_code != HTTPStatus.NOT_FOUND:
- logger.error("Error requesting CosmosDB: %s", e)
- exist = True
+ except CosmosResourceNotFoundError:
+ pass
return exist
async def call_aget(self, call_id: UUID) -> CallStateModel | None:
@@ -299,7 +297,7 @@ class CosmosDbStore(IStore):
# Deployment
url=self._config.endpoint,
# Authentication
- credential=self._config.access_key.get_secret_value(),
+ credential=await credential(),
)
async with self._client as client:
database = client.get_database_client(self._config.database)
diff --git a/pyproject.toml b/pyproject.toml
index 234b218..ff0c91c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ dynamic = ["version"]
license = {file = "LICENSE"}
name = "call-center-ai"
readme = "README.md"
-requires-python = ">=3.11"
+requires-python = ">=3.12"
dependencies = [
"aiohttp-retry~=2.8", # Retry middleware for aiohttp, used with Twilio SDK
"aiohttp[speedups]~=3.9", # Async HTTP client for Azure and Twilio SDKs, plus async DNS resolver and async Brotli compression
@@ -15,12 +15,13 @@ dependencies = [
"azure-communication-sms~=1.0", # Azure Communication Services SMS
"azure-cosmos~=4.7", # Azure Cosmos DB
"azure-eventgrid~=4.20", # Azure Event Grid
- "azure-functions~=1.20", # Azure Functions
"azure-identity~=1.17", # Azure identity library
"azure-monitor-opentelemetry~=1.6", # Azure Monitor OpenTelemetry
"azure-search-documents==11.6.0b4", # Azure AI Search
"azure-storage-queue~=12.10", # Azure Storage Queue
"django-htmlmin~=0.11", # Minify HTML
+ "fastapi~=0.115", # Web framework
+ "gunicorn~=23.0", # Application server
"jinja2~=3.1", # Template engine, used for prompts and web views
"json-repair~=0.25", # Repair JSON files from LLM
"mistune~=3.0", # Markdown parser for web views
@@ -37,6 +38,7 @@ dependencies = [
"pydantic[email]~=2.7", # Data serialization and validation, plus email validation
"pyjwt~=2.8", # Secure inbound calls from Communication Services
"python-dotenv~=1.0", # Load environment variables from .env file
+ "python-multipart~=0.0", # Form parsing
"pytz~=2024.0", # Time zone handling
"pyyaml~=6.0", # YAML parser
"redis~=5.0", # Redis client
@@ -44,6 +46,7 @@ dependencies = [
"tiktoken~=0.7", # Tokenization library for OpenAI models
"twilio~=9.2", # Twilio SDK, used for SMS
"typing-extensions~=4.12", # Typing extensions for Python 3.6+
+ "uvicorn[standard]~=0.31", # Application middleware
]
[project.optional-dependencies]
@@ -81,7 +84,7 @@ DEP002 = [
]
[tool.ruff]
-target-version = "py311"
+target-version = "py313"
[tool.ruff.lint.isort]
combine-as-imports = true
@@ -90,4 +93,4 @@ combine-as-imports = true
docstring-code-format = true
[tool.pyright]
-pythonVersion = "3.11"
+pythonVersion = "3.12"
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 6707f5c..aa12616 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.11
+# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --allow-unsafe --extra=dev --generate-hashes --output-file=requirements-dev.txt pyproject.toml
@@ -117,6 +117,8 @@ anyio==4.4.0 \
# via
# httpx
# openai
+ # starlette
+ # watchfiles
appdirs==1.4.4 \
--hash=sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41 \
--hash=sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128
@@ -178,10 +180,6 @@ azure-eventgrid==4.20.0 \
--hash=sha256:c1edab90769bc4e7a2fb0a2037cf0455754d50af793674c08b3fec2293248c4c \
--hash=sha256:e93c87df46bf16f38d427adf7fd1673c47066f293dfa6f3cbc19036e2b3d6af1
# via call-center-ai (pyproject.toml)
-azure-functions==1.20.0 \
- --hash=sha256:1d4ad15b10768b78046154d1da392e99634b64b4821dd091d5b9fe3600c49573 \
- --hash=sha256:437e8889d7a75379159b457589cb74f6f966d3576067ae6649fafcd9058102e1
- # via call-center-ai (pyproject.toml)
azure-identity==1.17.0 \
--hash=sha256:501d6c2cbb07826ff5e7cebc05ef319ba45612f31f0bdadca260005798e4ef16 \
--hash=sha256:a1168f223b2d7fa3968362b78affd157a1f3772f310a8cdce883cc515c6c8998
@@ -459,6 +457,7 @@ click==8.1.7 \
# deptry
# pip-tools
# typer
+ # uvicorn
cryptography==42.0.8 \
--hash=sha256:013629ae70b40af70c9a7a5db40abe5d9054e6f4380e50ce769947b73bf3caad \
--hash=sha256:2346b911eb349ab547076f47f2e035fc8ff2c02380a7cbbf8d87114fa0f1c583 \
@@ -555,6 +554,10 @@ execnet==2.1.1 \
--hash=sha256:26dee51f1b80cebd6d0ca8e74dd8745419761d3bef34163928cbebbdc4749fdc \
--hash=sha256:5189b52c6121c24feae288166ab41b32549c7e2348652736540b9e6e7d4e72e3
# via pytest-xdist
+fastapi==0.115.0 \
+ --hash=sha256:17ea427674467486e997206a5ab25760f6b09e069f099b96f5b55a32fb6f1631 \
+ --hash=sha256:f93b4ca3529a8ebc6fc3fcf710e5efa8de3df9b41570958abf1d97d843138004
+ # via call-center-ai (pyproject.toml)
filelock==3.15.4 \
--hash=sha256:2207938cbc1844345cb01a5a95524dae30f0ce089eba5b00378295a17e3e90cb \
--hash=sha256:6ca1fffae96225dab4c6eaf1c4f4f28cd2568d3ec2a44e15a08520504de468e7
@@ -657,81 +660,6 @@ googleapis-common-protos==1.63.2 \
--hash=sha256:27a2499c7e8aff199665b22741997e485eccc8645aa9176c7c988e6fae507945 \
--hash=sha256:27c5abdffc4911f28101e635de1533fb4cfd2c37fbaa9174587c799fac90aa87
# via opentelemetry-exporter-otlp-proto-grpc
-greenlet==3.1.1 \
- --hash=sha256:0153404a4bb921f0ff1abeb5ce8a5131da56b953eda6e14b88dc6bbc04d2049e \
- --hash=sha256:03a088b9de532cbfe2ba2034b2b85e82df37874681e8c470d6fb2f8c04d7e4b7 \
- --hash=sha256:04b013dc07c96f83134b1e99888e7a79979f1a247e2a9f59697fa14b5862ed01 \
- --hash=sha256:05175c27cb459dcfc05d026c4232f9de8913ed006d42713cb8a5137bd49375f1 \
- --hash=sha256:09fc016b73c94e98e29af67ab7b9a879c307c6731a2c9da0db5a7d9b7edd1159 \
- --hash=sha256:0bbae94a29c9e5c7e4a2b7f0aae5c17e8e90acbfd3bf6270eeba60c39fce3563 \
- --hash=sha256:0fde093fb93f35ca72a556cf72c92ea3ebfda3d79fc35bb19fbe685853869a83 \
- --hash=sha256:1443279c19fca463fc33e65ef2a935a5b09bb90f978beab37729e1c3c6c25fe9 \
- --hash=sha256:1776fd7f989fc6b8d8c8cb8da1f6b82c5814957264d1f6cf818d475ec2bf6395 \
- --hash=sha256:1d3755bcb2e02de341c55b4fca7a745a24a9e7212ac953f6b3a48d117d7257aa \
- --hash=sha256:23f20bb60ae298d7d8656c6ec6db134bca379ecefadb0b19ce6f19d1f232a942 \
- --hash=sha256:275f72decf9932639c1c6dd1013a1bc266438eb32710016a1c742df5da6e60a1 \
- --hash=sha256:2846930c65b47d70b9d178e89c7e1a69c95c1f68ea5aa0a58646b7a96df12441 \
- --hash=sha256:3319aa75e0e0639bc15ff54ca327e8dc7a6fe404003496e3c6925cd3142e0e22 \
- --hash=sha256:346bed03fe47414091be4ad44786d1bd8bef0c3fcad6ed3dee074a032ab408a9 \
- --hash=sha256:36b89d13c49216cadb828db8dfa6ce86bbbc476a82d3a6c397f0efae0525bdd0 \
- --hash=sha256:37b9de5a96111fc15418819ab4c4432e4f3c2ede61e660b1e33971eba26ef9ba \
- --hash=sha256:396979749bd95f018296af156201d6211240e7a23090f50a8d5d18c370084dc3 \
- --hash=sha256:3b2813dc3de8c1ee3f924e4d4227999285fd335d1bcc0d2be6dc3f1f6a318ec1 \
- --hash=sha256:411f015496fec93c1c8cd4e5238da364e1da7a124bcb293f085bf2860c32c6f6 \
- --hash=sha256:47da355d8687fd65240c364c90a31569a133b7b60de111c255ef5b606f2ae291 \
- --hash=sha256:48ca08c771c268a768087b408658e216133aecd835c0ded47ce955381105ba39 \
- --hash=sha256:4afe7ea89de619adc868e087b4d2359282058479d7cfb94970adf4b55284574d \
- --hash=sha256:4ce3ac6cdb6adf7946475d7ef31777c26d94bccc377e070a7986bd2d5c515467 \
- --hash=sha256:4ead44c85f8ab905852d3de8d86f6f8baf77109f9da589cb4fa142bd3b57b475 \
- --hash=sha256:54558ea205654b50c438029505def3834e80f0869a70fb15b871c29b4575ddef \
- --hash=sha256:5e06afd14cbaf9e00899fae69b24a32f2196c19de08fcb9f4779dd4f004e5e7c \
- --hash=sha256:62ee94988d6b4722ce0028644418d93a52429e977d742ca2ccbe1c4f4a792511 \
- --hash=sha256:63e4844797b975b9af3a3fb8f7866ff08775f5426925e1e0bbcfe7932059a12c \
- --hash=sha256:6510bf84a6b643dabba74d3049ead221257603a253d0a9873f55f6a59a65f822 \
- --hash=sha256:667a9706c970cb552ede35aee17339a18e8f2a87a51fba2ed39ceeeb1004798a \
- --hash=sha256:6ef9ea3f137e5711f0dbe5f9263e8c009b7069d8a1acea822bd5e9dae0ae49c8 \
- --hash=sha256:7017b2be767b9d43cc31416aba48aab0d2309ee31b4dbf10a1d38fb7972bdf9d \
- --hash=sha256:7124e16b4c55d417577c2077be379514321916d5790fa287c9ed6f23bd2ffd01 \
- --hash=sha256:73aaad12ac0ff500f62cebed98d8789198ea0e6f233421059fa68a5aa7220145 \
- --hash=sha256:77c386de38a60d1dfb8e55b8c1101d68c79dfdd25c7095d51fec2dd800892b80 \
- --hash=sha256:7876452af029456b3f3549b696bb36a06db7c90747740c5302f74a9e9fa14b13 \
- --hash=sha256:7939aa3ca7d2a1593596e7ac6d59391ff30281ef280d8632fa03d81f7c5f955e \
- --hash=sha256:8320f64b777d00dd7ccdade271eaf0cad6636343293a25074cc5566160e4de7b \
- --hash=sha256:85f3ff71e2e60bd4b4932a043fbbe0f499e263c628390b285cb599154a3b03b1 \
- --hash=sha256:8b8b36671f10ba80e159378df9c4f15c14098c4fd73a36b9ad715f057272fbef \
- --hash=sha256:93147c513fac16385d1036b7e5b102c7fbbdb163d556b791f0f11eada7ba65dc \
- --hash=sha256:935e943ec47c4afab8965954bf49bfa639c05d4ccf9ef6e924188f762145c0ff \
- --hash=sha256:94b6150a85e1b33b40b1464a3f9988dcc5251d6ed06842abff82e42632fac120 \
- --hash=sha256:94ebba31df2aa506d7b14866fed00ac141a867e63143fe5bca82a8e503b36437 \
- --hash=sha256:95ffcf719966dd7c453f908e208e14cde192e09fde6c7186c8f1896ef778d8cd \
- --hash=sha256:98884ecf2ffb7d7fe6bd517e8eb99d31ff7855a840fa6d0d63cd07c037f6a981 \
- --hash=sha256:99cfaa2110534e2cf3ba31a7abcac9d328d1d9f1b95beede58294a60348fba36 \
- --hash=sha256:9e8f8c9cb53cdac7ba9793c276acd90168f416b9ce36799b9b885790f8ad6c0a \
- --hash=sha256:a0dfc6c143b519113354e780a50381508139b07d2177cb6ad6a08278ec655798 \
- --hash=sha256:b2795058c23988728eec1f36a4e5e4ebad22f8320c85f3587b539b9ac84128d7 \
- --hash=sha256:b42703b1cf69f2aa1df7d1030b9d77d3e584a70755674d60e710f0af570f3761 \
- --hash=sha256:b7cede291382a78f7bb5f04a529cb18e068dd29e0fb27376074b6d0317bf4dd0 \
- --hash=sha256:b8a678974d1f3aa55f6cc34dc480169d58f2e6d8958895d68845fa4ab566509e \
- --hash=sha256:b8da394b34370874b4572676f36acabac172602abf054cbc4ac910219f3340af \
- --hash=sha256:c3a701fe5a9695b238503ce5bbe8218e03c3bcccf7e204e455e7462d770268aa \
- --hash=sha256:c4aab7f6381f38a4b42f269057aee279ab0fc7bf2e929e3d4abfae97b682a12c \
- --hash=sha256:ca9d0ff5ad43e785350894d97e13633a66e2b50000e8a183a50a88d834752d42 \
- --hash=sha256:d0028e725ee18175c6e422797c407874da24381ce0690d6b9396c204c7f7276e \
- --hash=sha256:d21e10da6ec19b457b82636209cbe2331ff4306b54d06fa04b7c138ba18c8a81 \
- --hash=sha256:d5e975ca70269d66d17dd995dafc06f1b06e8cb1ec1e9ed54c1d1e4a7c4cf26e \
- --hash=sha256:da7a9bff22ce038e19bf62c4dd1ec8391062878710ded0a845bcf47cc0200617 \
- --hash=sha256:db32b5348615a04b82240cc67983cb315309e88d444a288934ee6ceaebcad6cc \
- --hash=sha256:dcc62f31eae24de7f8dce72134c8651c58000d3b1868e01392baea7c32c247de \
- --hash=sha256:dfc59d69fc48664bc693842bd57acfdd490acafda1ab52c7836e3fc75c90a111 \
- --hash=sha256:e347b3bfcf985a05e8c0b7d462ba6f15b1ee1c909e2dcad795e49e91b152c383 \
- --hash=sha256:e4d333e558953648ca09d64f13e6d8f0523fa705f51cae3f03b5983489958c70 \
- --hash=sha256:ed10eac5830befbdd0c32f83e8aa6288361597550ba669b04c48f0f9a2c843c6 \
- --hash=sha256:efc0f674aa41b92da8c49e0346318c6075d734994c3c4e4430b1c3f853e498e4 \
- --hash=sha256:f1695e76146579f8c06c1509c7ce4dfe0706f49c6831a817ac04eebb2fd02011 \
- --hash=sha256:f1d4aeb8891338e60d1ab6127af1fe45def5259def8094b9c7e34690c8858803 \
- --hash=sha256:f406b22b7c9a9b4f8aa9d2ab13d6ae0ac3e85c9a809bd590ad53fed2bf70dc79 \
- --hash=sha256:f6ff3b14f2df4c41660a7dec01045a045653998784bf8cfcb5a525bdffffbc8f
- # via sqlalchemy
grpcio==1.64.1 \
--hash=sha256:03b43d0ccf99c557ec671c7dede64f023c7da9bb632ac65dbc57f166e4970040 \
--hash=sha256:0a12ddb1678ebc6a84ec6b0487feac020ee2b1659cbe69b80f06dbffdb249122 \
@@ -780,10 +708,16 @@ grpcio==1.64.1 \
--hash=sha256:ee73a2f5ca4ba44fa33b4d7d2c71e2c8a9e9f78d53f6507ad68e7d2ad5f64a22 \
--hash=sha256:f10193c69fc9d3d726e83bbf0f3d316f1847c3071c8c93d8090cf5f326b14309
# via opentelemetry-exporter-otlp-proto-grpc
+gunicorn==23.0.0 \
+ --hash=sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d \
+ --hash=sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec
+ # via call-center-ai (pyproject.toml)
h11==0.14.0 \
--hash=sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d \
--hash=sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761
- # via httpcore
+ # via
+ # httpcore
+ # uvicorn
html5lib==1.1 \
--hash=sha256:0d78f8fde1c230e99fe37986a60526d7049ed4bf8a9fadbad5f00e22e58e041d \
--hash=sha256:b2e5b40261e20f354d198eae92afc10d750afb487ed5e50f9c4eaf07c184146f
@@ -792,6 +726,44 @@ httpcore==1.0.5 \
--hash=sha256:34a38e2f9291467ee3b44e89dd52615370e152954ba21721378a87b2960f7a61 \
--hash=sha256:421f18bac248b25d310f3cacd198d55b8e6125c107797b609ff9b7a6ba7991b5
# via httpx
+httptools==0.6.1 \
+ --hash=sha256:00d5d4b68a717765b1fabfd9ca755bd12bf44105eeb806c03d1962acd9b8e563 \
+ --hash=sha256:0ac5a0ae3d9f4fe004318d64b8a854edd85ab76cffbf7ef5e32920faef62f142 \
+ --hash=sha256:0cf2372e98406efb42e93bfe10f2948e467edfd792b015f1b4ecd897903d3e8d \
+ --hash=sha256:1ed99a373e327f0107cb513b61820102ee4f3675656a37a50083eda05dc9541b \
+ --hash=sha256:3c3b214ce057c54675b00108ac42bacf2ab8f85c58e3f324a4e963bbc46424f4 \
+ --hash=sha256:3e802e0b2378ade99cd666b5bffb8b2a7cc8f3d28988685dc300469ea8dd86cb \
+ --hash=sha256:3f30d3ce413088a98b9db71c60a6ada2001a08945cb42dd65a9a9fe228627658 \
+ --hash=sha256:405784577ba6540fa7d6ff49e37daf104e04f4b4ff2d1ac0469eaa6a20fde084 \
+ --hash=sha256:48ed8129cd9a0d62cf4d1575fcf90fb37e3ff7d5654d3a5814eb3d55f36478c2 \
+ --hash=sha256:4bd3e488b447046e386a30f07af05f9b38d3d368d1f7b4d8f7e10af85393db97 \
+ --hash=sha256:4f0f8271c0a4db459f9dc807acd0eadd4839934a4b9b892f6f160e94da309837 \
+ --hash=sha256:5cceac09f164bcba55c0500a18fe3c47df29b62353198e4f37bbcc5d591172c3 \
+ --hash=sha256:639dc4f381a870c9ec860ce5c45921db50205a37cc3334e756269736ff0aac58 \
+ --hash=sha256:678fcbae74477a17d103b7cae78b74800d795d702083867ce160fc202104d0da \
+ --hash=sha256:6a4f5ccead6d18ec072ac0b84420e95d27c1cdf5c9f1bc8fbd8daf86bd94f43d \
+ --hash=sha256:6f58e335a1402fb5a650e271e8c2d03cfa7cea46ae124649346d17bd30d59c90 \
+ --hash=sha256:75c8022dca7935cba14741a42744eee13ba05db00b27a4b940f0d646bd4d56d0 \
+ --hash=sha256:7a7ea483c1a4485c71cb5f38be9db078f8b0e8b4c4dc0210f531cdd2ddac1ef1 \
+ --hash=sha256:7d9ceb2c957320def533671fc9c715a80c47025139c8d1f3797477decbc6edd2 \
+ --hash=sha256:7ebaec1bf683e4bf5e9fbb49b8cc36da482033596a415b3e4ebab5a4c0d7ec5e \
+ --hash=sha256:85ed077c995e942b6f1b07583e4eb0a8d324d418954fc6af913d36db7c05a5a0 \
+ --hash=sha256:8ae5b97f690badd2ca27cbf668494ee1b6d34cf1c464271ef7bfa9ca6b83ffaf \
+ --hash=sha256:8b0bb634338334385351a1600a73e558ce619af390c2b38386206ac6a27fecfc \
+ --hash=sha256:8e216a038d2d52ea13fdd9b9c9c7459fb80d78302b257828285eca1c773b99b3 \
+ --hash=sha256:93ad80d7176aa5788902f207a4e79885f0576134695dfb0fefc15b7a4648d503 \
+ --hash=sha256:95658c342529bba4e1d3d2b1a874db16c7cca435e8827422154c9da76ac4e13a \
+ --hash=sha256:95fb92dd3649f9cb139e9c56604cc2d7c7bf0fc2e7c8d7fbd58f96e35eddd2a3 \
+ --hash=sha256:97662ce7fb196c785344d00d638fc9ad69e18ee4bfb4000b35a52efe5adcc949 \
+ --hash=sha256:9bb68d3a085c2174c2477eb3ffe84ae9fb4fde8792edb7bcd09a1d8467e30a84 \
+ --hash=sha256:b512aa728bc02354e5ac086ce76c3ce635b62f5fbc32ab7082b5e582d27867bb \
+ --hash=sha256:c6e26c30455600b95d94b1b836085138e82f177351454ee841c148f93a9bad5a \
+ --hash=sha256:d2f6c3c4cb1948d912538217838f6e9960bc4a521d7f9b323b3da579cd14532f \
+ --hash=sha256:dcbab042cc3ef272adc11220517278519adf8f53fd3056d0e68f0a6f891ba94e \
+ --hash=sha256:e0b281cf5a125c35f7f6722b65d8542d2e57331be573e9e88bc8b0115c4a7a81 \
+ --hash=sha256:e57997ac7fb7ee43140cc03664de5f268813a481dff6245e0075925adc6aa185 \
+ --hash=sha256:fe467eb086d80217b7584e61313ebadc8d187a4d95bb62031b7bab4b205c3ba3
+ # via uvicorn
httpx==0.27.0 \
--hash=sha256:71d5465162c13681bff01ad59b2cc68dd838ea1f10e51574bac27103f00c91a5 \
--hash=sha256:a0cb88a46f32dc874e04ee956e4c2764aba2aa228f650b06788ba6bda2962ab5
@@ -1386,6 +1358,7 @@ packaging==24.1 \
# via
# build
# datasets
+ # gunicorn
# huggingface-hub
# langchain-core
# marshmallow
@@ -1581,6 +1554,7 @@ pydantic[email]==2.7.4 \
# via
# call-center-ai (pyproject.toml)
# deepeval
+ # fastapi
# langchain
# langchain-core
# langsmith
@@ -1740,6 +1714,11 @@ python-dotenv==1.0.1 \
# via
# call-center-ai (pyproject.toml)
# pydantic-settings
+ # uvicorn
+python-multipart==0.0.12 \
+ --hash=sha256:045e1f98d719c1ce085ed7f7e1ef9d8ccc8c02ba02b5566d5f7521410ced58cb \
+ --hash=sha256:43dcf96cf65888a9cd3423544dd0d75ac10f7aa0c3c28a175bbcd00c9ce1aebf
+ # via call-center-ai (pyproject.toml)
pytz==2024.1 \
--hash=sha256:2a29735ea9c18baf14b448846bde5a48030ed267578472d8955cd0e7443a9812 \
--hash=sha256:328171f4e3623139da4983451950b28e95ac706e13f3f2630a879749e7a8b319
@@ -1805,6 +1784,7 @@ pyyaml==6.0.1 \
# langchain
# langchain-community
# langchain-core
+ # uvicorn
ragas==0.1.10 \
--hash=sha256:29bfd4844a29ca869950d5ed73461c276afd85d999d3c26acdd10560da6dc5c2 \
--hash=sha256:9e547f17f10075cccaae0216c7d22000346c5f9dfc66e55abf621d3ee80786f2
@@ -2022,6 +2002,10 @@ sqlalchemy==2.0.31 \
# via
# langchain
# langchain-community
+starlette==0.38.6 \
+ --hash=sha256:4517a1409e2e73ee4951214ba012052b9e16f60e90d73cfb06192c19203bbb05 \
+ --hash=sha256:863a1588f5574e70a821dadefb41e4881ea451a47a3cd1b4df359d4ffefe5ead
+ # via fastapi
tabulate==0.9.0 \
--hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \
--hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f
@@ -2106,6 +2090,7 @@ typing-extensions==4.12.2 \
# azure-identity
# azure-storage-queue
# call-center-ai (pyproject.toml)
+ # fastapi
# huggingface-hub
# openai
# opentelemetry-sdk
@@ -2128,10 +2113,220 @@ urllib3==2.2.2 \
# via
# requests
# sentry-sdk
+uvicorn[standard]==0.31.0 \
+ --hash=sha256:13bc21373d103859f68fe739608e2eb054a816dea79189bc3ca08ea89a275906 \
+ --hash=sha256:cac7be4dd4d891c363cd942160a7b02e69150dcbc7a36be04d5f4af4b17c8ced
+ # via call-center-ai (pyproject.toml)
+uvloop==0.20.0 \
+ --hash=sha256:265a99a2ff41a0fd56c19c3838b29bf54d1d177964c300dad388b27e84fd7847 \
+ --hash=sha256:2beee18efd33fa6fdb0976e18475a4042cd31c7433c866e8a09ab604c7c22ff2 \
+ --hash=sha256:35968fc697b0527a06e134999eef859b4034b37aebca537daeb598b9d45a137b \
+ --hash=sha256:36c530d8fa03bfa7085af54a48f2ca16ab74df3ec7108a46ba82fd8b411a2315 \
+ --hash=sha256:3a609780e942d43a275a617c0839d85f95c334bad29c4c0918252085113285b5 \
+ --hash=sha256:4603ca714a754fc8d9b197e325db25b2ea045385e8a3ad05d3463de725fdf469 \
+ --hash=sha256:4b75f2950ddb6feed85336412b9a0c310a2edbcf4cf931aa5cfe29034829676d \
+ --hash=sha256:4f44af67bf39af25db4c1ac27e82e9665717f9c26af2369c404be865c8818dcf \
+ --hash=sha256:6462c95f48e2d8d4c993a2950cd3d31ab061864d1c226bbf0ee2f1a8f36674b9 \
+ --hash=sha256:649c33034979273fa71aa25d0fe120ad1777c551d8c4cd2c0c9851d88fcb13ab \
+ --hash=sha256:746242cd703dc2b37f9d8b9f173749c15e9a918ddb021575a0205ec29a38d31e \
+ --hash=sha256:77fbc69c287596880ecec2d4c7a62346bef08b6209749bf6ce8c22bbaca0239e \
+ --hash=sha256:80dc1b139516be2077b3e57ce1cb65bfed09149e1d175e0478e7a987863b68f0 \
+ --hash=sha256:82edbfd3df39fb3d108fc079ebc461330f7c2e33dbd002d146bf7c445ba6e756 \
+ --hash=sha256:89e8d33bb88d7263f74dc57d69f0063e06b5a5ce50bb9a6b32f5fcbe655f9e73 \
+ --hash=sha256:94707205efbe809dfa3a0d09c08bef1352f5d3d6612a506f10a319933757c006 \
+ --hash=sha256:95720bae002ac357202e0d866128eb1ac82545bcf0b549b9abe91b5178d9b541 \
+ --hash=sha256:9b04d96188d365151d1af41fa2d23257b674e7ead68cfd61c725a422764062ae \
+ --hash=sha256:9d0fba61846f294bce41eb44d60d58136090ea2b5b99efd21cbdf4e21927c56a \
+ --hash=sha256:9ebafa0b96c62881d5cafa02d9da2e44c23f9f0cd829f3a32a6aff771449c996 \
+ --hash=sha256:a0fac7be202596c7126146660725157d4813aa29a4cc990fe51346f75ff8fde7 \
+ --hash=sha256:aea15c78e0d9ad6555ed201344ae36db5c63d428818b4b2a42842b3870127c00 \
+ --hash=sha256:b10c2956efcecb981bf9cfb8184d27d5d64b9033f917115a960b83f11bfa0d6b \
+ --hash=sha256:b16696f10e59d7580979b420eedf6650010a4a9c3bd8113f24a103dfdb770b10 \
+ --hash=sha256:d8c36fdf3e02cec92aed2d44f63565ad1522a499c654f07935c8f9d04db69e95 \
+ --hash=sha256:e237f9c1e8a00e7d9ddaa288e535dc337a39bcbf679f290aee9d26df9e72bce9 \
+ --hash=sha256:e50289c101495e0d1bb0bfcb4a60adde56e32f4449a67216a1ab2750aa84f037 \
+ --hash=sha256:e7d61fe8e8d9335fac1bf8d5d82820b4808dd7a43020c149b63a1ada953d48a6 \
+ --hash=sha256:e97152983442b499d7a71e44f29baa75b3b02e65d9c44ba53b10338e98dedb66 \
+ --hash=sha256:f0e94b221295b5e69de57a1bd4aeb0b3a29f61be6e1b478bb8a69a73377db7ba \
+ --hash=sha256:fee6044b64c965c425b65a4e17719953b96e065c5b7e09b599ff332bb2744bdf
+ # via uvicorn
+watchfiles==0.24.0 \
+ --hash=sha256:01550ccf1d0aed6ea375ef259706af76ad009ef5b0203a3a4cce0f6024f9b68a \
+ --hash=sha256:01def80eb62bd5db99a798d5e1f5f940ca0a05986dcfae21d833af7a46f7ee22 \
+ --hash=sha256:07cdef0c84c03375f4e24642ef8d8178e533596b229d32d2bbd69e5128ede02a \
+ --hash=sha256:083dc77dbdeef09fa44bb0f4d1df571d2e12d8a8f985dccde71ac3ac9ac067a0 \
+ --hash=sha256:1cf1f6dd7825053f3d98f6d33f6464ebdd9ee95acd74ba2c34e183086900a827 \
+ --hash=sha256:21ab23fdc1208086d99ad3f69c231ba265628014d4aed31d4e8746bd59e88cd1 \
+ --hash=sha256:2dadf8a8014fde6addfd3c379e6ed1a981c8f0a48292d662e27cabfe4239c83c \
+ --hash=sha256:2e28d91ef48eab0afb939fa446d8ebe77e2f7593f5f463fd2bb2b14132f95b6e \
+ --hash=sha256:2efec17819b0046dde35d13fb8ac7a3ad877af41ae4640f4109d9154ed30a188 \
+ --hash=sha256:30bbd525c3262fd9f4b1865cb8d88e21161366561cd7c9e1194819e0a33ea86b \
+ --hash=sha256:316449aefacf40147a9efaf3bd7c9bdd35aaba9ac5d708bd1eb5763c9a02bef5 \
+ --hash=sha256:327763da824817b38ad125dcd97595f942d720d32d879f6c4ddf843e3da3fe90 \
+ --hash=sha256:32aa53a9a63b7f01ed32e316e354e81e9da0e6267435c7243bf8ae0f10b428ef \
+ --hash=sha256:34e19e56d68b0dad5cff62273107cf5d9fbaf9d75c46277aa5d803b3ef8a9e9b \
+ --hash=sha256:3770e260b18e7f4e576edca4c0a639f704088602e0bc921c5c2e721e3acb8d15 \
+ --hash=sha256:3d2e3ab79a1771c530233cadfd277fcc762656d50836c77abb2e5e72b88e3a48 \
+ --hash=sha256:41face41f036fee09eba33a5b53a73e9a43d5cb2c53dad8e61fa6c9f91b5a51e \
+ --hash=sha256:43e3e37c15a8b6fe00c1bce2473cfa8eb3484bbeecf3aefbf259227e487a03df \
+ --hash=sha256:449f43f49c8ddca87c6b3980c9284cab6bd1f5c9d9a2b00012adaaccd5e7decd \
+ --hash=sha256:4933a508d2f78099162da473841c652ad0de892719043d3f07cc83b33dfd9d91 \
+ --hash=sha256:49d617df841a63b4445790a254013aea2120357ccacbed00253f9c2b5dc24e2d \
+ --hash=sha256:49fb58bcaa343fedc6a9e91f90195b20ccb3135447dc9e4e2570c3a39565853e \
+ --hash=sha256:4a7fa2bc0efef3e209a8199fd111b8969fe9db9c711acc46636686331eda7dd4 \
+ --hash=sha256:4abf4ad269856618f82dee296ac66b0cd1d71450fc3c98532d93798e73399b7a \
+ --hash=sha256:4b8693502d1967b00f2fb82fc1e744df128ba22f530e15b763c8d82baee15370 \
+ --hash=sha256:4d28cea3c976499475f5b7a2fec6b3a36208656963c1a856d328aeae056fc5c1 \
+ --hash=sha256:5148c2f1ea043db13ce9b0c28456e18ecc8f14f41325aa624314095b6aa2e9ea \
+ --hash=sha256:54ca90a9ae6597ae6dc00e7ed0a040ef723f84ec517d3e7ce13e63e4bc82fa04 \
+ --hash=sha256:551ec3ee2a3ac9cbcf48a4ec76e42c2ef938a7e905a35b42a1267fa4b1645896 \
+ --hash=sha256:5c51749f3e4e269231510da426ce4a44beb98db2dce9097225c338f815b05d4f \
+ --hash=sha256:632676574429bee8c26be8af52af20e0c718cc7f5f67f3fb658c71928ccd4f7f \
+ --hash=sha256:6509ed3f467b79d95fc62a98229f79b1a60d1b93f101e1c61d10c95a46a84f43 \
+ --hash=sha256:6bdcfa3cd6fdbdd1a068a52820f46a815401cbc2cb187dd006cb076675e7b735 \
+ --hash=sha256:7138eff8baa883aeaa074359daabb8b6c1e73ffe69d5accdc907d62e50b1c0da \
+ --hash=sha256:7211b463695d1e995ca3feb38b69227e46dbd03947172585ecb0588f19b0d87a \
+ --hash=sha256:73bde715f940bea845a95247ea3e5eb17769ba1010efdc938ffcb967c634fa61 \
+ --hash=sha256:78470906a6be5199524641f538bd2c56bb809cd4bf29a566a75051610bc982c3 \
+ --hash=sha256:7ae3e208b31be8ce7f4c2c0034f33406dd24fbce3467f77223d10cd86778471c \
+ --hash=sha256:7e4bd963a935aaf40b625c2499f3f4f6bbd0c3776f6d3bc7c853d04824ff1c9f \
+ --hash=sha256:82ae557a8c037c42a6ef26c494d0631cacca040934b101d001100ed93d43f361 \
+ --hash=sha256:82b2509f08761f29a0fdad35f7e1638b8ab1adfa2666d41b794090361fb8b855 \
+ --hash=sha256:8360f7314a070c30e4c976b183d1d8d1585a4a50c5cb603f431cebcbb4f66327 \
+ --hash=sha256:85d5f0c7771dcc7a26c7a27145059b6bb0ce06e4e751ed76cdf123d7039b60b5 \
+ --hash=sha256:88bcd4d0fe1d8ff43675360a72def210ebad3f3f72cabfeac08d825d2639b4ab \
+ --hash=sha256:9301c689051a4857d5b10777da23fafb8e8e921bcf3abe6448a058d27fb67633 \
+ --hash=sha256:951088d12d339690a92cef2ec5d3cfd957692834c72ffd570ea76a6790222777 \
+ --hash=sha256:95cf3b95ea665ab03f5a54765fa41abf0529dbaf372c3b83d91ad2cfa695779b \
+ --hash=sha256:96619302d4374de5e2345b2b622dc481257a99431277662c30f606f3e22f42be \
+ --hash=sha256:999928c6434372fde16c8f27143d3e97201160b48a614071261701615a2a156f \
+ --hash=sha256:9a60e2bf9dc6afe7f743e7c9b149d1fdd6dbf35153c78fe3a14ae1a9aee3d98b \
+ --hash=sha256:9f895d785eb6164678ff4bb5cc60c5996b3ee6df3edb28dcdeba86a13ea0465e \
+ --hash=sha256:a2a9891723a735d3e2540651184be6fd5b96880c08ffe1a98bae5017e65b544b \
+ --hash=sha256:a974231b4fdd1bb7f62064a0565a6b107d27d21d9acb50c484d2cdba515b9366 \
+ --hash=sha256:aa0fd7248cf533c259e59dc593a60973a73e881162b1a2f73360547132742823 \
+ --hash=sha256:acbfa31e315a8f14fe33e3542cbcafc55703b8f5dcbb7c1eecd30f141df50db3 \
+ --hash=sha256:afb72325b74fa7a428c009c1b8be4b4d7c2afedafb2982827ef2156646df2fe1 \
+ --hash=sha256:b3ef2c69c655db63deb96b3c3e587084612f9b1fa983df5e0c3379d41307467f \
+ --hash=sha256:b52a65e4ea43c6d149c5f8ddb0bef8d4a1e779b77591a458a893eb416624a418 \
+ --hash=sha256:b665caeeda58625c3946ad7308fbd88a086ee51ccb706307e5b1fa91556ac886 \
+ --hash=sha256:b74fdffce9dfcf2dc296dec8743e5b0332d15df19ae464f0e249aa871fc1c571 \
+ --hash=sha256:b995bfa6bf01a9e09b884077a6d37070464b529d8682d7691c2d3b540d357a0c \
+ --hash=sha256:bd82010f8ab451dabe36054a1622870166a67cf3fce894f68895db6f74bbdc94 \
+ --hash=sha256:bdcd5538e27f188dd3c804b4a8d5f52a7fc7f87e7fd6b374b8e36a4ca03db428 \
+ --hash=sha256:c79d7719d027b7a42817c5d96461a99b6a49979c143839fc37aa5748c322f234 \
+ --hash=sha256:cdab9555053399318b953a1fe1f586e945bc8d635ce9d05e617fd9fe3a4687d6 \
+ --hash=sha256:ce72dba6a20e39a0c628258b5c308779b8697f7676c254a845715e2a1039b968 \
+ --hash=sha256:d337193bbf3e45171c8025e291530fb7548a93c45253897cd764a6a71c937ed9 \
+ --hash=sha256:d3dcb774e3568477275cc76554b5a565024b8ba3a0322f77c246bc7111c5bb9c \
+ --hash=sha256:d64ba08db72e5dfd5c33be1e1e687d5e4fcce09219e8aee893a4862034081d4e \
+ --hash=sha256:d7a2e3b7f5703ffbd500dabdefcbc9eafeff4b9444bbdd5d83d79eedf8428fab \
+ --hash=sha256:d831ee0a50946d24a53821819b2327d5751b0c938b12c0653ea5be7dea9c82ec \
+ --hash=sha256:d9018153cf57fc302a2a34cb7564870b859ed9a732d16b41a9b5cb2ebed2d444 \
+ --hash=sha256:e5171ef898299c657685306d8e1478a45e9303ddcd8ac5fed5bd52ad4ae0b69b \
+ --hash=sha256:e94e98c7cb94cfa6e071d401ea3342767f28eb5a06a58fafdc0d2a4974f4f35c \
+ --hash=sha256:ec39698c45b11d9694a1b635a70946a5bad066b593af863460a8e600f0dff1ca \
+ --hash=sha256:ed9aba6e01ff6f2e8285e5aa4154e2970068fe0fc0998c4380d0e6278222269b \
+ --hash=sha256:edf71b01dec9f766fb285b73930f95f730bb0943500ba0566ae234b5c1618c18 \
+ --hash=sha256:ee82c98bed9d97cd2f53bdb035e619309a098ea53ce525833e26b93f673bc318 \
+ --hash=sha256:f4c96283fca3ee09fb044f02156d9570d156698bc3734252175a38f0e8975f07 \
+ --hash=sha256:f7d9b87c4c55e3ea8881dfcbf6d61ea6775fffed1fedffaa60bd047d3c08c430 \
+ --hash=sha256:f83df90191d67af5a831da3a33dd7628b02a95450e168785586ed51e6d28943c \
+ --hash=sha256:fca9433a45f18b7c779d2bae7beeec4f740d28b788b117a48368d95a3233ed83 \
+ --hash=sha256:fd92bbaa2ecdb7864b7600dcdb6f2f1db6e0346ed425fbd01085be04c63f0b05
+ # via uvicorn
webencodings==0.5.1 \
--hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \
--hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923
# via html5lib
+websockets==13.1 \
+ --hash=sha256:004280a140f220c812e65f36944a9ca92d766b6cc4560be652a0a3883a79ed8a \
+ --hash=sha256:035233b7531fb92a76beefcbf479504db8c72eb3bff41da55aecce3a0f729e54 \
+ --hash=sha256:149e622dc48c10ccc3d2760e5f36753db9cacf3ad7bc7bbbfd7d9c819e286f23 \
+ --hash=sha256:163e7277e1a0bd9fb3c8842a71661ad19c6aa7bb3d6678dc7f89b17fbcc4aeb7 \
+ --hash=sha256:18503d2c5f3943e93819238bf20df71982d193f73dcecd26c94514f417f6b135 \
+ --hash=sha256:1971e62d2caa443e57588e1d82d15f663b29ff9dfe7446d9964a4b6f12c1e700 \
+ --hash=sha256:204e5107f43095012b00f1451374693267adbb832d29966a01ecc4ce1db26faf \
+ --hash=sha256:2510c09d8e8df777177ee3d40cd35450dc169a81e747455cc4197e63f7e7bfe5 \
+ --hash=sha256:25c35bf84bf7c7369d247f0b8cfa157f989862c49104c5cf85cb5436a641d93e \
+ --hash=sha256:2f85cf4f2a1ba8f602298a853cec8526c2ca42a9a4b947ec236eaedb8f2dc80c \
+ --hash=sha256:308e20f22c2c77f3f39caca508e765f8725020b84aa963474e18c59accbf4c02 \
+ --hash=sha256:325b1ccdbf5e5725fdcb1b0e9ad4d2545056479d0eee392c291c1bf76206435a \
+ --hash=sha256:327b74e915cf13c5931334c61e1a41040e365d380f812513a255aa804b183418 \
+ --hash=sha256:346bee67a65f189e0e33f520f253d5147ab76ae42493804319b5716e46dddf0f \
+ --hash=sha256:38377f8b0cdeee97c552d20cf1865695fcd56aba155ad1b4ca8779a5b6ef4ac3 \
+ --hash=sha256:3c78383585f47ccb0fcf186dcb8a43f5438bd7d8f47d69e0b56f71bf431a0a68 \
+ --hash=sha256:4059f790b6ae8768471cddb65d3c4fe4792b0ab48e154c9f0a04cefaabcd5978 \
+ --hash=sha256:459bf774c754c35dbb487360b12c5727adab887f1622b8aed5755880a21c4a20 \
+ --hash=sha256:463e1c6ec853202dd3657f156123d6b4dad0c546ea2e2e38be2b3f7c5b8e7295 \
+ --hash=sha256:4676df3fe46956fbb0437d8800cd5f2b6d41143b6e7e842e60554398432cf29b \
+ --hash=sha256:485307243237328c022bc908b90e4457d0daa8b5cf4b3723fd3c4a8012fce4c6 \
+ --hash=sha256:48a2ef1381632a2f0cb4efeff34efa97901c9fbc118e01951ad7cfc10601a9bb \
+ --hash=sha256:4b889dbd1342820cc210ba44307cf75ae5f2f96226c0038094455a96e64fb07a \
+ --hash=sha256:586a356928692c1fed0eca68b4d1c2cbbd1ca2acf2ac7e7ebd3b9052582deefa \
+ --hash=sha256:58cf7e75dbf7e566088b07e36ea2e3e2bd5676e22216e4cad108d4df4a7402a0 \
+ --hash=sha256:5993260f483d05a9737073be197371940c01b257cc45ae3f1d5d7adb371b266a \
+ --hash=sha256:5dd6da9bec02735931fccec99d97c29f47cc61f644264eb995ad6c0c27667238 \
+ --hash=sha256:5f2e75431f8dc4a47f31565a6e1355fb4f2ecaa99d6b89737527ea917066e26c \
+ --hash=sha256:5f9fee94ebafbc3117c30be1844ed01a3b177bb6e39088bc6b2fa1dc15572084 \
+ --hash=sha256:61fc0dfcda609cda0fc9fe7977694c0c59cf9d749fbb17f4e9483929e3c48a19 \
+ --hash=sha256:624459daabeb310d3815b276c1adef475b3e6804abaf2d9d2c061c319f7f187d \
+ --hash=sha256:62d516c325e6540e8a57b94abefc3459d7dab8ce52ac75c96cad5549e187e3a7 \
+ --hash=sha256:6548f29b0e401eea2b967b2fdc1c7c7b5ebb3eeb470ed23a54cd45ef078a0db9 \
+ --hash=sha256:6d2aad13a200e5934f5a6767492fb07151e1de1d6079c003ab31e1823733ae79 \
+ --hash=sha256:6d6855bbe70119872c05107e38fbc7f96b1d8cb047d95c2c50869a46c65a8e96 \
+ --hash=sha256:70c5be9f416aa72aab7a2a76c90ae0a4fe2755c1816c153c1a2bcc3333ce4ce6 \
+ --hash=sha256:730f42125ccb14602f455155084f978bd9e8e57e89b569b4d7f0f0c17a448ffe \
+ --hash=sha256:7a43cfdcddd07f4ca2b1afb459824dd3c6d53a51410636a2c7fc97b9a8cf4842 \
+ --hash=sha256:7bd6abf1e070a6b72bfeb71049d6ad286852e285f146682bf30d0296f5fbadfa \
+ --hash=sha256:7c1e90228c2f5cdde263253fa5db63e6653f1c00e7ec64108065a0b9713fa1b3 \
+ --hash=sha256:7c65ffa900e7cc958cd088b9a9157a8141c991f8c53d11087e6fb7277a03f81d \
+ --hash=sha256:80c421e07973a89fbdd93e6f2003c17d20b69010458d3a8e37fb47874bd67d51 \
+ --hash=sha256:82d0ba76371769d6a4e56f7e83bb8e81846d17a6190971e38b5de108bde9b0d7 \
+ --hash=sha256:83f91d8a9bb404b8c2c41a707ac7f7f75b9442a0a876df295de27251a856ad09 \
+ --hash=sha256:87c6e35319b46b99e168eb98472d6c7d8634ee37750d7693656dc766395df096 \
+ --hash=sha256:8d23b88b9388ed85c6faf0e74d8dec4f4d3baf3ecf20a65a47b836d56260d4b9 \
+ --hash=sha256:9156c45750b37337f7b0b00e6248991a047be4aa44554c9886fe6bdd605aab3b \
+ --hash=sha256:91a0fa841646320ec0d3accdff5b757b06e2e5c86ba32af2e0815c96c7a603c5 \
+ --hash=sha256:95858ca14a9f6fa8413d29e0a585b31b278388aa775b8a81fa24830123874678 \
+ --hash=sha256:95df24ca1e1bd93bbca51d94dd049a984609687cb2fb08a7f2c56ac84e9816ea \
+ --hash=sha256:9b37c184f8b976f0c0a231a5f3d6efe10807d41ccbe4488df8c74174805eea7d \
+ --hash=sha256:9b6f347deb3dcfbfde1c20baa21c2ac0751afaa73e64e5b693bb2b848efeaa49 \
+ --hash=sha256:9d75baf00138f80b48f1eac72ad1535aac0b6461265a0bcad391fc5aba875cfc \
+ --hash=sha256:9ef8aa8bdbac47f4968a5d66462a2a0935d044bf35c0e5a8af152d58516dbeb5 \
+ --hash=sha256:a11e38ad8922c7961447f35c7b17bffa15de4d17c70abd07bfbe12d6faa3e027 \
+ --hash=sha256:a1b54689e38d1279a51d11e3467dd2f3a50f5f2e879012ce8f2d6943f00e83f0 \
+ --hash=sha256:a3b3366087c1bc0a2795111edcadddb8b3b59509d5db5d7ea3fdd69f954a8878 \
+ --hash=sha256:a569eb1b05d72f9bce2ebd28a1ce2054311b66677fcd46cf36204ad23acead8c \
+ --hash=sha256:a7affedeb43a70351bb811dadf49493c9cfd1ed94c9c70095fd177e9cc1541fa \
+ --hash=sha256:a9a396a6ad26130cdae92ae10c36af09d9bfe6cafe69670fd3b6da9b07b4044f \
+ --hash=sha256:a9ab1e71d3d2e54a0aa646ab6d4eebfaa5f416fe78dfe4da2839525dc5d765c6 \
+ --hash=sha256:a9cd1af7e18e5221d2878378fbc287a14cd527fdd5939ed56a18df8a31136bb2 \
+ --hash=sha256:a9dcaf8b0cc72a392760bb8755922c03e17a5a54e08cca58e8b74f6902b433cf \
+ --hash=sha256:b9d7439d7fab4dce00570bb906875734df13d9faa4b48e261c440a5fec6d9708 \
+ --hash=sha256:bcc03c8b72267e97b49149e4863d57c2d77f13fae12066622dc78fe322490fe6 \
+ --hash=sha256:c11d4d16e133f6df8916cc5b7e3e96ee4c44c936717d684a94f48f82edb7c92f \
+ --hash=sha256:c1dca61c6db1166c48b95198c0b7d9c990b30c756fc2923cc66f68d17dc558fd \
+ --hash=sha256:c518e84bb59c2baae725accd355c8dc517b4a3ed8db88b4bc93c78dae2974bf2 \
+ --hash=sha256:c7934fd0e920e70468e676fe7f1b7261c1efa0d6c037c6722278ca0228ad9d0d \
+ --hash=sha256:c7e72ce6bda6fb9409cc1e8164dd41d7c91466fb599eb047cfda72fe758a34a7 \
+ --hash=sha256:c90d6dec6be2c7d03378a574de87af9b1efea77d0c52a8301dd831ece938452f \
+ --hash=sha256:ceec59f59d092c5007e815def4ebb80c2de330e9588e101cf8bd94c143ec78a5 \
+ --hash=sha256:cf1781ef73c073e6b0f90af841aaf98501f975d306bbf6221683dd594ccc52b6 \
+ --hash=sha256:d04f13a1d75cb2b8382bdc16ae6fa58c97337253826dfe136195b7f89f661557 \
+ --hash=sha256:d6d300f8ec35c24025ceb9b9019ae9040c1ab2f01cddc2bcc0b518af31c75c14 \
+ --hash=sha256:d8dbb1bf0c0a4ae8b40bdc9be7f644e2f3fb4e8a9aca7145bfa510d4a374eeb7 \
+ --hash=sha256:de58647e3f9c42f13f90ac7e5f58900c80a39019848c5547bc691693098ae1bd \
+ --hash=sha256:deeb929efe52bed518f6eb2ddc00cc496366a14c726005726ad62c2dd9017a3c \
+ --hash=sha256:df01aea34b6e9e33572c35cd16bae5a47785e7d5c8cb2b54b2acdb9678315a17 \
+ --hash=sha256:e2620453c075abeb0daa949a292e19f56de518988e079c36478bacf9546ced23 \
+ --hash=sha256:e4450fc83a3df53dec45922b576e91e94f5578d06436871dce3a6be38e40f5db \
+ --hash=sha256:e54affdeb21026329fb0744ad187cf812f7d3c2aa702a5edb562b325191fcab6 \
+ --hash=sha256:e9875a0143f07d74dc5e1ded1c4581f0d9f7ab86c78994e2ed9e95050073c94d \
+ --hash=sha256:f1c3cf67185543730888b20682fb186fc8d0fa6f07ccc3ef4390831ab4b388d9 \
+ --hash=sha256:f48c749857f8fb598fb890a75f540e3221d0976ed0bf879cf3c7eef34151acee \
+ --hash=sha256:f779498eeec470295a2b1a5d97aa1bc9814ecd25e1eb637bd9d1c73a327387f6
+ # via uvicorn
wheel==0.43.0 \
--hash=sha256:465ef92c69fa5c5da2d1cf8ac40559a8c940886afcef87dcf14b9470862f1d85 \
--hash=sha256:55c570405f142630c6b9f72fe09d9b67cf1477fcf543ae5b8dcb1f5b7377da81
diff --git a/requirements.txt b/requirements.txt
index 6bdce6d..c96dae1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
#
-# This file is autogenerated by pip-compile with Python 3.11
+# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --allow-unsafe --generate-hashes --output-file=requirements.txt pyproject.toml
@@ -113,6 +113,8 @@ anyio==4.4.0 \
# via
# httpx
# openai
+ # starlette
+ # watchfiles
asgiref==3.8.1 \
--hash=sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47 \
--hash=sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590
@@ -170,10 +172,6 @@ azure-eventgrid==4.20.0 \
--hash=sha256:c1edab90769bc4e7a2fb0a2037cf0455754d50af793674c08b3fec2293248c4c \
--hash=sha256:e93c87df46bf16f38d427adf7fd1673c47066f293dfa6f3cbc19036e2b3d6af1
# via call-center-ai (pyproject.toml)
-azure-functions==1.20.0 \
- --hash=sha256:1d4ad15b10768b78046154d1da392e99634b64b4821dd091d5b9fe3600c49573 \
- --hash=sha256:437e8889d7a75379159b457589cb74f6f966d3576067ae6649fafcd9058102e1
- # via call-center-ai (pyproject.toml)
azure-identity==1.17.0 \
--hash=sha256:501d6c2cbb07826ff5e7cebc05ef319ba45612f31f0bdadca260005798e4ef16 \
--hash=sha256:a1168f223b2d7fa3968362b78affd157a1f3772f310a8cdce883cc515c6c8998
@@ -439,6 +437,10 @@ charset-normalizer==3.3.2 \
--hash=sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519 \
--hash=sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561
# via requests
+click==8.1.7 \
+ --hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
+ --hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
+ # via uvicorn
cryptography==42.0.8 \
--hash=sha256:013629ae70b40af70c9a7a5db40abe5d9054e6f4380e50ce769947b73bf3caad \
--hash=sha256:2346b911eb349ab547076f47f2e035fc8ff2c02380a7cbbf8d87114fa0f1c583 \
@@ -496,6 +498,10 @@ email-validator==2.2.0 \
--hash=sha256:561977c2d73ce3611850a06fa56b414621e0c8faa9d66f2611407d87465da631 \
--hash=sha256:cb690f344c617a714f22e66ae771445a1ceb46821152df8e165c5f9a364582b7
# via pydantic
+fastapi==0.115.0 \
+ --hash=sha256:17ea427674467486e997206a5ab25760f6b09e069f099b96f5b55a32fb6f1631 \
+ --hash=sha256:f93b4ca3529a8ebc6fc3fcf710e5efa8de3df9b41570958abf1d97d843138004
+ # via call-center-ai (pyproject.toml)
fixedint==0.1.6 \
--hash=sha256:41953193f08cbe984f584d8513c38fe5eea5fbd392257433b2210391c8a21ead \
--hash=sha256:703005d090499d41ce7ce2ee7eae8f7a5589a81acdc6b79f1728a56495f2c799 \
@@ -582,10 +588,16 @@ frozenlist==1.4.1 \
# via
# aiohttp
# aiosignal
+gunicorn==23.0.0 \
+ --hash=sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d \
+ --hash=sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec
+ # via call-center-ai (pyproject.toml)
h11==0.14.0 \
--hash=sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d \
--hash=sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761
- # via httpcore
+ # via
+ # httpcore
+ # uvicorn
html5lib==1.1 \
--hash=sha256:0d78f8fde1c230e99fe37986a60526d7049ed4bf8a9fadbad5f00e22e58e041d \
--hash=sha256:b2e5b40261e20f354d198eae92afc10d750afb487ed5e50f9c4eaf07c184146f
@@ -594,6 +606,44 @@ httpcore==1.0.5 \
--hash=sha256:34a38e2f9291467ee3b44e89dd52615370e152954ba21721378a87b2960f7a61 \
--hash=sha256:421f18bac248b25d310f3cacd198d55b8e6125c107797b609ff9b7a6ba7991b5
# via httpx
+httptools==0.6.1 \
+ --hash=sha256:00d5d4b68a717765b1fabfd9ca755bd12bf44105eeb806c03d1962acd9b8e563 \
+ --hash=sha256:0ac5a0ae3d9f4fe004318d64b8a854edd85ab76cffbf7ef5e32920faef62f142 \
+ --hash=sha256:0cf2372e98406efb42e93bfe10f2948e467edfd792b015f1b4ecd897903d3e8d \
+ --hash=sha256:1ed99a373e327f0107cb513b61820102ee4f3675656a37a50083eda05dc9541b \
+ --hash=sha256:3c3b214ce057c54675b00108ac42bacf2ab8f85c58e3f324a4e963bbc46424f4 \
+ --hash=sha256:3e802e0b2378ade99cd666b5bffb8b2a7cc8f3d28988685dc300469ea8dd86cb \
+ --hash=sha256:3f30d3ce413088a98b9db71c60a6ada2001a08945cb42dd65a9a9fe228627658 \
+ --hash=sha256:405784577ba6540fa7d6ff49e37daf104e04f4b4ff2d1ac0469eaa6a20fde084 \
+ --hash=sha256:48ed8129cd9a0d62cf4d1575fcf90fb37e3ff7d5654d3a5814eb3d55f36478c2 \
+ --hash=sha256:4bd3e488b447046e386a30f07af05f9b38d3d368d1f7b4d8f7e10af85393db97 \
+ --hash=sha256:4f0f8271c0a4db459f9dc807acd0eadd4839934a4b9b892f6f160e94da309837 \
+ --hash=sha256:5cceac09f164bcba55c0500a18fe3c47df29b62353198e4f37bbcc5d591172c3 \
+ --hash=sha256:639dc4f381a870c9ec860ce5c45921db50205a37cc3334e756269736ff0aac58 \
+ --hash=sha256:678fcbae74477a17d103b7cae78b74800d795d702083867ce160fc202104d0da \
+ --hash=sha256:6a4f5ccead6d18ec072ac0b84420e95d27c1cdf5c9f1bc8fbd8daf86bd94f43d \
+ --hash=sha256:6f58e335a1402fb5a650e271e8c2d03cfa7cea46ae124649346d17bd30d59c90 \
+ --hash=sha256:75c8022dca7935cba14741a42744eee13ba05db00b27a4b940f0d646bd4d56d0 \
+ --hash=sha256:7a7ea483c1a4485c71cb5f38be9db078f8b0e8b4c4dc0210f531cdd2ddac1ef1 \
+ --hash=sha256:7d9ceb2c957320def533671fc9c715a80c47025139c8d1f3797477decbc6edd2 \
+ --hash=sha256:7ebaec1bf683e4bf5e9fbb49b8cc36da482033596a415b3e4ebab5a4c0d7ec5e \
+ --hash=sha256:85ed077c995e942b6f1b07583e4eb0a8d324d418954fc6af913d36db7c05a5a0 \
+ --hash=sha256:8ae5b97f690badd2ca27cbf668494ee1b6d34cf1c464271ef7bfa9ca6b83ffaf \
+ --hash=sha256:8b0bb634338334385351a1600a73e558ce619af390c2b38386206ac6a27fecfc \
+ --hash=sha256:8e216a038d2d52ea13fdd9b9c9c7459fb80d78302b257828285eca1c773b99b3 \
+ --hash=sha256:93ad80d7176aa5788902f207a4e79885f0576134695dfb0fefc15b7a4648d503 \
+ --hash=sha256:95658c342529bba4e1d3d2b1a874db16c7cca435e8827422154c9da76ac4e13a \
+ --hash=sha256:95fb92dd3649f9cb139e9c56604cc2d7c7bf0fc2e7c8d7fbd58f96e35eddd2a3 \
+ --hash=sha256:97662ce7fb196c785344d00d638fc9ad69e18ee4bfb4000b35a52efe5adcc949 \
+ --hash=sha256:9bb68d3a085c2174c2477eb3ffe84ae9fb4fde8792edb7bcd09a1d8467e30a84 \
+ --hash=sha256:b512aa728bc02354e5ac086ce76c3ce635b62f5fbc32ab7082b5e582d27867bb \
+ --hash=sha256:c6e26c30455600b95d94b1b836085138e82f177351454ee841c148f93a9bad5a \
+ --hash=sha256:d2f6c3c4cb1948d912538217838f6e9960bc4a521d7f9b323b3da579cd14532f \
+ --hash=sha256:dcbab042cc3ef272adc11220517278519adf8f53fd3056d0e68f0a6f891ba94e \
+ --hash=sha256:e0b281cf5a125c35f7f6722b65d8542d2e57331be573e9e88bc8b0115c4a7a81 \
+ --hash=sha256:e57997ac7fb7ee43140cc03664de5f268813a481dff6245e0075925adc6aa185 \
+ --hash=sha256:fe467eb086d80217b7584e61313ebadc8d187a4d95bb62031b7bab4b205c3ba3
+ # via uvicorn
httpx==0.27.0 \
--hash=sha256:71d5465162c13681bff01ad59b2cc68dd838ea1f10e51574bac27103f00c91a5 \
--hash=sha256:a0cb88a46f32dc874e04ee956e4c2764aba2aa228f650b06788ba6bda2962ab5
@@ -974,7 +1024,9 @@ opentelemetry-util-http==0.46b0 \
packaging==24.1 \
--hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \
--hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124
- # via opentelemetry-instrumentation-flask
+ # via
+ # gunicorn
+ # opentelemetry-instrumentation-flask
phonenumbers==8.13.39 \
--hash=sha256:3ad2d086fa71e7eef409001b9195ac54bebb0c6e3e752209b558ca192c9229a0 \
--hash=sha256:db7ca4970d206b2056231105300753b1a5b229f43416f8c2b3010e63fbb68d77
@@ -1063,6 +1115,7 @@ pydantic[email]==2.7.4 \
--hash=sha256:ee8538d41ccb9c0a9ad3e0e5f07bf15ed8015b481ced539a1759d8cc89ae90d0
# via
# call-center-ai (pyproject.toml)
+ # fastapi
# openai
# pydantic-extra-types
# pydantic-settings
@@ -1168,6 +1221,11 @@ python-dotenv==1.0.1 \
# via
# call-center-ai (pyproject.toml)
# pydantic-settings
+ # uvicorn
+python-multipart==0.0.12 \
+ --hash=sha256:045e1f98d719c1ce085ed7f7e1ef9d8ccc8c02ba02b5566d5f7521410ced58cb \
+ --hash=sha256:43dcf96cf65888a9cd3423544dd0d75ac10f7aa0c3c28a175bbcd00c9ce1aebf
+ # via call-center-ai (pyproject.toml)
pytz==2024.1 \
--hash=sha256:2a29735ea9c18baf14b448846bde5a48030ed267578472d8955cd0e7443a9812 \
--hash=sha256:328171f4e3623139da4983451950b28e95ac706e13f3f2630a879749e7a8b319
@@ -1224,7 +1282,9 @@ pyyaml==6.0.1 \
--hash=sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585 \
--hash=sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d \
--hash=sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f
- # via call-center-ai (pyproject.toml)
+ # via
+ # call-center-ai (pyproject.toml)
+ # uvicorn
redis==5.0.6 \
--hash=sha256:38473cd7c6389ad3e44a91f4c3eaf6bcb8a9f746007f29bf4fb20824ff0b2197 \
--hash=sha256:c0d6d990850c627bbf7be01c5c4cbaadf67b48593e913bb71c9819c30df37eee
@@ -1343,6 +1403,10 @@ soupsieve==2.5 \
--hash=sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690 \
--hash=sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7
# via beautifulsoup4
+starlette==0.38.6 \
+ --hash=sha256:4517a1409e2e73ee4951214ba012052b9e16f60e90d73cfb06192c19203bbb05 \
+ --hash=sha256:863a1588f5574e70a821dadefb41e4881ea451a47a3cd1b4df359d4ffefe5ead
+ # via fastapi
tenacity==8.2.3 \
--hash=sha256:5398ef0d78e63f40007c1fb4c0bff96e1911394d2fa8d194f77619c05ff6cc8a \
--hash=sha256:ce510e327a630c9e1beaf17d42e6ffacc88185044ad85cf74c0a8887c6a0f88c
@@ -1408,6 +1472,7 @@ typing-extensions==4.12.2 \
# azure-identity
# azure-storage-queue
# call-center-ai (pyproject.toml)
+ # fastapi
# openai
# opentelemetry-sdk
# pydantic
@@ -1416,10 +1481,220 @@ urllib3==2.2.2 \
--hash=sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472 \
--hash=sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168
# via requests
+uvicorn[standard]==0.31.0 \
+ --hash=sha256:13bc21373d103859f68fe739608e2eb054a816dea79189bc3ca08ea89a275906 \
+ --hash=sha256:cac7be4dd4d891c363cd942160a7b02e69150dcbc7a36be04d5f4af4b17c8ced
+ # via call-center-ai (pyproject.toml)
+uvloop==0.20.0 \
+ --hash=sha256:265a99a2ff41a0fd56c19c3838b29bf54d1d177964c300dad388b27e84fd7847 \
+ --hash=sha256:2beee18efd33fa6fdb0976e18475a4042cd31c7433c866e8a09ab604c7c22ff2 \
+ --hash=sha256:35968fc697b0527a06e134999eef859b4034b37aebca537daeb598b9d45a137b \
+ --hash=sha256:36c530d8fa03bfa7085af54a48f2ca16ab74df3ec7108a46ba82fd8b411a2315 \
+ --hash=sha256:3a609780e942d43a275a617c0839d85f95c334bad29c4c0918252085113285b5 \
+ --hash=sha256:4603ca714a754fc8d9b197e325db25b2ea045385e8a3ad05d3463de725fdf469 \
+ --hash=sha256:4b75f2950ddb6feed85336412b9a0c310a2edbcf4cf931aa5cfe29034829676d \
+ --hash=sha256:4f44af67bf39af25db4c1ac27e82e9665717f9c26af2369c404be865c8818dcf \
+ --hash=sha256:6462c95f48e2d8d4c993a2950cd3d31ab061864d1c226bbf0ee2f1a8f36674b9 \
+ --hash=sha256:649c33034979273fa71aa25d0fe120ad1777c551d8c4cd2c0c9851d88fcb13ab \
+ --hash=sha256:746242cd703dc2b37f9d8b9f173749c15e9a918ddb021575a0205ec29a38d31e \
+ --hash=sha256:77fbc69c287596880ecec2d4c7a62346bef08b6209749bf6ce8c22bbaca0239e \
+ --hash=sha256:80dc1b139516be2077b3e57ce1cb65bfed09149e1d175e0478e7a987863b68f0 \
+ --hash=sha256:82edbfd3df39fb3d108fc079ebc461330f7c2e33dbd002d146bf7c445ba6e756 \
+ --hash=sha256:89e8d33bb88d7263f74dc57d69f0063e06b5a5ce50bb9a6b32f5fcbe655f9e73 \
+ --hash=sha256:94707205efbe809dfa3a0d09c08bef1352f5d3d6612a506f10a319933757c006 \
+ --hash=sha256:95720bae002ac357202e0d866128eb1ac82545bcf0b549b9abe91b5178d9b541 \
+ --hash=sha256:9b04d96188d365151d1af41fa2d23257b674e7ead68cfd61c725a422764062ae \
+ --hash=sha256:9d0fba61846f294bce41eb44d60d58136090ea2b5b99efd21cbdf4e21927c56a \
+ --hash=sha256:9ebafa0b96c62881d5cafa02d9da2e44c23f9f0cd829f3a32a6aff771449c996 \
+ --hash=sha256:a0fac7be202596c7126146660725157d4813aa29a4cc990fe51346f75ff8fde7 \
+ --hash=sha256:aea15c78e0d9ad6555ed201344ae36db5c63d428818b4b2a42842b3870127c00 \
+ --hash=sha256:b10c2956efcecb981bf9cfb8184d27d5d64b9033f917115a960b83f11bfa0d6b \
+ --hash=sha256:b16696f10e59d7580979b420eedf6650010a4a9c3bd8113f24a103dfdb770b10 \
+ --hash=sha256:d8c36fdf3e02cec92aed2d44f63565ad1522a499c654f07935c8f9d04db69e95 \
+ --hash=sha256:e237f9c1e8a00e7d9ddaa288e535dc337a39bcbf679f290aee9d26df9e72bce9 \
+ --hash=sha256:e50289c101495e0d1bb0bfcb4a60adde56e32f4449a67216a1ab2750aa84f037 \
+ --hash=sha256:e7d61fe8e8d9335fac1bf8d5d82820b4808dd7a43020c149b63a1ada953d48a6 \
+ --hash=sha256:e97152983442b499d7a71e44f29baa75b3b02e65d9c44ba53b10338e98dedb66 \
+ --hash=sha256:f0e94b221295b5e69de57a1bd4aeb0b3a29f61be6e1b478bb8a69a73377db7ba \
+ --hash=sha256:fee6044b64c965c425b65a4e17719953b96e065c5b7e09b599ff332bb2744bdf
+ # via uvicorn
+watchfiles==0.24.0 \
+ --hash=sha256:01550ccf1d0aed6ea375ef259706af76ad009ef5b0203a3a4cce0f6024f9b68a \
+ --hash=sha256:01def80eb62bd5db99a798d5e1f5f940ca0a05986dcfae21d833af7a46f7ee22 \
+ --hash=sha256:07cdef0c84c03375f4e24642ef8d8178e533596b229d32d2bbd69e5128ede02a \
+ --hash=sha256:083dc77dbdeef09fa44bb0f4d1df571d2e12d8a8f985dccde71ac3ac9ac067a0 \
+ --hash=sha256:1cf1f6dd7825053f3d98f6d33f6464ebdd9ee95acd74ba2c34e183086900a827 \
+ --hash=sha256:21ab23fdc1208086d99ad3f69c231ba265628014d4aed31d4e8746bd59e88cd1 \
+ --hash=sha256:2dadf8a8014fde6addfd3c379e6ed1a981c8f0a48292d662e27cabfe4239c83c \
+ --hash=sha256:2e28d91ef48eab0afb939fa446d8ebe77e2f7593f5f463fd2bb2b14132f95b6e \
+ --hash=sha256:2efec17819b0046dde35d13fb8ac7a3ad877af41ae4640f4109d9154ed30a188 \
+ --hash=sha256:30bbd525c3262fd9f4b1865cb8d88e21161366561cd7c9e1194819e0a33ea86b \
+ --hash=sha256:316449aefacf40147a9efaf3bd7c9bdd35aaba9ac5d708bd1eb5763c9a02bef5 \
+ --hash=sha256:327763da824817b38ad125dcd97595f942d720d32d879f6c4ddf843e3da3fe90 \
+ --hash=sha256:32aa53a9a63b7f01ed32e316e354e81e9da0e6267435c7243bf8ae0f10b428ef \
+ --hash=sha256:34e19e56d68b0dad5cff62273107cf5d9fbaf9d75c46277aa5d803b3ef8a9e9b \
+ --hash=sha256:3770e260b18e7f4e576edca4c0a639f704088602e0bc921c5c2e721e3acb8d15 \
+ --hash=sha256:3d2e3ab79a1771c530233cadfd277fcc762656d50836c77abb2e5e72b88e3a48 \
+ --hash=sha256:41face41f036fee09eba33a5b53a73e9a43d5cb2c53dad8e61fa6c9f91b5a51e \
+ --hash=sha256:43e3e37c15a8b6fe00c1bce2473cfa8eb3484bbeecf3aefbf259227e487a03df \
+ --hash=sha256:449f43f49c8ddca87c6b3980c9284cab6bd1f5c9d9a2b00012adaaccd5e7decd \
+ --hash=sha256:4933a508d2f78099162da473841c652ad0de892719043d3f07cc83b33dfd9d91 \
+ --hash=sha256:49d617df841a63b4445790a254013aea2120357ccacbed00253f9c2b5dc24e2d \
+ --hash=sha256:49fb58bcaa343fedc6a9e91f90195b20ccb3135447dc9e4e2570c3a39565853e \
+ --hash=sha256:4a7fa2bc0efef3e209a8199fd111b8969fe9db9c711acc46636686331eda7dd4 \
+ --hash=sha256:4abf4ad269856618f82dee296ac66b0cd1d71450fc3c98532d93798e73399b7a \
+ --hash=sha256:4b8693502d1967b00f2fb82fc1e744df128ba22f530e15b763c8d82baee15370 \
+ --hash=sha256:4d28cea3c976499475f5b7a2fec6b3a36208656963c1a856d328aeae056fc5c1 \
+ --hash=sha256:5148c2f1ea043db13ce9b0c28456e18ecc8f14f41325aa624314095b6aa2e9ea \
+ --hash=sha256:54ca90a9ae6597ae6dc00e7ed0a040ef723f84ec517d3e7ce13e63e4bc82fa04 \
+ --hash=sha256:551ec3ee2a3ac9cbcf48a4ec76e42c2ef938a7e905a35b42a1267fa4b1645896 \
+ --hash=sha256:5c51749f3e4e269231510da426ce4a44beb98db2dce9097225c338f815b05d4f \
+ --hash=sha256:632676574429bee8c26be8af52af20e0c718cc7f5f67f3fb658c71928ccd4f7f \
+ --hash=sha256:6509ed3f467b79d95fc62a98229f79b1a60d1b93f101e1c61d10c95a46a84f43 \
+ --hash=sha256:6bdcfa3cd6fdbdd1a068a52820f46a815401cbc2cb187dd006cb076675e7b735 \
+ --hash=sha256:7138eff8baa883aeaa074359daabb8b6c1e73ffe69d5accdc907d62e50b1c0da \
+ --hash=sha256:7211b463695d1e995ca3feb38b69227e46dbd03947172585ecb0588f19b0d87a \
+ --hash=sha256:73bde715f940bea845a95247ea3e5eb17769ba1010efdc938ffcb967c634fa61 \
+ --hash=sha256:78470906a6be5199524641f538bd2c56bb809cd4bf29a566a75051610bc982c3 \
+ --hash=sha256:7ae3e208b31be8ce7f4c2c0034f33406dd24fbce3467f77223d10cd86778471c \
+ --hash=sha256:7e4bd963a935aaf40b625c2499f3f4f6bbd0c3776f6d3bc7c853d04824ff1c9f \
+ --hash=sha256:82ae557a8c037c42a6ef26c494d0631cacca040934b101d001100ed93d43f361 \
+ --hash=sha256:82b2509f08761f29a0fdad35f7e1638b8ab1adfa2666d41b794090361fb8b855 \
+ --hash=sha256:8360f7314a070c30e4c976b183d1d8d1585a4a50c5cb603f431cebcbb4f66327 \
+ --hash=sha256:85d5f0c7771dcc7a26c7a27145059b6bb0ce06e4e751ed76cdf123d7039b60b5 \
+ --hash=sha256:88bcd4d0fe1d8ff43675360a72def210ebad3f3f72cabfeac08d825d2639b4ab \
+ --hash=sha256:9301c689051a4857d5b10777da23fafb8e8e921bcf3abe6448a058d27fb67633 \
+ --hash=sha256:951088d12d339690a92cef2ec5d3cfd957692834c72ffd570ea76a6790222777 \
+ --hash=sha256:95cf3b95ea665ab03f5a54765fa41abf0529dbaf372c3b83d91ad2cfa695779b \
+ --hash=sha256:96619302d4374de5e2345b2b622dc481257a99431277662c30f606f3e22f42be \
+ --hash=sha256:999928c6434372fde16c8f27143d3e97201160b48a614071261701615a2a156f \
+ --hash=sha256:9a60e2bf9dc6afe7f743e7c9b149d1fdd6dbf35153c78fe3a14ae1a9aee3d98b \
+ --hash=sha256:9f895d785eb6164678ff4bb5cc60c5996b3ee6df3edb28dcdeba86a13ea0465e \
+ --hash=sha256:a2a9891723a735d3e2540651184be6fd5b96880c08ffe1a98bae5017e65b544b \
+ --hash=sha256:a974231b4fdd1bb7f62064a0565a6b107d27d21d9acb50c484d2cdba515b9366 \
+ --hash=sha256:aa0fd7248cf533c259e59dc593a60973a73e881162b1a2f73360547132742823 \
+ --hash=sha256:acbfa31e315a8f14fe33e3542cbcafc55703b8f5dcbb7c1eecd30f141df50db3 \
+ --hash=sha256:afb72325b74fa7a428c009c1b8be4b4d7c2afedafb2982827ef2156646df2fe1 \
+ --hash=sha256:b3ef2c69c655db63deb96b3c3e587084612f9b1fa983df5e0c3379d41307467f \
+ --hash=sha256:b52a65e4ea43c6d149c5f8ddb0bef8d4a1e779b77591a458a893eb416624a418 \
+ --hash=sha256:b665caeeda58625c3946ad7308fbd88a086ee51ccb706307e5b1fa91556ac886 \
+ --hash=sha256:b74fdffce9dfcf2dc296dec8743e5b0332d15df19ae464f0e249aa871fc1c571 \
+ --hash=sha256:b995bfa6bf01a9e09b884077a6d37070464b529d8682d7691c2d3b540d357a0c \
+ --hash=sha256:bd82010f8ab451dabe36054a1622870166a67cf3fce894f68895db6f74bbdc94 \
+ --hash=sha256:bdcd5538e27f188dd3c804b4a8d5f52a7fc7f87e7fd6b374b8e36a4ca03db428 \
+ --hash=sha256:c79d7719d027b7a42817c5d96461a99b6a49979c143839fc37aa5748c322f234 \
+ --hash=sha256:cdab9555053399318b953a1fe1f586e945bc8d635ce9d05e617fd9fe3a4687d6 \
+ --hash=sha256:ce72dba6a20e39a0c628258b5c308779b8697f7676c254a845715e2a1039b968 \
+ --hash=sha256:d337193bbf3e45171c8025e291530fb7548a93c45253897cd764a6a71c937ed9 \
+ --hash=sha256:d3dcb774e3568477275cc76554b5a565024b8ba3a0322f77c246bc7111c5bb9c \
+ --hash=sha256:d64ba08db72e5dfd5c33be1e1e687d5e4fcce09219e8aee893a4862034081d4e \
+ --hash=sha256:d7a2e3b7f5703ffbd500dabdefcbc9eafeff4b9444bbdd5d83d79eedf8428fab \
+ --hash=sha256:d831ee0a50946d24a53821819b2327d5751b0c938b12c0653ea5be7dea9c82ec \
+ --hash=sha256:d9018153cf57fc302a2a34cb7564870b859ed9a732d16b41a9b5cb2ebed2d444 \
+ --hash=sha256:e5171ef898299c657685306d8e1478a45e9303ddcd8ac5fed5bd52ad4ae0b69b \
+ --hash=sha256:e94e98c7cb94cfa6e071d401ea3342767f28eb5a06a58fafdc0d2a4974f4f35c \
+ --hash=sha256:ec39698c45b11d9694a1b635a70946a5bad066b593af863460a8e600f0dff1ca \
+ --hash=sha256:ed9aba6e01ff6f2e8285e5aa4154e2970068fe0fc0998c4380d0e6278222269b \
+ --hash=sha256:edf71b01dec9f766fb285b73930f95f730bb0943500ba0566ae234b5c1618c18 \
+ --hash=sha256:ee82c98bed9d97cd2f53bdb035e619309a098ea53ce525833e26b93f673bc318 \
+ --hash=sha256:f4c96283fca3ee09fb044f02156d9570d156698bc3734252175a38f0e8975f07 \
+ --hash=sha256:f7d9b87c4c55e3ea8881dfcbf6d61ea6775fffed1fedffaa60bd047d3c08c430 \
+ --hash=sha256:f83df90191d67af5a831da3a33dd7628b02a95450e168785586ed51e6d28943c \
+ --hash=sha256:fca9433a45f18b7c779d2bae7beeec4f740d28b788b117a48368d95a3233ed83 \
+ --hash=sha256:fd92bbaa2ecdb7864b7600dcdb6f2f1db6e0346ed425fbd01085be04c63f0b05
+ # via uvicorn
webencodings==0.5.1 \
--hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \
--hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923
# via html5lib
+websockets==13.1 \
+ --hash=sha256:004280a140f220c812e65f36944a9ca92d766b6cc4560be652a0a3883a79ed8a \
+ --hash=sha256:035233b7531fb92a76beefcbf479504db8c72eb3bff41da55aecce3a0f729e54 \
+ --hash=sha256:149e622dc48c10ccc3d2760e5f36753db9cacf3ad7bc7bbbfd7d9c819e286f23 \
+ --hash=sha256:163e7277e1a0bd9fb3c8842a71661ad19c6aa7bb3d6678dc7f89b17fbcc4aeb7 \
+ --hash=sha256:18503d2c5f3943e93819238bf20df71982d193f73dcecd26c94514f417f6b135 \
+ --hash=sha256:1971e62d2caa443e57588e1d82d15f663b29ff9dfe7446d9964a4b6f12c1e700 \
+ --hash=sha256:204e5107f43095012b00f1451374693267adbb832d29966a01ecc4ce1db26faf \
+ --hash=sha256:2510c09d8e8df777177ee3d40cd35450dc169a81e747455cc4197e63f7e7bfe5 \
+ --hash=sha256:25c35bf84bf7c7369d247f0b8cfa157f989862c49104c5cf85cb5436a641d93e \
+ --hash=sha256:2f85cf4f2a1ba8f602298a853cec8526c2ca42a9a4b947ec236eaedb8f2dc80c \
+ --hash=sha256:308e20f22c2c77f3f39caca508e765f8725020b84aa963474e18c59accbf4c02 \
+ --hash=sha256:325b1ccdbf5e5725fdcb1b0e9ad4d2545056479d0eee392c291c1bf76206435a \
+ --hash=sha256:327b74e915cf13c5931334c61e1a41040e365d380f812513a255aa804b183418 \
+ --hash=sha256:346bee67a65f189e0e33f520f253d5147ab76ae42493804319b5716e46dddf0f \
+ --hash=sha256:38377f8b0cdeee97c552d20cf1865695fcd56aba155ad1b4ca8779a5b6ef4ac3 \
+ --hash=sha256:3c78383585f47ccb0fcf186dcb8a43f5438bd7d8f47d69e0b56f71bf431a0a68 \
+ --hash=sha256:4059f790b6ae8768471cddb65d3c4fe4792b0ab48e154c9f0a04cefaabcd5978 \
+ --hash=sha256:459bf774c754c35dbb487360b12c5727adab887f1622b8aed5755880a21c4a20 \
+ --hash=sha256:463e1c6ec853202dd3657f156123d6b4dad0c546ea2e2e38be2b3f7c5b8e7295 \
+ --hash=sha256:4676df3fe46956fbb0437d8800cd5f2b6d41143b6e7e842e60554398432cf29b \
+ --hash=sha256:485307243237328c022bc908b90e4457d0daa8b5cf4b3723fd3c4a8012fce4c6 \
+ --hash=sha256:48a2ef1381632a2f0cb4efeff34efa97901c9fbc118e01951ad7cfc10601a9bb \
+ --hash=sha256:4b889dbd1342820cc210ba44307cf75ae5f2f96226c0038094455a96e64fb07a \
+ --hash=sha256:586a356928692c1fed0eca68b4d1c2cbbd1ca2acf2ac7e7ebd3b9052582deefa \
+ --hash=sha256:58cf7e75dbf7e566088b07e36ea2e3e2bd5676e22216e4cad108d4df4a7402a0 \
+ --hash=sha256:5993260f483d05a9737073be197371940c01b257cc45ae3f1d5d7adb371b266a \
+ --hash=sha256:5dd6da9bec02735931fccec99d97c29f47cc61f644264eb995ad6c0c27667238 \
+ --hash=sha256:5f2e75431f8dc4a47f31565a6e1355fb4f2ecaa99d6b89737527ea917066e26c \
+ --hash=sha256:5f9fee94ebafbc3117c30be1844ed01a3b177bb6e39088bc6b2fa1dc15572084 \
+ --hash=sha256:61fc0dfcda609cda0fc9fe7977694c0c59cf9d749fbb17f4e9483929e3c48a19 \
+ --hash=sha256:624459daabeb310d3815b276c1adef475b3e6804abaf2d9d2c061c319f7f187d \
+ --hash=sha256:62d516c325e6540e8a57b94abefc3459d7dab8ce52ac75c96cad5549e187e3a7 \
+ --hash=sha256:6548f29b0e401eea2b967b2fdc1c7c7b5ebb3eeb470ed23a54cd45ef078a0db9 \
+ --hash=sha256:6d2aad13a200e5934f5a6767492fb07151e1de1d6079c003ab31e1823733ae79 \
+ --hash=sha256:6d6855bbe70119872c05107e38fbc7f96b1d8cb047d95c2c50869a46c65a8e96 \
+ --hash=sha256:70c5be9f416aa72aab7a2a76c90ae0a4fe2755c1816c153c1a2bcc3333ce4ce6 \
+ --hash=sha256:730f42125ccb14602f455155084f978bd9e8e57e89b569b4d7f0f0c17a448ffe \
+ --hash=sha256:7a43cfdcddd07f4ca2b1afb459824dd3c6d53a51410636a2c7fc97b9a8cf4842 \
+ --hash=sha256:7bd6abf1e070a6b72bfeb71049d6ad286852e285f146682bf30d0296f5fbadfa \
+ --hash=sha256:7c1e90228c2f5cdde263253fa5db63e6653f1c00e7ec64108065a0b9713fa1b3 \
+ --hash=sha256:7c65ffa900e7cc958cd088b9a9157a8141c991f8c53d11087e6fb7277a03f81d \
+ --hash=sha256:80c421e07973a89fbdd93e6f2003c17d20b69010458d3a8e37fb47874bd67d51 \
+ --hash=sha256:82d0ba76371769d6a4e56f7e83bb8e81846d17a6190971e38b5de108bde9b0d7 \
+ --hash=sha256:83f91d8a9bb404b8c2c41a707ac7f7f75b9442a0a876df295de27251a856ad09 \
+ --hash=sha256:87c6e35319b46b99e168eb98472d6c7d8634ee37750d7693656dc766395df096 \
+ --hash=sha256:8d23b88b9388ed85c6faf0e74d8dec4f4d3baf3ecf20a65a47b836d56260d4b9 \
+ --hash=sha256:9156c45750b37337f7b0b00e6248991a047be4aa44554c9886fe6bdd605aab3b \
+ --hash=sha256:91a0fa841646320ec0d3accdff5b757b06e2e5c86ba32af2e0815c96c7a603c5 \
+ --hash=sha256:95858ca14a9f6fa8413d29e0a585b31b278388aa775b8a81fa24830123874678 \
+ --hash=sha256:95df24ca1e1bd93bbca51d94dd049a984609687cb2fb08a7f2c56ac84e9816ea \
+ --hash=sha256:9b37c184f8b976f0c0a231a5f3d6efe10807d41ccbe4488df8c74174805eea7d \
+ --hash=sha256:9b6f347deb3dcfbfde1c20baa21c2ac0751afaa73e64e5b693bb2b848efeaa49 \
+ --hash=sha256:9d75baf00138f80b48f1eac72ad1535aac0b6461265a0bcad391fc5aba875cfc \
+ --hash=sha256:9ef8aa8bdbac47f4968a5d66462a2a0935d044bf35c0e5a8af152d58516dbeb5 \
+ --hash=sha256:a11e38ad8922c7961447f35c7b17bffa15de4d17c70abd07bfbe12d6faa3e027 \
+ --hash=sha256:a1b54689e38d1279a51d11e3467dd2f3a50f5f2e879012ce8f2d6943f00e83f0 \
+ --hash=sha256:a3b3366087c1bc0a2795111edcadddb8b3b59509d5db5d7ea3fdd69f954a8878 \
+ --hash=sha256:a569eb1b05d72f9bce2ebd28a1ce2054311b66677fcd46cf36204ad23acead8c \
+ --hash=sha256:a7affedeb43a70351bb811dadf49493c9cfd1ed94c9c70095fd177e9cc1541fa \
+ --hash=sha256:a9a396a6ad26130cdae92ae10c36af09d9bfe6cafe69670fd3b6da9b07b4044f \
+ --hash=sha256:a9ab1e71d3d2e54a0aa646ab6d4eebfaa5f416fe78dfe4da2839525dc5d765c6 \
+ --hash=sha256:a9cd1af7e18e5221d2878378fbc287a14cd527fdd5939ed56a18df8a31136bb2 \
+ --hash=sha256:a9dcaf8b0cc72a392760bb8755922c03e17a5a54e08cca58e8b74f6902b433cf \
+ --hash=sha256:b9d7439d7fab4dce00570bb906875734df13d9faa4b48e261c440a5fec6d9708 \
+ --hash=sha256:bcc03c8b72267e97b49149e4863d57c2d77f13fae12066622dc78fe322490fe6 \
+ --hash=sha256:c11d4d16e133f6df8916cc5b7e3e96ee4c44c936717d684a94f48f82edb7c92f \
+ --hash=sha256:c1dca61c6db1166c48b95198c0b7d9c990b30c756fc2923cc66f68d17dc558fd \
+ --hash=sha256:c518e84bb59c2baae725accd355c8dc517b4a3ed8db88b4bc93c78dae2974bf2 \
+ --hash=sha256:c7934fd0e920e70468e676fe7f1b7261c1efa0d6c037c6722278ca0228ad9d0d \
+ --hash=sha256:c7e72ce6bda6fb9409cc1e8164dd41d7c91466fb599eb047cfda72fe758a34a7 \
+ --hash=sha256:c90d6dec6be2c7d03378a574de87af9b1efea77d0c52a8301dd831ece938452f \
+ --hash=sha256:ceec59f59d092c5007e815def4ebb80c2de330e9588e101cf8bd94c143ec78a5 \
+ --hash=sha256:cf1781ef73c073e6b0f90af841aaf98501f975d306bbf6221683dd594ccc52b6 \
+ --hash=sha256:d04f13a1d75cb2b8382bdc16ae6fa58c97337253826dfe136195b7f89f661557 \
+ --hash=sha256:d6d300f8ec35c24025ceb9b9019ae9040c1ab2f01cddc2bcc0b518af31c75c14 \
+ --hash=sha256:d8dbb1bf0c0a4ae8b40bdc9be7f644e2f3fb4e8a9aca7145bfa510d4a374eeb7 \
+ --hash=sha256:de58647e3f9c42f13f90ac7e5f58900c80a39019848c5547bc691693098ae1bd \
+ --hash=sha256:deeb929efe52bed518f6eb2ddc00cc496366a14c726005726ad62c2dd9017a3c \
+ --hash=sha256:df01aea34b6e9e33572c35cd16bae5a47785e7d5c8cb2b54b2acdb9678315a17 \
+ --hash=sha256:e2620453c075abeb0daa949a292e19f56de518988e079c36478bacf9546ced23 \
+ --hash=sha256:e4450fc83a3df53dec45922b576e91e94f5578d06436871dce3a6be38e40f5db \
+ --hash=sha256:e54affdeb21026329fb0744ad187cf812f7d3c2aa702a5edb562b325191fcab6 \
+ --hash=sha256:e9875a0143f07d74dc5e1ded1c4581f0d9f7ab86c78994e2ed9e95050073c94d \
+ --hash=sha256:f1c3cf67185543730888b20682fb186fc8d0fa6f07ccc3ef4390831ab4b388d9 \
+ --hash=sha256:f48c749857f8fb598fb890a75f540e3221d0976ed0bf879cf3c7eef34151acee \
+ --hash=sha256:f779498eeec470295a2b1a5d97aa1bc9814ecd25e1eb637bd9d1c73a327387f6
+ # via uvicorn
wrapt==1.16.0 \
--hash=sha256:0d2691979e93d06a95a26257adb7bfd0c93818e89b1406f5a28f36e0d8c1e1fc \
--hash=sha256:14d7dc606219cdd7405133c713f2c218d4252f2a469003f8c46bb92d5d095d81 \
diff --git a/resources/openapi.json b/resources/openapi.json
deleted file mode 100644
index f74c5f5..0000000
--- a/resources/openapi.json
+++ /dev/null
@@ -1,1038 +0,0 @@
-{
- "openapi": "3.0.2",
- "info": {
- "title": "Call Center AI",
- "description": "AI-powered call center solution with Azure and OpenAI GPT.",
- "contact": {
- "name": "GitHub",
- "url": "https://github.com/microsoft/call-center-ai/issues"
- },
- "license": {
- "name": "Apache 2.0",
- "url": "https://www.apache.org/licenses/LICENSE-2.0"
- }
- },
- "paths": {
- "/health/liveness": {
- "get": {
- "tags": [
- "health"
- ],
- "responses": {
- "204": {
- "content": {
- "text/plain": {}
- }
- }
- },
- "summary": "Get the liveness status of the server."
- }
- },
- "/health/readiness": {
- "get": {
- "tags": [
- "health"
- ],
- "responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ReadinessModel"
- }
- }
- }
- },
- "503": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ReadinessModel"
- }
- }
- }
- }
- },
- "summary": "Get the liveness readiness of the server.",
- "description": "Status will be \"ok\" if and only if all indicators (storage, database, cache, sms, ...) are ready. Functional testing is applied on all dependencies (transaction, health, ...)."
- }
- },
- "/report": {
- "get": {
- "tags": [
- "ui"
- ],
- "responses": {
- "200": {
- "content": {
- "text/html": {}
- }
- },
- "400": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- }
- },
- "summary": "Web interface to list calls."
- },
- "parameters": [
- {
- "name": "phone_number",
- "description": "Phone number in a E164 format.",
- "schema": {
- "type": "string"
- },
- "in": "query"
- }
- ]
- },
- "/report/{call_id}": {
- "get": {
- "tags": [
- "ui"
- ],
- "responses": {
- "200": {
- "content": {
- "text/html": {}
- }
- },
- "400": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- },
- "404": {
- "content": {
- "text/plain": {}
- }
- }
- },
- "summary": "Web interface to details a single call."
- },
- "parameters": [
- {
- "examples": {
- "UUID": {
- "value": "74e74ad0-c9ca-41c4-8b53-ff17f40e3a95"
- }
- },
- "name": "call_id",
- "description": "UUID of the object.",
- "schema": {
- "type": "string"
- },
- "in": "path",
- "required": true
- }
- ]
- },
- "/call/{call_id}": {
- "get": {
- "responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/CallGetModel"
- }
- }
- }
- },
- "400": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- },
- "404": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- }
- },
- "summary": "Get a single call object.",
- "description": "Returns a single call object."
- },
- "parameters": [
- {
- "examples": {
- "UUID": {
- "value": "74e74ad0-c9ca-41c4-8b53-ff17f40e3a95"
- }
- },
- "name": "call_id",
- "description": "UUID of the object.",
- "schema": {
- "type": "string"
- },
- "in": "path",
- "required": true
- }
- ]
- },
- "/call/{phone_number}": {
- "get": {
- "responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/CallGetModel"
- }
- }
- }
- },
- "400": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- },
- "404": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- }
- },
- "summary": "Get a single call object.",
- "description": "Match the most recent one for a given phone number."
- },
- "parameters": [
- {
- "examples": {
- "French phone number": {
- "value": "+337755194077"
- }
- },
- "name": "phone_number",
- "description": "Phone number in a E164 format.",
- "schema": {
- "type": "string"
- },
- "in": "path",
- "required": true
- }
- ]
- },
- "/call": {
- "get": {
- "parameters": [
- {
- "examples": {
- "French phone number": {
- "value": "+337755194077"
- }
- },
- "name": "phone_number",
- "description": "Phone number in a E164 format.",
- "schema": {
- "type": "string"
- },
- "in": "query"
- }
- ],
- "responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/CallGetModel"
- }
- }
- }
- }
- },
- "400": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- },
- "404": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- }
- },
- "summary": "List call objects."
- },
- "post": {
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/CallInitiateModel"
- }
- }
- },
- "required": true
- },
- "responses": {
- "201": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/CallGetModel"
- }
- }
- }
- },
- "400": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- }
- },
- "summary": "Initiate a new outbound call."
- }
- },
- "/communicationservices/event/{call_id}/{secret}": {
- "post": {
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "required": true
- },
- "tags": [
- "event"
- ],
- "responses": {
- "204": {
- "content": {
- "text/plain": {}
- }
- },
- "400": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- },
- "401": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- }
- },
- "security": [
- {
- "AzureCommunicationServicesManaged": []
- },
- {
- "CallbackCallSecret": []
- }
- ],
- "summary": "Callback for Azure Communication Services events."
- },
- "parameters": [
- {
- "examples": {
- "UUID": {
- "value": "74e74ad0-c9ca-41c4-8b53-ff17f40e3a95"
- }
- },
- "name": "call_id",
- "description": "UUID of the object.",
- "schema": {
- "type": "string"
- },
- "in": "path",
- "required": true
- },
- {
- "examples": {
- "Random text": {
- "value": "6sDawCHPf27fDNA2"
- }
- },
- "name": "secret",
- "description": "Secret string for authorization.",
- "schema": {
- "type": "string"
- },
- "in": "path",
- "required": true
- }
- ]
- },
- "/twilio/sms": {
- "post": {
- "requestBody": {
- "content": {
- "multipart/form-data": {
- "schema": {
- "$ref": "#/components/schemas/TwilioSmsModel"
- }
- }
- },
- "required": true
- },
- "tags": [
- "event"
- ],
- "responses": {
- "200": {
- "content": {
- "text/xml": {}
- }
- },
- "400": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorModel"
- }
- }
- }
- }
- }
- }
- }
- },
- "components": {
- "schemas": {
- "ReadinessModel": {
- "description": "",
- "required": [
- "status",
- "checks"
- ],
- "type": "object",
- "properties": {
- "status": {
- "description": "",
- "enum": [
- "fail",
- "ok"
- ],
- "type": "string",
- "example": ""
- },
- "checks": {
- "$ref": "#/components/schemas/ReadinessCheckModel",
- "description": ""
- }
- }
- },
- "ReadinessCheckModel": {
- "description": "",
- "required": [
- "id",
- "status"
- ],
- "type": "object",
- "properties": {
- "id": {
- "description": "",
- "type": "string",
- "example": "cache"
- },
- "status": {
- "description": "",
- "enum": [
- "fail",
- "ok"
- ],
- "type": "string",
- "example": ""
- }
- }
- },
- "CallGetModel": {
- "title": "Root Type for CallGetModel",
- "description": "",
- "required": [
- "claim",
- "call_id",
- "created_at",
- "in_progress",
- "initiate",
- "messages",
- "recognition_retry",
- "reminders"
- ],
- "type": "object",
- "properties": {
- "call_id": {
- "type": "string",
- "example": "00dfb3c4-9795-4c55-b387-6c65917a4584"
- },
- "created_at": {
- "format": "date-time",
- "type": "string"
- },
- "initiate": {
- "$ref": "#/components/schemas/CallInitiateModel",
- "properties": {
- "agent_phone_number": {
- "type": "string"
- },
- "bot_company": {
- "type": "string"
- },
- "bot_name": {
- "type": "string"
- },
- "claim": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "description": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "type": {
- "type": "string"
- }
- }
- }
- },
- "lang": {
- "type": "object",
- "properties": {
- "default_short_code": {
- "type": "string"
- },
- "availables": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "pronunciations_en": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "short_code": {
- "type": "string"
- },
- "voice": {
- "type": "string"
- }
- }
- }
- }
- }
- },
- "prosody_rate": {
- "format": "int32",
- "type": "integer"
- },
- "task": {
- "type": "string"
- },
- "phone_number": {
- "type": "string"
- }
- }
- },
- "claim": {
- "type": "string",
- "example": "{\n \"incident_datetime\": \"2024-07-23T00:00:00\",\n \"incident_description\": \"Vol de trottinette Xiaomi 4 Ultra garée dans le parking à vélo, en bas du bâtiment, dans un espace public.\",\n \"incident_location\": \"Place de l'Étoile, Montrouge\",\n \"policyholder_name\": \"Clémence Lesné\"\n}"
- },
- "messages": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/MessageModel"
- }
- },
- "next": {
- "$ref": "#/components/schemas/NextModel",
- "properties": {
- "action": {
- "type": "string"
- },
- "justification": {
- "type": "string"
- }
- }
- },
- "reminders": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ReminderModel"
- }
- },
- "synthesis": {
- "$ref": "#/components/schemas/SynthesisModel",
- "properties": {
- "long": {
- "type": "string"
- },
- "satisfaction": {
- "type": "string"
- },
- "short": {
- "type": "string"
- },
- "improvement_suggestions": {
- "type": "string"
- }
- }
- },
- "recognition_retry": {
- "format": "int32",
- "minimum": 0,
- "type": "integer",
- "example": "0"
- },
- "in_progress": {
- "type": "boolean"
- }
- }
- },
- "CallInitiateModel": {
- "title": "Root Type for CallInitiateModel",
- "description": "",
- "required": [
- "phone_number"
- ],
- "type": "object",
- "properties": {
- "agent_phone_number": {
- "type": "string"
- },
- "bot_company": {
- "type": "string"
- },
- "bot_name": {
- "type": "string"
- },
- "claim": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ClaimFieldModel"
- }
- },
- "lang": {
- "$ref": "#/components/schemas/LanguageModel",
- "properties": {
- "default_short_code": {
- "type": "string"
- },
- "availables": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "pronunciations_en": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "short_code": {
- "type": "string"
- },
- "voice": {
- "type": "string"
- }
- }
- }
- }
- }
- },
- "prosody_rate": {
- "format": "int32",
- "maximum": 1.25,
- "minimum": 0.75,
- "type": "integer",
- "example": "1.0"
- },
- "task": {
- "type": "string",
- "example": "Helping the customer to file an insurance claim. The customer is probably calling because they have a problem with something covered by their policy, but it's not certain. The assistant needs information from the customer to complete the claim. The conversation is over when all the data relevant to the case has been collected. Filling in as much information as possible is important for further processing."
- },
- "phone_number": {
- "description": "Phone number in a E164 format.",
- "pattern": "^\\+[1-9]\\d{1,14}$",
- "type": "string",
- "example": "+336579996809"
- }
- }
- },
- "ClaimFieldModel": {
- "title": "Root Type for ClaimFieldModel",
- "description": "",
- "required": [
- "type",
- "name",
- "description"
- ],
- "type": "object",
- "properties": {
- "description": {
- "type": "string",
- "example": "Date and time of the incident."
- },
- "name": {
- "type": "string",
- "example": "incident_datetime"
- },
- "type": {
- "description": "",
- "enum": [
- "datetime",
- "email",
- "phone_number",
- "text"
- ],
- "type": "string"
- }
- }
- },
- "MessageModel": {
- "title": "Root Type for MessageModel",
- "description": "",
- "required": [
- "action",
- "content",
- "created_at",
- "persona",
- "style",
- "tool_calls"
- ],
- "type": "object",
- "properties": {
- "created_at": {
- "format": "date-time",
- "type": "string"
- },
- "content": {
- "type": "string",
- "example": "Thank you, Clémence. I'm now going to update your file with your name and the scooter reference. I'm updating the file with your name. The scooter reference is now saved."
- },
- "persona": {
- "enum": [
- "assistant",
- "human",
- "tool"
- ],
- "type": "string"
- },
- "style": {
- "enum": [
- "cheerful",
- "none",
- "sad"
- ],
- "type": "string"
- },
- "tool_calls": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ToolModel"
- }
- },
- "action": {
- "description": "",
- "enum": [
- "call",
- "hangup",
- "sms",
- "talk"
- ],
- "type": "string"
- }
- }
- },
- "ToolModel": {
- "title": "Root Type for ToolModel",
- "description": "",
- "required": [
- "content",
- "function_arguments",
- "function_name",
- "tool_id"
- ],
- "type": "object",
- "properties": {
- "content": {
- "type": "string",
- "example": "# Updated fields\\n- Updated claim field \\\"policyholder_name\\\" with value \\\"Clémence Lesne\\\"."
- },
- "function_arguments": {
- "type": "string",
- "example": "{\\\"customer_response\\\": \\\"Je mets à jour le dossier avec votre nom.\\\", \\\"updates\\\": [{\\\"field\\\": \\\"policyholder_name\\\", \\\"value\\\": \\\"Clémence Lesne\\\"}]}"
- },
- "function_name": {
- "type": "string",
- "example": "updated_claim"
- },
- "tool_id": {
- "type": "string",
- "example": "call_7f56XNaBEsfn4uesZaQ6PMFp"
- }
- }
- },
- "NextModel": {
- "title": "Root Type for NextModel",
- "description": "",
- "required": [
- "action",
- "justification"
- ],
- "type": "object",
- "properties": {
- "action": {
- "enum": [
- "case_closed",
- "commercial_offer",
- "customer_will_send_info",
- "high_priority",
- "propose_new_contract",
- "requires_expertise"
- ],
- "type": "string"
- },
- "justification": {
- "type": "string",
- "example": "All necessary information for the claim has been collected and the customer has been informed that their case has been updated. The customer did not express any further concerns or questions."
- }
- }
- },
- "ReminderModel": {
- "description": "",
- "required": [
- "created_at",
- "description",
- "due_date_time",
- "title"
- ],
- "type": "object",
- "properties": {
- "created_at": {
- "format": "date-time",
- "description": "",
- "type": "string"
- },
- "description": {
- "description": "",
- "type": "string"
- },
- "due_date_time": {
- "format": "date-time",
- "description": "",
- "type": "string"
- },
- "owner": {
- "description": "",
- "type": "string"
- },
- "title": {
- "description": "",
- "type": "string"
- }
- }
- },
- "SynthesisModel": {
- "title": "Root Type for SynthesisModel",
- "description": "",
- "required": [
- "improvement_suggestions",
- "long",
- "satisfaction",
- "short"
- ],
- "type": "object",
- "properties": {
- "long": {
- "type": "string",
- "example": "I understand that your Xiaomi 4 Ultra scooter was stolen on July 23, 2024, from the bike parking area at Place de l'Étoile, Montrouge. I have updated your claim with all the necessary details to ensure that your situation is well-documented."
- },
- "satisfaction": {
- "enum": [
- "terrible",
- "low",
- "partial",
- "high",
- "unknown"
- ],
- "type": "string"
- },
- "short": {
- "type": "string",
- "example": "the theft of your scooter"
- },
- "improvement_suggestions": {
- "type": "string",
- "example": "Ensure that the customer is aware of the next steps after the claim is filed, such as expected processing time and any additional documentation that may be required."
- }
- }
- },
- "LanguageEntryModel": {
- "title": "Root Type for LanguageEntryModel",
- "description": "",
- "required": [
- "pronunciations_en",
- "short_code",
- "voice"
- ],
- "type": "object",
- "properties": {
- "pronunciations_en": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": "[\n \"English\",\n \"American\",\n \"USA\"\n]"
- },
- "short_code": {
- "type": "string",
- "example": "en-US"
- },
- "voice": {
- "type": "string",
- "example": "en-US-NancyNeural"
- }
- }
- },
- "LanguageModel": {
- "description": "",
- "required": [
- "default_short_code",
- "availables"
- ],
- "type": "object",
- "properties": {
- "default_short_code": {
- "description": "",
- "type": "string",
- "example": "en-US"
- },
- "availables": {
- "description": "",
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/LanguageEntryModel"
- }
- }
- }
- },
- "ErrorModel": {
- "description": "",
- "required": [
- "error"
- ],
- "type": "object",
- "properties": {
- "error": {
- "$ref": "#/components/schemas/ErrorEntryModel",
- "description": ""
- }
- }
- },
- "ErrorEntryModel": {
- "description": "",
- "required": [
- "message",
- "details"
- ],
- "type": "object",
- "properties": {
- "message": {
- "description": "",
- "type": "string",
- "example": "Validation error"
- },
- "details": {
- "description": "",
- "type": "array",
- "items": {
- "type": "string"
- },
- "example": "[\n \"Missing field value for \\\"phone_number\\\".\"\n]"
- }
- }
- },
- "TwilioSmsModel": {
- "description": "",
- "required": [
- "From",
- "Body"
- ],
- "type": "object",
- "properties": {
- "From": {
- "description": "Phone number in a E164 format.",
- "pattern": "^\\+[1-9]\\d{1,14}$",
- "type": "string",
- "example": "+336952679801"
- },
- "Body": {
- "description": "Raw content of the SMS.",
- "type": "string",
- "example": "I confirm the address to 31 rue de La Jolie, 75003 Paris."
- }
- }
- }
- },
- "securitySchemes": {
- "AzureCommunicationServicesManaged": {
- "scheme": "bearer",
- "type": "http"
- },
- "CallbackCallSecret": {
- "type": "apiKey",
- "name": "secret",
- "in": "query"
- }
- }
- }
-}
diff --git a/tests/conftest.py b/tests/conftest.py
index 1d1b6bd..9b2ed56 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -15,14 +15,15 @@ from azure.communication.callautomation.aio import (
CallAutomationClient,
CallConnectionClient,
)
+from azure.identity import ManagedIdentityCredential, get_bearer_token_provider
from deepeval.models.gpt_model import GPTModel
from langchain_openai import AzureChatOpenAI
from pydantic import BaseModel, ValidationError
-from function_app import _str_to_contexts
from helpers.call_utils import ContextEnum as CallContextEnum
from helpers.config import CONFIG
from helpers.logging import logger
+from main import _str_to_contexts
from models.call import CallInitiateModel, CallStateModel
@@ -146,8 +147,11 @@ class DeepEvalAzureOpenAI(GPTModel):
"azure_deployment": platform.deployment,
"azure_endpoint": platform.endpoint,
"model": platform.model,
- # Authentication
- "api_key": platform.api_key.get_secret_value(),
+ # Authentication, either RBAC or API
+ "azure_ad_token_provider": get_bearer_token_provider(
+ ManagedIdentityCredential(),
+ "https://cognitiveservices.azure.com/.default",
+ ),
# DeepEval
**kwargs,
}
diff --git a/tests/llm.py b/tests/llm.py
index 8d044e3..c9aca40 100644
--- a/tests/llm.py
+++ b/tests/llm.py
@@ -267,7 +267,7 @@ async def test_llm( # noqa: PLR0913
async def _post_callback(_call: CallStateModel) -> None:
await on_end_call(call=_call)
- async def _trainings_callback(_call: CallStateModel) -> None:
+ async def _training_callback(_call: CallStateModel) -> None:
await _call.trainings(cache_only=False)
# Connect call
@@ -282,7 +282,7 @@ async def test_llm( # noqa: PLR0913
client=automation_client,
label=call.lang.short_code,
post_callback=_post_callback,
- trainings_callback=_trainings_callback,
+ training_callback=_training_callback,
)
# Simulate conversation with speech recognition
@@ -293,7 +293,7 @@ async def test_llm( # noqa: PLR0913
client=automation_client,
post_callback=_post_callback,
text=speech,
- trainings_callback=_trainings_callback,
+ training_callback=_training_callback,
)
# Receip
await on_play_completed(
diff --git a/tests/local.py b/tests/local.py
index 7109cca..098885b 100644
--- a/tests/local.py
+++ b/tests/local.py
@@ -49,7 +49,7 @@ async def main() -> None:
async def _post_callback(_call: CallStateModel) -> None:
await on_end_call(call=_call)
- async def _trainings_callback(_call: CallStateModel) -> None:
+ async def _training_callback(_call: CallStateModel) -> None:
await _call.trainings(cache_only=False)
# Connect call
@@ -64,7 +64,7 @@ async def main() -> None:
client=automation_client,
label=call.lang.short_code,
post_callback=_post_callback,
- trainings_callback=_trainings_callback,
+ training_callback=_training_callback,
)
# Simulate conversation
@@ -78,7 +78,7 @@ async def main() -> None:
client=automation_client,
post_callback=_post_callback,
text=message,
- trainings_callback=_trainings_callback,
+ training_callback=_training_callback,
)
# Receip
await on_play_completed(