You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,25 @@
1
-
# ChatGPT-like app with your data using Azure OpenAI and Azure AI Search (Python)
1
+
<!--
2
+
---
3
+
name: RAG chat app with your data (Python)
4
+
description: Chat with your domain data using Azure OpenAI and Azure AI Search.
5
+
languages:
6
+
- python
7
+
- typescript
8
+
- bicep
9
+
- azdeveloper
10
+
products:
11
+
- azure-openai
12
+
- azure-cognitive-search
13
+
- azure-app-service
14
+
- azure
15
+
page_type: sample
16
+
urlFragment: azure-search-openai-demo
17
+
---
18
+
-->
19
+
20
+
# RAG chat app with Azure OpenAI and Azure AI Search (Python)
21
+
22
+
This solution creates a ChatGPT-like frontend experience over your own documents using RAG (Retrieval Augmented Generation). It uses Azure OpenAI Service to access GPT models, and Azure AI Search for data indexing and retrieval.
2
23
3
24
This solution's backend is written in Python. There are also [**JavaScript**](https://aka.ms/azai/js/code), [**.NET**](https://aka.ms/azai/net/code), and [**Java**](https://aka.ms/azai/java/code) samples based on this one. Learn more about [developing AI apps using Azure AI Services](https://aka.ms/azai).
Copy file name to clipboardExpand all lines: docs/azd.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Deploying with the Azure Developer CLI
1
+
# RAG chat: Deploying with the Azure Developer CLI
2
2
3
3
This guide includes advanced topics that are not necessary for a basic deployment. If you are new to the project, please consult the main [README](../README.md#deploying) for steps on deploying the project.
Copy file name to clipboardExpand all lines: docs/azure_app_service.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
-
# Deploying on Azure App Service
1
+
# RAG chat: Deploying on Azure App Service
2
2
3
3
Due to [a limitation](https://github.com/Azure/azure-dev/issues/2736) of the Azure Developer CLI (`azd`), there can be only one host option in the [azure.yaml](../azure.yaml) file.
4
4
By default, `host: containerapp` is used and `host: appservice` is commented out.
5
5
6
-
To deploy to Azure Container Apps, please follow the following steps:
6
+
To deploy to Azure App Service, please follow the following steps:
7
7
8
8
1. Comment out `host: containerapp` and uncomment `host: appservice` in the [azure.yaml](../azure.yaml) file.
Copy file name to clipboardExpand all lines: docs/azure_container_apps.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Deploying on Azure Container Apps
1
+
# RAG chat: Deploying on Azure Container Apps
2
2
3
3
Due to [a limitation](https://github.com/Azure/azure-dev/issues/2736) of the Azure Developer CLI (`azd`), there can be only one host option in the [azure.yaml](../azure.yaml) file.
4
4
By default, `host: containerapp` is used and `host: appservice` is commented out.
Copy file name to clipboardExpand all lines: docs/data_ingestion.md
+43-13Lines changed: 43 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,24 @@
1
-
# Indexing documents for the Chat App
1
+
# RAG chat: Data ingestion
2
2
3
-
This guide provides more details for using the `prepdocs` script to index documents for the Chat App.
3
+
The [azure-search-openai-demo](/) project can set up a full RAG chat app on Azure AI Search and OpenAI so that you can chat on custom data, like internal enterprise data or domain-specific knowledge sets. For full instructions on setting up the project, consult the [main README](/README.md), and then return here for detailed instructions on the data ingestion component.
4
+
5
+
The chat app provides two ways to ingest data: manual indexing and integrated vectorization. This document explains the differences between the two approaches and provides an overview of the manual indexing process.
-[Indexing of additional documents](#indexing-of-additional-documents)
13
15
-[Removal of documents](#removal-of-documents)
14
16
-[Scheduled indexing](#scheduled-indexing)
17
+
-[Debugging tips](#debugging-tips)
15
18
16
19
## Supported document formats
17
20
18
-
In order to ingest a document format, we need a tool that can turn it into text. By default, use Azure Document Intelligence (DI in the table below), but we also have local parsers for several formats. The local parsers are not as sophisticated as Azure Document Intelligence, but they can be used to decrease charges.
21
+
In order to ingest a document format, we need a tool that can turn it into text. By default, the manual indexing uses Azure Document Intelligence (DI in the table below), but we also have local parsers for several formats. The local parsers are not as sophisticated as Azure Document Intelligence, but they can be used to decrease charges.
19
22
20
23
| Format | Manual indexing | Integrated Vectorization |
@@ -29,7 +32,7 @@ In order to ingest a document format, we need a tool that can turn it into text.
29
32
30
33
The Blob indexer used by the Integrated Vectorization approach also supports a few [additional formats](https://learn.microsoft.com/azure/search/search-howto-indexing-azure-blob-storage#supported-document-formats).
31
34
32
-
## Overview of the manual indexing process
35
+
## Manual indexing process
33
36
34
37
The [`prepdocs.py`](../app/backend/prepdocs.py) script is responsible for both uploading and indexing documents. The typical usage is to call it using `scripts/prepdocs.sh` (Mac/Linux) or `scripts/prepdocs.ps1` (Windows), as these scripts will set up a Python virtual environment and pass in the required parameters based on the current `azd` environment. You can pass additional arguments directly to the script, for example `scripts/prepdocs.ps1 --removeall`. Whenever `azd up` or `azd provision` is run, the script is called automatically.
35
38
@@ -42,12 +45,6 @@ The script uses the following steps to index documents:
42
45
3. Split the PDFs into chunks of text.
43
46
4. Upload the chunks to Azure AI Search. If using vectors (the default), also compute the embeddings and upload those alongside the text.
44
47
45
-
### Enhancing search functionality with data categorization
46
-
47
-
To enhance search functionality, categorize data during the ingestion process with the `--category` argument, for example `scripts/prepdocs.ps1 --category ExampleCategoryName`. This argument specifies the category to which the data belongs, enabling you to filter search results based on these categories.
48
-
49
-
After running the script with the desired category, ensure these categories are added to the 'Include Category' dropdown list. This can be found in the developer settings of [`Chat.tsx`](../app/frontend/src/pages/chat/Chat.tsx) and [`Ask.tsx`](../app/frontend/src/pages/ask/Ask.tsx). The default option for this dropdown is "All". By including specific categories, you can refine your search results more effectively.
50
-
51
48
### Chunking
52
49
53
50
We're often asked why we need to break up the PDFs into chunks when Azure AI Search supports searching large documents.
@@ -56,6 +53,12 @@ Chunking allows us to limit the amount of information we send to OpenAI due to t
56
53
57
54
If needed, you can modify the chunking algorithm in `scripts/prepdocslib/textsplitter.py`.
58
55
56
+
### Enhancing search functionality with data categorization
57
+
58
+
To enhance search functionality, categorize data during the ingestion process with the `--category` argument, for example `scripts/prepdocs.ps1 --category ExampleCategoryName`. This argument specifies the category to which the data belongs, enabling you to filter search results based on these categories.
59
+
60
+
After running the script with the desired category, ensure these categories are added to the 'Include Category' dropdown list. This can be found in the developer settings of [`Chat.tsx`](../app/frontend/src/pages/chat/Chat.tsx) and [`Ask.tsx`](../app/frontend/src/pages/ask/Ask.tsx). The default option for this dropdown is "All". By including specific categories, you can refine your search results more effectively.
61
+
59
62
### Indexing additional documents
60
63
61
64
To upload more PDFs, put them in the data/ folder and run `./scripts/prepdocs.sh` or `./scripts/prepdocs.ps1`.
@@ -70,7 +73,7 @@ To remove all documents, use `scripts/prepdocs.sh --removeall` or `scripts/prepd
70
73
71
74
You can also remove individual documents by using the `--remove` flag. Open either `scripts/prepdocs.sh` or `scripts/prepdocs.ps1` and replace `/data/*` with `/data/YOUR-DOCUMENT-FILENAME-GOES-HERE.pdf`. Then run `scripts/prepdocs.sh --remove` or `scripts/prepdocs.ps1 --remove`.
72
75
73
-
## Overview of Integrated Vectorization
76
+
## Integrated Vectorization
74
77
75
78
Azure AI Search includes an [integrated vectorization feature](https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in/ba-p/3960809#:~:text=Integrated%20vectorization%20is%20a%20new%20feature%20of%20Azure,pull-indexers%2C%20and%20vectorization%20of%20text%20queries%20through%20vectorizers), a cloud-based approach to data ingestion. Integrated vectorization takes care of document format cracking, data extraction, chunking, vectorization, and indexing, all with Azure technologies.
76
79
@@ -99,3 +102,30 @@ The Azure AI Search indexer will take care of removing those documents from the
99
102
### Scheduled indexing
100
103
101
104
If you would like the indexer to run automatically, you can set it up to [run on a schedule](https://learn.microsoft.com/azure/search/search-howto-schedule-indexers).
105
+
106
+
## Debugging tips
107
+
108
+
If you are not sure if a file successfully uploaded, you can query the index from the Azure Portal or from the REST API. Open the index and paste the queries below into the search bar.
Copy file name to clipboardExpand all lines: docs/deploy_existing.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
2
-
# Deploying with existing Azure resources
2
+
# RAG chat: Deploying with existing Azure resources
3
3
4
4
If you already have existing Azure resources, or if you want to specify the exact name of new Azure Resource, you can do so by setting `azd` environment values.
5
5
You should set these values before running `azd up`. Once you've set them, return to the [deployment steps](../README.md#deploying).
Copy file name to clipboardExpand all lines: docs/deploy_lowcost.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Deploying with minimal costs
1
+
# RAG chat: Deploying with minimal costs
2
2
3
3
This AI RAG chat application is designed to be easily deployed using the Azure Developer CLI, which provisions the infrastructure according to the Bicep files in the `infra` folder. Those files describe each of the Azure resources needed, and configures their SKU (pricing tier) and other parameters. Many Azure services offer a free tier, but the infrastructure files in this project do *not* default to the free tier as there are often limitations in that tier.
0 commit comments