Skip to content

Commit f696c92

Browse files
authored
[Docs] Rename remaining instances of Cognitive Search to AI Search (#961)
* Rename remaining cognitive instanceS * oops dont remain cog services * Apply suggestions from code review * Apply suggestions from code review * Update docs/customization.md * Update docs/customization.md * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review * Update docs/customization.md
1 parent 1f7de66 commit f696c92

File tree

10 files changed

+37
-37
lines changed

10 files changed

+37
-37
lines changed

app/backend/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ async def setup_clients():
221221
AZURE_SEARCH_QUERY_LANGUAGE = os.getenv("AZURE_SEARCH_QUERY_LANGUAGE", "en-us")
222222
AZURE_SEARCH_QUERY_SPELLER = os.getenv("AZURE_SEARCH_QUERY_SPELLER", "lexicon")
223223

224-
# Use the current user identity to authenticate with Azure OpenAI, Cognitive Search and Blob Storage (no secrets needed,
224+
# Use the current user identity to authenticate with Azure OpenAI, AI Search and Blob Storage (no secrets needed,
225225
# just use 'az login' locally, and managed identity when deployed on Azure). If you need to use keys, use separate AzureKeyCredential instances with the
226226
# keys for each service
227227
# If you encounter a blocking error during a DefaultAzureCredential resolution, you can exclude the problematic credential by using a parameter (ex. exclude_shared_token_cache_credential=True)
@@ -237,7 +237,7 @@ async def setup_clients():
237237
token_cache_path=TOKEN_CACHE_PATH,
238238
)
239239

240-
# Set up clients for Cognitive Search and Storage
240+
# Set up clients for AI Search and Storage
241241
search_client = SearchClient(
242242
endpoint=f"https://{AZURE_SEARCH_SERVICE}.search.windows.net",
243243
index_name=AZURE_SEARCH_INDEX,

app/backend/approaches/chatreadretrieveread.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class ChatReadRetrieveReadApproach(Approach):
2323
NO_RESPONSE = "0"
2424

2525
"""
26-
Simple retrieve-then-read implementation, using the Cognitive Search and OpenAI APIs directly. It first retrieves
27-
top documents from search, then constructs a prompt with them, and then uses OpenAI to generate an completion
28-
(answer) with that prompt.
26+
A multi-step approach that first uses OpenAI to turn the user's question into a search query,
27+
then uses Azure AI Search to retrieve relevant documents, and then sends the conversation history,
28+
original user question, and search results to OpenAI to generate a response.
2929
"""
3030
system_message_chat_conversation = """Assistant helps the company employees with their healthcare plan questions, and questions about the employee handbook. Be brief in your answers.
3131
Answer ONLY with the facts listed in the list of sources below. If there isn't enough information below, say you don't know. Do not generate answers that don't use the sources below. If asking a clarifying question to the user would help, ask the question.
@@ -43,7 +43,7 @@ class ChatReadRetrieveReadApproach(Approach):
4343
Make sure the last question ends with ">>"."""
4444

4545
query_prompt_template = """Below is a history of the conversation so far, and a new question asked by the user that needs to be answered by searching in a knowledge base about employee healthcare plans and the employee handbook.
46-
You have access to Azure Cognitive Search index with 100's of documents.
46+
You have access to an Azure AI Search index with 100's of documents.
4747
Generate a search query based on the conversation and the new question.
4848
Do not include cited source filenames and document names e.g info.txt or doc.pdf in the search query terms.
4949
Do not include any text inside [] or <<>> in the search query terms.
@@ -102,7 +102,7 @@ async def run_until_final_call(
102102
functions = [
103103
{
104104
"name": "search_sources",
105-
"description": "Retrieve sources from the Azure Cognitive Search index",
105+
"description": "Retrieve sources from the Azure AI Search index",
106106
"parameters": {
107107
"type": "object",
108108
"properties": {

app/backend/approaches/retrievethenread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class RetrieveThenReadApproach(Approach):
1313
"""
14-
Simple retrieve-then-read implementation, using the Cognitive Search and OpenAI APIs directly. It first retrieves
14+
Simple retrieve-then-read implementation, using the AI Search and OpenAI APIs directly. It first retrieves
1515
top documents from search, then constructs a prompt with them, and then uses OpenAI to generate an completion
1616
(answer) with that prompt.
1717
"""

app/frontend/src/pages/layout/Layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const Layout = () => {
4242
</li>
4343
</ul>
4444
</nav>
45-
<h4 className={styles.headerRightText}>Azure OpenAI + Cognitive Search</h4>
45+
<h4 className={styles.headerRightText}>Azure OpenAI + AI Search</h4>
4646
{useLogin && <LoginButton />}
4747
</div>
4848
</header>

docs/customization.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ Typically, the primary backend code you'll want to customize is the `app/backend
2727

2828
The chat tab uses the approach programmed in [chatreadretrieveread.py](https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/app/backend/approaches/chatreadretrieveread.py).
2929

30-
1. It uses the ChatGPT API to turn the user question into a good search query.
31-
2. It queries Azure Cognitive Search for search results for that query (optionally using the vector embeddings for that query).
32-
3. It then combines the search results and original user question, and asks ChatGPT API to answer the question based on the sources. It includes the last 4K of message history as well (or however many tokens are allowed by the deployed model).
30+
1. It uses the OpenAI ChatCompletion API to turn the user question into a good search query.
31+
2. It queries Azure AI Search for search results for that query (optionally using the vector embeddings for that query).
32+
3. It then combines the search results and original user question, and asks OpenAI ChatCompletion API to answer the question based on the sources. It includes the last 4K of message history as well (or however many tokens are allowed by the deployed model).
3333

3434
The `system_message_chat_conversation` variable is currently tailored to the sample data since it starts with "Assistant helps the company employees with their healthcare plan questions, and questions about the employee handbook." Change that to match your data.
3535

3636
#### Ask approach
3737

3838
The ask tab uses the approach programmed in [retrievethenread.py](https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/app/backend/approaches/retrievethenread.py).
3939

40-
1. It queries Azure Cognitive Search for search results for the user question (optionally using the vector embeddings for that question).
41-
2. It then combines the search results and user question, and asks ChatGPT API to answer the question based on the sources.
40+
1. It queries Azure AI Search for search results for the user question (optionally using the vector embeddings for that question).
41+
2. It then combines the search results and user question, and asks OpenAI ChatCompletion API to answer the question based on the sources.
4242

4343
The `system_chat_template` variable is currently tailored to the sample data since it starts with "You are an intelligent assistant helping Contoso Inc employees with their healthcare plan questions and employee handbook questions." Change that to match your data.
4444

@@ -79,24 +79,24 @@ If you notice any answers that aren't as good as you'd like, here's a process fo
7979

8080
The first step is to identify where the problem is occurring. For example, if using the Chat tab, the problem could be:
8181

82-
1. ChatGPT is not generating a good search query based on the user question
83-
2. Azure Cognitive Search is not returning good search results for the query
84-
3. ChatGPT is not generating a good answer based on the search results and user question
82+
1. OpenAI ChatCompletion API is not generating a good search query based on the user question
83+
2. Azure AI Search is not returning good search results for the query
84+
3. OpenAI ChatCompletion API is not generating a good answer based on the search results and user question
8585

8686
You can look at the "Thought process" tab in the chat app to see each of those steps,
8787
and determine which one is the problem.
8888

89-
#### Improving ChatGPT results
89+
#### Improving OpenAI ChatCompletion results
9090

91-
If the problem is with ChatGPT (steps 1 or 3 above), you can try changing the relevant prompt.
91+
If the problem is with the ChatCompletion API calls (steps 1 or 3 above), you can try changing the relevant prompt.
9292

93-
Once you've changed the prompt, make sure you ask the same question multiple times to see if the overall quality has improved. ChatGPT can yield different results every time, even for a temperature of 0.0, but especially for a higher temperature than that (like our default of 0.7 for step 3).
93+
Once you've changed the prompt, make sure you ask the same question multiple times to see if the overall quality has improved. The ChatCompletion API can yield different results every time, even for a temperature of 0.0, but especially for a higher temperature than that (like our default of 0.7 for step 3).
9494

95-
You can also try changing the ChatGPT parameters, like temperature, to see if that improves results for your domain.
95+
You can also try changing the ChatCompletion parameters, like temperature, to see if that improves results for your domain.
9696

97-
#### Improving Azure Cognitive Search results
97+
#### Improving Azure AI Search results
9898

99-
If the problem is with Azure Cognitive Search (step 2 above), the first step is to check what search parameters you're using. Generally, the best results are found with hybrid search (text + vectors) plus the additional semantic re-ranking step, and that's what we've enabled by default. There may be some domains where that combination isn't optimal, however.
99+
If the problem is with Azure AI Search (step 2 above), the first step is to check what search parameters you're using. Generally, the best results are found with hybrid search (text + vectors) plus the additional semantic re-ranking step, and that's what we've enabled by default. There may be some domains where that combination isn't optimal, however.
100100

101101
##### Configuring parameters in the app
102102

@@ -107,7 +107,7 @@ You can change many of the search parameters in the "Developer settings" in the
107107
#### Configuring parameters in the Azure Portal
108108

109109
You may find it easier to experiment with search options with the index explorer in the Azure Portal.
110-
Open up the Azure Cognitive Search resource, select the Indexes tab, and select the index there.
110+
Open up the Azure AI Search resource, select the Indexes tab, and select the index there.
111111

112112
Then use the JSON view of the search explorer, and make sure you specify the same options you're using in the app. For example, this query represents a search with semantic ranker configured:
113113

docs/data_ingestion.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ The `scripts/prepdocs.py` script is responsible for both uploading and indexing
1010

1111
The script uses the following steps to index documents:
1212

13-
1. If it doesn't yet exist, create a new index in Azure Cognitive Search.
13+
1. If it doesn't yet exist, create a new index in Azure AI Search.
1414
2. Upload the PDFs to Azure Blob Storage.
1515
3. Split the PDFs into chunks of text.
16-
4. Upload the chunks to Azure Cognitive Search. If using vectors (the default), also compute the embeddings and upload those alongside the text.
16+
4. Upload the chunks to Azure AI Search. If using vectors (the default), also compute the embeddings and upload those alongside the text.
1717

1818
### Chunking
1919

20-
We're often asked why we need to break up the PDFs into chunks when Azure Cognitive Search supports searching large documents.
20+
We're often asked why we need to break up the PDFs into chunks when Azure AI Search supports searching large documents.
2121

2222
Chunking allows us to limit the amount of information we send to OpenAI due to token limits. By breaking up the content, it allows us to easily find potential chunks of text that we can inject into OpenAI. The method of chunking we use leverages a sliding window of text such that sentences that end one chunk will start the next. This allows us to reduce the chance of losing the context of the text.
2323

docs/productionizing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ to production. Here are some things to consider:
1616
* **Azure Storage**: The default storage account uses the `Standard_LRS` SKU.
1717
To improve your resiliency, we recommend using `Standard_ZRS` for production deployments,
1818
which you can specify using the `sku` property under the `storage` module in `infra/main.bicep`.
19-
* **Azure Cognitive Search**: The default search service uses the `Standard` SKU
19+
* **Azure AI Search**: The default search service uses the `Standard` SKU
2020
with the free semantic search option, which gives you 1000 free queries a month.
2121
Assuming your app will experience more than 1000 questions, you should either change `semanticSearch`
2222
to "standard" or disable semantic search entirely in the `/app/backend/approaches` files.
@@ -66,7 +66,7 @@ Open the locust UI at http://localhost:8089/, the URI displayed in the terminal.
6666

6767
Start a new test with the URI of your website, e.g. `https://my-chat-app.azurewebsites.net`.
6868
Do *not* end the URI with a slash. You can start by pointing at your localhost if you're concerned
69-
more about load on OpenAI/Cognitive Search than the host platform.
69+
more about load on OpenAI/AI Search than the host platform.
7070

7171
For the number of users and spawn rate, we recommend starting with 20 users and 1 users/second.
7272
From there, you can keep increasing the number of users to simulate your expected load.

infra/core/search/search-services.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
metadata description = 'Creates an Azure Cognitive Search instance.'
1+
metadata description = 'Creates an Azure AI Search instance.'
22
param name string
33
param location string = resourceGroup().location
44
param tags object = {}

scripts/manageacl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,17 @@ async def main(args: Any):
174174
parser.add_argument(
175175
"--search-service",
176176
required=True,
177-
help="Name of the Azure Cognitive Search service where content should be indexed (must exist already)",
177+
help="Name of the Azure AI Search service where content should be indexed (must exist already)",
178178
)
179179
parser.add_argument(
180180
"--index",
181181
required=True,
182-
help="Name of the Azure Cognitive Search index where content should be indexed (will be created if it doesn't exist)",
182+
help="Name of the Azure AI Search index where content should be indexed (will be created if it doesn't exist)",
183183
)
184184
parser.add_argument(
185185
"--search-key",
186186
required=False,
187-
help="Optional. Use this Azure Cognitive Search account key instead of the current user identity to login (use az login to set current user for Azure)",
187+
help="Optional. Use this Azure AI Search account key instead of the current user identity to login (use az login to set current user for Azure)",
188188
)
189189
parser.add_argument("--acl-type", required=False, choices=["oids", "groups"], help="Optional. Type of ACL")
190190
parser.add_argument(

scripts/prepdocs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,22 +175,22 @@ async def main(strategy: Strategy, credential: AsyncTokenCredential, args: Any):
175175
)
176176
parser.add_argument(
177177
"--searchservice",
178-
help="Name of the Azure Cognitive Search service where content should be indexed (must exist already)",
178+
help="Name of the Azure AI Search service where content should be indexed (must exist already)",
179179
)
180180
parser.add_argument(
181181
"--index",
182-
help="Name of the Azure Cognitive Search index where content should be indexed (will be created if it doesn't exist)",
182+
help="Name of the Azure AI Search index where content should be indexed (will be created if it doesn't exist)",
183183
)
184184
parser.add_argument(
185185
"--searchkey",
186186
required=False,
187-
help="Optional. Use this Azure Cognitive Search account key instead of the current user identity to login (use az login to set current user for Azure)",
187+
help="Optional. Use this Azure AI Search account key instead of the current user identity to login (use az login to set current user for Azure)",
188188
)
189189
parser.add_argument(
190190
"--searchanalyzername",
191191
required=False,
192192
default="en.microsoft",
193-
help="Optional. Name of the Azure Cognitive Search analyzer to use for the content field in the index",
193+
help="Optional. Name of the Azure AI Search analyzer to use for the content field in the index",
194194
)
195195
parser.add_argument("--openaihost", help="Host of the API used to compute embeddings ('azure' or 'openai')")
196196
parser.add_argument("--openaiservice", help="Name of the Azure OpenAI service used to compute embeddings")

0 commit comments

Comments
 (0)