Skip to content

ChatGPT like application for Digital Powers private data using Retrieval-Augmented Generation pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models.

License

Notifications You must be signed in to change notification settings

digital-power/chatDiP

 
 

Repository files navigation

ChatDIP

Welcome to the Digital Power AI chatbot solution based on this Azure sample repository.

Since the authors of the Azure sample project have already documented almost all you need to know, this README is meant to quickly navigate to the relevant parts.

Directory structure

The project constists of the following directories:

  • /app contains the Python (Quart) backend and the Typescript (React) frontend.
  • /assets contains images used in the app.
  • /data contains the files that are used to build the knowledge base. This is the data that the chatbot uses to answer questions!
  • /docs contains markdown files with documentation.
  • /infra contains the Bicep files defining the required Azure resources.
  • /scripts contains Shell & PowerShell scripts for adhoc functionalities.
  • /tests contains Pytest tests

Get started

To collaborate on this project in an organised way we follow the Github flow principles. This effectively means that all changes require a separate branch and a pull request to the main branch with reviewers to process them.

Changing the data

The easiest way to change the underlying data that the chatbot uses, is to replace the files in the /data folder. After committing and pushing the code the to remote main branch, a "deploy" pipeline will upload the data to the Azure environment.

Uploading new documents will NOT delete the already existings data. To remove documents contact an owner.

If you are an owners of this project you can also use the prepdocs script to directly parse and upload documents from your local environment. You can add the --remove or --removeall flag in the shell script to delete data from the index. Check prepdocs.py on how to use them.

Changing the infrastructure

For the infrastructure you can use the same method as for data by first changing the Bicep files in the /infra folder. Secondly, after committing and pushing the code the to remote main branch, a "deploy" pipeline will update the infrastructure of the Azure environment.

If you are an owners of this project you can also the azd deploy command to directly update the infrastructure from your local environment. However, it is highly recommended to use the pipeline method as well!

Changing the app (backend or frontend)

If you want to make changes to the app, you need to test them locally. Therefore, you need to be able to run the app locally which requires the right access and setting up the environment.

Getting access

Ask one of the owners to add you to the chatdip user group and assign you the Reader role on the Digital Power Playground subscription.

Setting up the environment

To run the app locally:

  1. Install the Azure Developer CLI
  2. Run azd auth login
  3. Run azd env refresh -e chat-dip-dev
    • When prompted, choose the Digital Power Playground subscription
    • When prompted, choose West-Europe as the region, if it is not an option (for openAiResourceGroupLocation) choose France Central

Running the app

Instructions on running the local environment can be found here.

Map custom domain

To map a custom domain to the app, the following steps need to be taken:

  1. Make sure your domain is registered by your hosting provider.
  2. Share the CNAME records with the hosting provider.
    • Go to the Azure portal and navigate to the web app.
    • Go to the custom domains tab and add the custom domain.
    • Export the CNAME records and share them with the hosting provider.
  3. Deploy the Bicep code in the correct order.
    • Go to infra/core/host/appservice.bicep
    • Add depends_on block to the certificates resource with appService as the dependency.
    • Outcomment the thumbprint property in the appService/hostNameBinding resource.
    • Set sslState to Disabled
    • Run azd provision to create the certificate and set the custom domain.
    • Remove the depends_on block from the certificates resource.
    • After deployment, uncomment the thumbprint property
    • Set sslState to SniEnabled.
    • Run azd provision to set the host binding to use the certificate.

Owners of this project

About

ChatGPT like application for Digital Powers private data using Retrieval-Augmented Generation pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 62.4%
  • Bicep 17.2%
  • TypeScript 16.3%
  • CSS 1.6%
  • PowerShell 1.3%
  • Shell 1.1%
  • HTML 0.1%