Giter Club home page Giter Club logo

aibot-nlp2sql's Introduction

Contoso Retail_chat_bot

The is an AI Assistant powered by Azure Open AI. helps users have their queries on order status (from a database) or questions answered from knowledge based, using AI Search

This bot has been created using Bot Framework, it shows how to create a simple bot that accepts input from the user and echoes it back.

This Bot application showcases the following: - Function calling - Extract intent and entities and branch off into different systems for RAG - Calls AI Search or calls database query

It is based on version 1 of open ai library in python. Does not work with 0.28.1

towards the end of this page, refer to the steps that were to be performed to get this deployed to azure

Prerequisites

This sample requires prerequisites in order to run.

Install Python 3.11.7

Running the sample

  • Run pip install -r requirements.txt to install all dependencies
  • Run python app.py

Testing the bot using Bot Framework Emulator

Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.

  • Install the Bot Framework Emulator version 4.3.0 or greater from here

Connect to the bot using Bot Framework Emulator

  • Launch Bot Framework Emulator
  • Enter a Bot URL of http://localhost:3978/api/messages

Further reading

Deploying to Azure

Follow the steps that are documented already, to create an App Service plan, a Web app in it and an Azure Bot Service App. Get the AppID, generate a Secret. this needs to be added to the Config section in the VS Code Project

Steps to be performed in the Web App:

  • In the Application settings, under configuration, add -> SCM_DO_BUILD_DURING_DEPLOYMENT, and set the value to true
  • In the General Settings, add the start up script below (note that we need to install the ODBC Driver for SQL Sever)
#!/bin/bash
apt-get update
apt-get install -y unixodbc-dev
ACCEPT_EULA=Y apt-get install msodbcsql18
gunicorn --bind 0.0.0.0 --worker-class aiohttp.worker.GunicornWebWorker app:APP

What to include in the requirements.txt

In the VS Code project, the requirements.txt only required the following

openai==1.11.1 botbuilder-integration-aiohttp>=4.14.0 pyodbc

Deploying the solution to App Service

Used the ZIP file method and cli command

az webapp deployment source config-zip --resource-group "rpay-app-rg" --name "nlp2sql-bot-web" --src "nlp2sqlbot-app.zip"

Adding CORS

In the Web app, permitted the following CORS

https://botservice.hosting.portal.azure.net

https://hosting.onecloud.azure-test.net

aibot-nlp2sql's People

Contributors

ssrikantan avatar

Watchers

 avatar Kostas Georgiou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.