JohnAziz thank you so much. I've been reading a lot in the past few days so I'm getting a clearer and clearer picture of how all this works.
I just have one more question, and hopefully you can give me some links for more reading
So when we use Azure OpenAi chat completion with Azure search extension connected to Azure Search AI. Something like this
ChatCompletionsOptions chatCompletionsOptions = new()
{
DeploymentName = modelName,
Messages =
{
new ChatMessage(
ChatRole.System,
"You are a helpful assistant "),
new ChatMessage(ChatRole.User, question)
},
AzureExtensionsOptions = new AzureChatExtensionsOptions()
{
Extensions =
{
search
}
}
};
where "search" in our case is defined as
var search=new AzureCognitiveSearchChatExtensionConfiguration()
{
SearchEndpoint = new Uri(_configuration.GetSection("AppSettings")["SearchEndPoint"]),
IndexName = "ai"
};
search.SetSearchKey(_configuration.GetSection("AppSettings")["SearchKey"]);
search.SemanticConfiguration="ai-semantic-config";
search.QueryType= AzureCognitiveSearchQueryType.Semantic;
search.EmbeddingEndpoint =new Uri(_configuration.GetSection("AppSettings")["AiEndPoint"]+"/openai/deployments/text-embedding-ada-002/embeddings?api-version=2023-07-01-preview");
///openai/deployments/{deployment-id}/embeddings?api-version={api-version}
search.SetEmbeddingKey(_configuration.GetSection("AppSettings")["AiKey"]);
search.FieldMappingOptions = new AzureCognitiveSearchIndexFieldMappingOptions()
{
UrlFieldName="Url",
TitleFieldName="Title",
}
;
search.FieldMappingOptions.ContentFieldNames.Add("Content");
search.FieldMappingOptions.ContentFieldNames.Add("Subtitle");
search.FieldMappingOptions.ContentFieldNames.Add("Authors");
//search.FieldMappingOptions.VectorFieldNames.Add("TitleVector");
search.FieldMappingOptions.VectorFieldNames.Add("ContentVector");
If I understand correctly retrieval from AI Search (basically RAG extracting) and passing x results from it to OpenAI is happening directly on Azure servers all is integrated, is this correct?
I'm curious to know the magic behind it :D. How do you recognise what is the user's query and what to pass to AI search,as a user can type e.g.
Give me all the information you have about Azure Search, especially about vector search.
My guess is this query will get less relevant results than just Azure Search + vector search query.
Also do you think that this integrated approach is better than us running a query on AI search, and then passing results to prompt
thanks