Skip to content

Commit 7fb0636

Browse files
gpickettFr4nc3Pavan-MicrosoftPrajwal-Microsoft
authored
feat: PostgreSQL implementation for Chat History and Vectorization (#1512)
Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Pavan Kumar <v-kupavan.microsoft.com> Co-authored-by: Pavan-Microsoft <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Prajwal D C <[email protected]>
1 parent dee02ba commit 7fb0636

File tree

60 files changed

+5709
-1395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+5709
-1395
lines changed

.env.sample

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@ AzureWebJobsStorage=
3636
BACKEND_URL=http://localhost:7071
3737
DOCUMENT_PROCESSING_QUEUE_NAME=
3838
# Azure Blob Storage for storing the original documents to be processed
39-
AZURE_BLOB_ACCOUNT_NAME=
40-
AZURE_BLOB_ACCOUNT_KEY=
41-
AZURE_BLOB_CONTAINER_NAME=
39+
AZURE_BLOB_STORAGE_INFO="{\"containerName\":\"documents\",\"accountName\":\"\",\"accountKey\":\"\"}"
4240
# Azure Form Recognizer for extracting the text from the documents
43-
AZURE_FORM_RECOGNIZER_ENDPOINT=
44-
AZURE_FORM_RECOGNIZER_KEY=
41+
AZURE_FORM_RECOGNIZER_INFO="{\"endpoint\":\"\",\"key\":\"\"}"
4542
# Azure AI Content Safety for filtering out the inappropriate questions or answers
4643
AZURE_CONTENT_SAFETY_ENDPOINT=
4744
AZURE_CONTENT_SAFETY_KEY=
@@ -66,3 +63,5 @@ CONVERSATION_FLOW=
6663
AZURE_COSMOSDB_INFO="{\"accountName\":\"cosmos-abc123\",\"databaseName\":\"db_conversation_history\",\"containerName\":\"conversations\"}"
6764
AZURE_COSMOSDB_ACCOUNT_KEY=
6865
AZURE_COSMOSDB_ENABLE_FEEDBACK=
66+
AZURE_POSTGRESQL_INFO="{\"user\":\"\",\"dbname\":\"postgres\",\"host\":\"\"}"
67+
DATABASE_TYPE="CosmosDB"

README.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ urlFragment: chat-with-your-data-solution-accelerator
4848
## User story
4949
Welcome to the *Chat with your data* Solution accelerator repository! The *Chat with your data* Solution accelerator is a powerful tool that combines the capabilities of Azure AI Search and Large Language Models (LLMs) to create a conversational search experience. This solution accelerator uses an Azure OpenAI GPT model and an Azure AI Search index generated from your data, which is integrated into a web application to provide a natural language interface, including [speech-to-text](docs/speech_to_text.md) functionality, for search queries. Users can drag and drop files, point to storage, and take care of technical setup to transform documents. Everything can be deployed in your own subscription to accelerate your use of this technology.
5050

51-
![Solution Architecture - Chat with your data](/docs/images/cwyd-solution-architecture.png)
51+
5252

5353
### About this repo
5454

@@ -91,12 +91,15 @@ Here is a comparison table with a few features offered by Azure, an available Gi
9191
- **Single application access to your full data set**: Minimize endpoints required to access internal company knowledgebases. Reuse the same backend with the [Microsoft Teams Extension](docs/teams_extension.md)
9292
- **Natural language interaction with your unstructured data**: Use natural language to quickly find the answers you need and ask follow-up queries to get the supplemental details, including [Speech-to-text](docs/speech_to_text.md).
9393
- **Easy access to source documentation when querying**: Review referenced documents in the same chat window for additional context.
94+
- **Chat history**: Prior conversations and context are maintained and accessible through chat history.
9495
- **Data upload**: Batch upload documents of [various file types](docs/supported_file_types.md)
9596
- **Accessible orchestration**: Prompt and document configuration (prompt engineering, document processing, and data retrieval)
97+
- **Database flexibility**: Dynamic database switching allows users to choose between PostgreSQL and Cosmos DB based on their requirements. If no preference is specified the platform defaults to PostgreSQL.
9698

9799

98100
**Note**: The current model allows users to ask questions about unstructured data, such as PDF, text, and docx files. See the [supported file types](docs/supported_file_types.md).
99101

102+
100103
### Target end users
101104
Company personnel (employees, executives) looking to research against internal unstructured company data would leverage this accelerator using natural language to find what they need quickly.
102105

@@ -107,6 +110,11 @@ Tech administrators can use this accelerator to give their colleagues easy acces
107110

108111
### Use Case scenarios
109112

113+
#### Employee Onboarding Scenario
114+
The sample data illustrates how this accelerator could be used for an employee onboarding scenario in across industries.
115+
116+
In this scenario, a newly hired employee is in the process of onboarding to their organization. Leveraging the solution accelerator, she navigates through the extensive offerings of her organization’s health and retirement benefits. With the newly integrated chat history capabilities, they can revisit previous conversations, ensuring continuity and context across multiple days of research. This functionality allows the new employee to efficiently gather and consolidate information, streamlining their onboarding experience. [For more details, refer to the README](docs/employee_assistance.md).
117+
110118
#### Financial Advisor Scenario
111119
The sample data illustrates how this accelerator could be used in the financial services industry (FSI).
112120

@@ -120,12 +128,6 @@ Additionally, we have implemented a Legal Review and Summarization Assistant sce
120128
Note: Some of the sample data included with this accelerator was generated using AI and is for illustrative purposes only.
121129

122130

123-
#### Employee Onboarding Scenario
124-
The sample data illustrates how this accelerator could be used for an employee onboarding scenario in across industries.
125-
126-
In this scenario, a newly hired employee is in the process of onboarding to their organization. Leveraging the solution accelerator, she navigates through the extensive offerings of her organization’s health and retirement benefits. With the newly integrated chat history capabilities, they can revisit previous conversations, ensuring continuity and context across multiple days of research. This functionality allows the new employee to efficiently gather and consolidate information, streamlining their onboarding experience. [For more details, refer to the README](docs/employee_assistance.md).
127-
128-
129131
---
130132

131133
![One-click Deploy](/docs/images/oneClickDeploy.png)
@@ -146,6 +148,7 @@ In this scenario, a newly hired employee is in the process of onboarding to thei
146148
- Azure Storage Account
147149
- Azure Speech Service
148150
- Azure CosmosDB
151+
- Azure PostgreSQL
149152
- Teams (optional: Teams extension only)
150153

151154
### Required licenses
@@ -163,13 +166,30 @@ The following are links to the pricing details for some of the resources:
163166
- [Azure AI Document Intelligence pricing](https://azure.microsoft.com/pricing/details/ai-document-intelligence/)
164167
- [Azure Web App Pricing](https://azure.microsoft.com/pricing/details/app-service/windows/)
165168

169+
### Deployment options: PostgreSQL or Cosmos DB
170+
With the addition of PostgreSQL, customers can leverage the power of a relationship-based AI solution to enhance historical conversation access, improve data privacy, and open the possibilities for scalability.
171+
172+
Customers have the option to deploy this solution with PostgreSQL or Cosmos DB. Consider the following when deciding which database to use:
173+
- PostgreSQL enables a relationship-based AI solution and search indexing for Retrieval Augmented Generation (RAG)
174+
- Cosmos DB is a NoSQL-based solution for chat history
175+
176+
177+
To review PostgreSQL configuration overview and steps, follow the link [here](docs/postgreSQL.md).
178+
![Solution Architecture - Chat with your data PostgreSQL](/docs/images/architrecture_pg.png)
179+
180+
To review Cosmos DB configuration overview and steps, follow the link [here](docs/employee_assistance.md).
181+
![Solution Architecture - Chat with your data CosmosDB](/docs/images/architecture_cdb.png)
182+
166183
### Deploy instructions
184+
The "Deploy to Azure" button offers a one-click deployment where you don’t have to clone the code. If you would like a developer experience instead, follow the [local deployment instructions](./docs/LOCAL_DEPLOYMENT.md).
167185

168-
There are two choices; the "Deploy to Azure" offers a one click deployment where you don't have to clone the code, alternatively if you would like a developer experience, follow the [Local deployment instructions](./docs/LOCAL_DEPLOYMENT.md).
186+
Once you deploy to Azure, you will have the option to select PostgreSQL or Cosmos DB, see screenshot below.
169187

170-
The demo, which uses containers pre-built from the main branch is available by clicking this button:
188+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fchat-with-your-data-solution-accelerator%2Frefs%2Fheads%2Fmain%2Finfra%2Fmain.json)
189+
190+
Select either "PostgreSQL" or "Cosmos DB":
191+
![Solution Architecture - DB Selection](/docs/images/db_selection.png)
171192

172-
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fchat-with-your-data-solution-accelerator%2Fmain%2Finfra%2Fmain.json)
173193

174194
When Deployment is complete, follow steps in [Set Up Authentication in Azure App Service](./docs/azure_app_service_auth_setup.md) to add app authentication to your web app running on Azure App Service
175195

@@ -195,9 +215,11 @@ switch to a lower version. To find out which versions are supported in different
195215

196216
![A screenshot of the chat app.](./docs/images/web-unstructureddata.png)
197217

198-
\
199-
\
218+
219+
220+
200221
![Supporting documentation](/docs/images/supportingDocuments.png)
222+
201223
## Supporting documentation
202224

203225
### Resource links

0 commit comments

Comments
 (0)