@Syedbabar Ali To make sure that OpenAI API only answers your questions with information from your provided data, you can use Azure Cognitive Search to index your data and then use the search results to generate responses using OpenAI API.
- Here are the general steps to follow:
Create an Azure Cognitive Search index and import your data into it. You can follow the steps in the Quickstart: Create a search index using REST APIs to create an index and import data into it. - Use the Azure Cognitive Search REST API to query the index and retrieve relevant search results based on the user's question. You can use the Search Documents REST API to query the index and retrieve relevant search results. Here's an example of a search query:
POST https://[<span class=" active-doc-3" data-doc-items="3">service name].search.windows.net/indexes/[index name]/docs/search?api-version=[api-version[2](#doc-pos=3)</span>]
Content-Type: application/json
api-key: [admin key]
{
"search": "your search query",
"queryType": "full",
"searchFields": "comma-separated list of fields to search in",
"select": "comma-separated list of fields to retrieve",
"highlight": "comma-separated list of fields to highlight",
"filter": "filter expression",
"orderby": "comma-separated list of fields to sort by",
"skip": "number of search results to skip",
"top": "number of search results to retrieve"
}
- Pass the search results to the OpenAI API to generate a response that is based on the retrieved search results. You can use the Azure Cognitive Services Text Analytics API to analyze the search results and extract relevant information. Then, you can pass this information to the OpenAI API to generate a response that is based on the retrieved search results.
By doing this, you can ensure that the responses generated by the OpenAI API are based on the data that you have provided in your Azure Cognitive Search index.