Git Product home page Git Product logo

chatgpt-sap-aoai's Introduction

Build SAP Bot with Azure OpenAI - Generative ChatGPT

Introduction

This repository hosts instructions and code needed to build a chatbot that integrates SAP data with Azure OpenAI's advanced GPT-35-turbo AI model, hosted on Azure. The bot is designed to address user queries regarding specific products available in an SAP system, including details about the product's name, ID, and other properties.

Prerequisites

Before you start, make sure you have the following prerequisites:

Azure subscription https://azure.microsoft.com/en-us/

Azure Cognitive Services Instance https://azure.microsoft.com/en-us/products/cognitive-services/#overview

Azure OpenAI Service Instance https://azure.microsoft.com/en-us/products/cognitive-services/openai-service/

A SAP system with some product data

Python 3.7 or later installed on your machine (Visual Studio Code):

AzureBot setup (reference URL : https://accessibleai.dev/post/create_and_deploy_bot/)

  • AzureBot service will be connected to Micrsoft Teams as Channel

Build Steps

Here is the overall build flow and solution desing for the SAP Bot with ChatGPT. build flow

  1. Setup the Local Project

  2. Replace code (_init.py, main.py, function.json, requirement.txt)
    local project setup

2.1 Install the required packages: Navigate to the project directory and install the required Python packages using the following commands

  • pip install -r requirements.txt

2.2 Local project testing setup The solution is using APP@FastAPI, in order to test in local, you need to install the below as well in the (.venv)

  • pip install spacy
  • python -m spacy download en_core_web_sm
  • uvicorn main:app --reload unicorn loading

2.3 Testing with Postman

  • http://127.0.0.1:8000/api/query?question=does HT-1003 has a good rating count compare to others ? postman test 1

2.4 Deploy to Azure Functions

  • deploy to Auzre Functions

2.4.1 Testign with Azure Function App

  • Menu -> Developer -> Code + Test

  • auzre functio test

  • Output check

  • Function output

2.4.2 Get Function URL with KEY for the integration of AzureBot. Get Function URL

  1. Setup Azure Bot connection to Teams
  • Make sure you have up and running AzureBot after you follow the reference blog AzureBot setup (reference URL : https://accessibleai.dev/post/create_and_deploy_bot/)

  • Replace EchoBot.cs code EchBot cs

  • Replace line 16 : Private readonly string _azureFunctionUrl = ""; with URL from section 2.4.2

  • Save All

  • Rebuild

  • Publish

  1. Azure Bot Connection testing to Teams -add Teams channel Test with teams

Code Overview

The main components of the code are:

main.py: This is the main script that runs the process query. It uses the OpenAI API to process user queries and returns the appropriate responses.

_init.py: This script is responsible for connecting to the SAP system and fetching product data to HTTP trigger to AzureBot..

Conclusion

With the SAP Bot, you can easily fetch and interact with your SAP data using natural language queries. Leveraging the power of OpenAI's GPT model and Azure's robust infrastructure, this bot can be a valuable tool for anyone needing quick and easy access to their SAP data.

Feel free to clone, modify, and use this project as you see fit. If you have any questions or suggestions, please open an issue or submit a pull request.

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.