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
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## About
4
4
5
-
This project provides a very easy to use learning and experimentation playground to try out various AI-enabled search scenarios in Azure. It provides a web application front-end which uses [Azure Cognitive Search](https://learn.microsoft.com/azure/search/search-what-is-azure-search) and [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview) to execute searches with a variety of options. This allows you to quickly understand what each option does, how it affects the search results, and how various approaches compare against each other.
5
+
This project provides a very easy to use learning and experimentation playground to try out various AI-enabled search scenarios in Azure. It provides a web application front-end which uses [Azure Cognitive Search](https://learn.microsoft.com/azure/search/search-what-is-azure-search) and [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview) to execute searches with a variety of options - ranging from simple text search, to semantic search, vector and hybrid search, and using generative AI to answer search queries in various ways. This allows you to quickly understand what each option does, how it affects the search results, and how various approaches compare against each other.
6
6
7
7
By default, a few documents are added automatically to allow you to use the application directly. You're encouraged to upload your own documents (which you can also easily do via the web app) so you can experiment with searching over your own content.
8
8
@@ -44,7 +44,7 @@ When you deploy the solution, it creates an [Azure Cognitive Search](https://lea
44
44
45
45
The documents in the index are also chunked into smaller pieces, and vector embeddings are created for these chunks using a Function App based on the [Azure OpenAI Embeddings Generator power skill](https://github.com/Azure-Samples/azure-search-power-skills/tree/main/Vector/EmbeddingGenerator). This allows you to easily try out [vector and hybrid search](https://learn.microsoft.com/azure/search/vector-search-overview). With Azure Cognitive Search on its own, the responses *always* come directly from the source data, rather than being generated by an AI model. You can optionally use [semantic search](https://learn.microsoft.com/azure/search/semantic-search-overview) which *does* use AI, not to generate content but to increase the relevancy of the results and provide semantic answers and captions.
46
46
47
-
The solution also deploys an [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview) service. It provides an embeddings model to generate the vector representations of the document chunks and search queries, and a GPT model to generate answers to your search queries. If you choose the option to use [Azure OpenAI "on your data"](https://learn.microsoft.com/azure/ai-services/openai/concepts/use-your-data), these AI-generated responses can be grounded in (and even limited to) the information in your Azure Cognitive Search indexes. This option allows you to let Azure OpenAI orchestrate the [Retrieval Augmented Generation (RAG)](https://aka.ms/what-is-rag) pattern. This means your search query will first be used to retrieve the most relevant documents (or preferably *smaller chunks of those documents*) from your private data source. Those search results are then used as context in the prompt that gets sent to the AI model, along with the original search query. This allows the AI model to generate a response based on the most relevant source data, rather than the public data that was used to train the model.
47
+
The solution also deploys an [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview) service. It provides an embeddings model to generate the vector representations of the document chunks and search queries, and a GPT model to generate answers to your search queries. If you choose the option to use [Azure OpenAI "on your data"](https://learn.microsoft.com/azure/ai-services/openai/concepts/use-your-data), these AI-generated responses can be grounded in (and even limited to) the information in your Azure Cognitive Search indexes. This option allows you to let Azure OpenAI orchestrate the [Retrieval Augmented Generation (RAG)](https://aka.ms/what-is-rag) pattern. This means your search query will first be used to retrieve the most relevant documents (or preferably *smaller chunks of those documents*) from your private data source. Those search results are then used as context in the prompt that gets sent to the AI model, along with the original search query. This allows the AI model to generate a response based on the most relevant source data, rather than the public data that was used to train the model. Next to letting Azure OpenAI orchestrate the RAG pattern, the web application can also use [Semantic Kernel](https://learn.microsoft.com/semantic-kernel/overview/) to perform that orchestration, using a prompt and other parameters you can control yourself.
48
48
49
49
## Deployment
50
50
@@ -117,7 +117,8 @@ The ARM template deploys the services and sets the configuration settings for th
117
117
|`SearchIndexNameBlobChunks`*| The name of the search index that contains the document chunks |`blob-chunks`|
118
118
|`SearchIndexerScheduleMinutes`*| The number of minutes between indexer executions in Azure Cognitive Search |`5`|
119
119
|`InitialDocumentUrls`| A space-separated list of URLs for the documents to include by default | A [resiliency](https://azure.microsoft.com/mediahandler/files/resourcefiles/resilience-in-azure-whitepaper/Resiliency-whitepaper.pdf) and [compliance](https://azure.microsoft.com/mediahandler/files/resourcefiles/data-residency-data-sovereignty-and-compliance-in-the-microsoft-cloud/Data_Residency_Data_Sovereignty_Compliance_Microsoft_Cloud.pdf) document |
120
-
|`DefaultSystemRoleInformation`| The default instructions for the AI model | You are an AI assistant that helps people find information. |
120
+
|`DefaultSystemRoleInformation`| The default instructions for the AI model | "You are an AI assistant that helps people find information." |
121
+
|`DefaultCustomOrchestrationPrompt`| The default prompt for the AI model when using custom orchestration | A prompt that instructs the AI model to respond from provided data sources (with citations). |
121
122
|`DisableUploadDocuments`| Set this to `true` to disable the functionality to upload documents, preventing uploads by users of the Web App (you can still upload documents directly to the Azure storage container if you have permissions there) |`false`|
122
123
|`DisableResetSearchConfiguration`| Set this to `true` to disable the functionality to reset the search configuration by users of the Web App |`false`|
publicconststringSystemRoleInformation="You are an AI assistant that helps people find information.";
16
+
17
+
// Adapted from https://github.com/Azure-Samples/azure-search-openai-demo-csharp/blob/feature/embeddingSearch/app/backend/Services/RetrieveThenReadApproachService.cs
18
+
publicconststringCustomOrchestrationPrompt=@"You are an intelligent assistant.
19
+
Use 'you' to refer to the individual asking the questions even if they ask with 'I'.
20
+
Answer the following question using only the data provided in the sources below.
21
+
For tabular information return it as an HTML table. Do not return markdown format.
22
+
Each source has a name followed by a colon and the actual information, always include the source name for each fact you use in the response.
23
+
If you cannot answer using the sources below, say you don't know.
24
+
25
+
###
26
+
Question: 'What is the deductible for the employee plan for a visit to Overlake in Bellevue?'
27
+
28
+
Sources:
29
+
info1.txt: deductibles depend on whether you are in-network or out-of-network. In-network deductibles are $500 for employees and $1000 for families. Out-of-network deductibles are $1000 for employees and $2000 for families.
30
+
info2.pdf: Overlake is in-network for the employee plan.
31
+
info3.pdf: Overlake is the name of the area that includes a park and ride near Bellevue.
32
+
info4.pdf: In-network institutions include Overlake, Swedish, and others in the region
33
+
34
+
Answer:
35
+
In-network deductibles are $500 for employees and $1000 for families <cite>info1.txt</cite> and Overlake is in-network for the employee plan <cite>info2.pdf</cite><cite>info4.pdf</cite>.
publicboolLimitToDataSource{get;set;}=true;// "Limit responses to your data content"
12
13
publicstring?SystemRoleInformation{get;set;}// Give the model instructions about how it should behave and any context it should reference when generating a response. You can describe the assistant’s personality, tell it what it should and shouldn’t answer, and tell it how to format responses. There’s no token limit for this section, but it will be included with every API call, so it counts against the overall token limit.
0 commit comments