This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| wiki:ai:azure_chatbot_with_open_ai_integration [2025/06/27 16:38] – created ymurugesan | wiki:ai:azure_chatbot_with_open_ai_integration [2025/07/10 21:40] (current) – ymurugesan | ||
|---|---|---|---|
| Line 16: | Line 16: | ||
| + | On the Azure side create the below | ||
| + | |||
| + | 1. Azure Open AI service - Obtain the key, endpoint and the deployment name. | ||
| + | 2. Create a new Azure bot from the bot service with multi tenant ( single tenant does not work but multi tenant is out of support after july end. Have to investigate what could be the workaround) | ||
| + | |||
| + | Env variables | ||
| + | |||
| + | AZURE_OPENAI_ENDPOINT= | ||
| + | AZURE_OPENAI_KEY=2 | ||
| + | AZURE_OPENAI_DEPLOYMENT_NAME= | ||
| + | PORT=3978 | ||
| + | |||
| + | Save above env variables as .env | ||
| + | |||
| + | To run in local | ||
| + | < | ||
| + | npm init -y | ||
| + | npm install botbuilder restify dotenv openai | ||
| + | npm install --save-dev nodemon | ||
| + | npm install -g ngrok | ||
| + | |||
| + | ngrok http 3978 -- To run ngrok | ||
| + | |||
| + | </ | ||
| + | |||
| + | Once you got the ngrok url update it in configuration in the Azure Bot service | ||
| + | |||
| + | |||
| + | ===== package.json ===== | ||
| + | |||
| + | < | ||
| + | |||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | |||
| + | |||
| + | |||
| + | </ | ||
| ===== Bot.js ===== | ===== Bot.js ===== | ||
| Line 419: | Line 461: | ||
| </ | </ | ||
| + | |||
| + | |||
| + | ** | ||
| + | |||
| + | To run in Azure** | ||
| + | |||
| + | 1. Create a webapp in azure ( without database) (Node 20 with windows) | ||
| + | |||
| + | 2. Add all the env variables below in the azure webapp. Do not zip the env variables | ||
| + | |||
| + | 3. Add the below web.config | ||
| + | |||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <add name=" | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | <rule name=" | ||
| + | <match url=" | ||
| + | <action type=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | |||
| + | 4. Update the package.json | ||
| + | |||
| + | < | ||
| + | |||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | 5. Zip the contents | ||
| + | |||
| + | 6. Deploy using CLI | ||
| + | |||
| + | < | ||
| + | az webapp deploy --resource-group xxx --name xx --src-path deployment123.zip --type zip | ||
| + | |||
| + | </ | ||
| + | |||
| + | 7. Verify the log stream for deployment logs to ensure deployment succeeds | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | {{: | ||