Add a tip and comment in search_documents function to this blog as shown below.
1. Add a TIP as below
TIP:
In this tutorial I used 5 PDF documents as an example, so I used '$top': 3, but if you're storing a large number of documents, I would recommend increasing this value as well.
2. Add a comment as below
ex. semantic kernel version
async def search_documents(question):
"""Search documents using Azure Cognitive Search"""
# Construct the Azure Cognitive Search service access URL
url = (SEARCH_SERVICE_ENDPOINT + 'indexes/' +
SEARCH_SERVICE_INDEX_NAME1 + '/docs')
# Create a parameter dictionary
params = {
'api-version': SEARCH_SERVICE_API_VERSION,
'search': question,
'select': '*',
'$top': 3, # '$top' means that when you search for something, only the top three documents in order of relevance to your question will be extracted from the search results.
'queryLanguage': 'en-us',
'queryType': 'semantic',
'semanticConfiguration': SEARCH_SERVICE_SEMANTIC_CONFIG_NAME,
'$count': 'true',
'speller': 'lexicon',
'answers': 'extractive|count-3',
'captions': 'extractive|highlight-false'
}
# Make a GET request to the Azure Cognitive Search service and store the response in a variable
resp = requests.get(url, headers=HEADERS, params=params)
# Return the JSON response containing the search results
return resp.json()
Add a tip and comment in search_documents function to this blog as shown below.
1. Add a TIP as below
TIP: In this tutorial I used 5 PDF documents as an example, so I used
'$top': 3
, but if you're storing a large number of documents, I would recommend increasing this value as well.2. Add a comment as below
ex. semantic kernel version