You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+99-70Lines changed: 99 additions & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -243,7 +243,7 @@ sequenceDiagram
243
243
244
244
## Deployment
245
245
246
-
Some prerequisites are needed to deploy the solution.
246
+
### Prerequisites
247
247
248
248
[Prefer using GitHub Codespaces for a quick start.](https://codespaces.new/microsoft/call-center-ai?quickstart=1) The environment will setup automatically with all the required tools.
249
249
@@ -258,65 +258,97 @@ For other systems, make sure you have the following installed:
#### 1. [Create a new resource group](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-portal)
264
+
265
+
- Prefer to use lowercase and no special characters other than dashes (e.g. `ccai-customer-a`)
262
266
263
-
Steps to deploy:
267
+
#### 2. [Create a Communication Services resource](https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/create-communication-resource?tabs=linux&pivots=platform-azp)
264
268
265
-
1.[Create a new resource group](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-portal)
269
+
- Same name as the resource group
270
+
- Enable system managed identity
266
271
267
-
- Prefer to use lowercase and no special characters other than dashes (e.g. `ccai-customer-a`)
272
+
#### 3. [Buy a phone number](https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/telephony/get-phone-number?tabs=linux&pivots=platform-azp-new)
268
273
269
-
2.[Create a Communication Services resource](https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/create-communication-resource?tabs=linux&pivots=platform-azp)
274
+
- From the Communication Services resource
275
+
- Allow inbound and outbound communication
276
+
- Enable voice (required) and SMS (optional) capabilities
270
277
271
-
- Same name as the resource group
272
-
- Enable system managed identity
278
+
Now that the prerequisites are configured (local + Azure), the deployment can be done.
279
+
280
+
### Remote (on Azure)
273
281
274
-
3.[Buy a phone number](https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/telephony/get-phone-number?tabs=linux&pivots=platform-azp-new)
282
+
#### 1. Create the light config file
275
283
276
-
- From the Communication Services resource
277
-
- Allow inbound and outbound communication
278
-
- Enable voice (required) and SMS (optional) capabilities
284
+
File is named `config.yaml`:
279
285
280
-
4. Create a local `config.yaml` file
286
+
```yaml
287
+
# config.yaml
288
+
conversation:
289
+
initiate:
290
+
# Phone number the bot will transfer the call to if customer asks for a human agent
291
+
agent_phone_number: "+33612345678"
292
+
bot_company: Contoso
293
+
bot_name: Amélie
294
+
lang: {}
295
+
296
+
communication_services:
297
+
# Phone number purshased from Communication Services
298
+
phone_number: "+33612345678"
299
+
300
+
sms: {}
301
+
302
+
prompts:
303
+
llm: {}
304
+
tts: {}
305
+
```
281
306
282
-
```yaml
283
-
# config.yaml
284
-
conversation:
285
-
initiate:
286
-
# Phone number the bot will transfer the call to if customer asks for a human agent
287
-
agent_phone_number: "+33612345678"
288
-
bot_company: Contoso
289
-
bot_name: Amélie
290
-
lang: {}
307
+
#### 2. Connect to your Azure environment
291
308
292
-
communication_services:
293
-
# Phone number purshased from Communication Services
294
-
phone_number: "+33612345678"
309
+
```zsh
310
+
az login
311
+
```
295
312
296
-
sms: {}
313
+
#### 3. Run deployment automation
297
314
298
-
prompts:
299
-
llm: {}
300
-
tts: {}
301
-
```
315
+
```zsh
316
+
make deploy name=my-rg-name
317
+
```
302
318
303
-
5. Connect to your Azure environment (e.g. `az login`)
304
-
6. Run deployment automation with `make deploy name=my-rg-name`
319
+
- Wait for the deployment to finish
305
320
306
-
- Wait for the deployment to finish
321
+
#### 4. [Create a AI Search resource](https://learn.microsoft.com/en-us/azure/search/search-create-service-portal)
307
322
308
-
7. [Create a AI Search resource](https://learn.microsoft.com/en-us/azure/search/search-create-service-portal)
323
+
- An index named `trainings`
324
+
- A semantic search configuration on the index named `default`
309
325
310
-
- An index named `trainings`
311
-
- A semantic search configuration on the index named `default`
326
+
#### 5. Get the logs
312
327
313
-
Get the logs with `make logs name=my-rg-name`.
328
+
```zsh
329
+
make logs name=my-rg-name
330
+
```
314
331
315
332
### Local (on your machine)
316
333
317
-
#### Prerequisites for local development
334
+
#### 1. Create the full config file
335
+
336
+
> [!TIP]
337
+
> To use a Service Principal to authenticate to Azure, you can also add the following in a `.env` file:
338
+
>
339
+
> ```dotenv
340
+
> AZURE_CLIENT_ID=xxx
341
+
> AZURE_CLIENT_SECRET=xxx
342
+
> AZURE_TENANT_ID=xxx
343
+
> ```
318
344
319
-
Place a file called `config.yaml` in the root of the project with the following content:
345
+
> [!TIP]
346
+
> If you already deployed the application to Azure and if it is working, you can:
347
+
>
348
+
> - Copy the configuration from the Azure Function App to your local machine by using the content of the `CONFIG_JSON` application setting
349
+
> - Then convert it to YAML format
350
+
351
+
File is named `config.yaml`:
320
352
321
353
```yaml
322
354
# config.yaml
@@ -372,52 +404,49 @@ ai_translation:
372
404
endpoint: https://xxx.cognitiveservices.azure.com
373
405
```
374
406
375
-
To use a Service Principal to authenticate to Azure, you can also add the following in a `.env` file:
407
+
#### 2. Run the deployment automation
376
408
377
-
```dotenv
378
-
AZURE_CLIENT_ID=xxx
379
-
AZURE_CLIENT_SECRET=xxx
380
-
AZURE_TENANT_ID=xxx
409
+
```zsh
410
+
make deploy-bicep deploy-post name=my-rg-name
381
411
```
382
412
383
-
To override a specific configuration value, you can also use environment variables. For example, to override the `llm.fast.endpoint` value, you can use the `LLM__FAST__ENDPOINT` variable:
413
+
- This will deploy the Azure resources without the API server, allowing you to test the bot locally
414
+
- Wait for the deployment to finish
384
415
385
-
```dotenv
386
-
LLM__FAST__ENDPOINT=https://xxx.openai.azure.com
387
-
```
416
+
#### 3. Initialize local function config
388
417
389
-
Then run:
418
+
Copy `local.example.settings.json` to `local.settings.json`, then fill the required fields:
390
419
391
-
```bash
392
-
# Install dependencies
393
-
make install
394
-
```
420
+
-`APPLICATIONINSIGHTS_CONNECTION_STRING`, as the connection string of the Application Insights resource
421
+
-`AzureWebJobsStorage`, as the connection string of the Azure Storage account
395
422
396
-
Also, a public file server is needed to host the audio files. Upload the files with `make copy-resources name=my-rg-name` (`my-rg-name` is the storage account name), or manually.
423
+
#### 4. Connect to Azure Dev tunnels with `devtunnel login`, then run it with `make tunnel`
397
424
398
-
For your knowledge, this `resources` folder contains:
425
+
> [!IMPORTANT]
426
+
> Tunnel requires to be run in a separate terminal, because it needs to be running all the time
399
427
400
-
- Audio files (`xxx.wav`) to be played during the call
401
-
- [Lexicon file (`lexicon.xml`)](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/speech-synthesis-markup-pronunciation#custom-lexicon) to be used by the bot to understand the company products (note: any change [makes up to 15 minutes](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/speech-synthesis-markup-pronunciation#custom-lexicon-file) to be taken into account)
428
+
#### 5. Iterate quickly with the code
402
429
403
-
#### Run
430
+
> [!NOTE]
431
+
> To override a specific configuration value, you can use environment variables. For example, to override the `llm.fast.endpoint` value, you can use the `LLM__FAST__ENDPOINT` variable:
> Also, `local.py` script is available to test the application without the need of a phone call (= without Communication Services). Run the script with:
439
+
>
440
+
> ```bash
441
+
> python3 -m tests.local
442
+
> ```
406
443
407
-
```bash
408
-
# Start the local API server
444
+
```zsh
409
445
make dev
410
446
```
411
447
412
-
#### Debug
413
-
414
-
Breakpoints can be added in the code to debug the application with your favorite IDE.
415
-
416
-
Also, `local.py` script is available to test the application without the need of a phone call (= without Communication Services). Run the script with:
417
-
418
-
```bash
419
-
python3 -m tests.local
420
-
```
448
+
- Code is automatically reloaded on file changes, no need to restart the server
449
+
- The API server is available at `http://localhost:8080`
0 commit comments