Hi again Thibault Verlinde
Thats awesome finding the solution, so let me paste your solution below as you cant accept your own answer, accept the answer and this helps the other community members who face the same problem. Thanks very much for the contrubution.
This is the updated code:
//Initialisation of new index
var indexName = _srchClient.IndexName;
var vectorSearchConfigName = "vectorconfig-" + _options.ProjectName;
var vectorSearchProfileName = "vectorprofile-" + _options.ProjectName;
var vectorizerName = "vectorizer-" + _options.ProjectName;
//var semanticConfigName = "semanticconfig-" + _options.ProjectName;
var index = new SearchIndex(indexName)
{
VectorSearch = new()
{
Algorithms =
{
new HnswAlgorithmConfiguration(vectorSearchConfigName)
},
Profiles =
{
new VectorSearchProfile(vectorSearchProfileName, vectorSearchConfigName)
{
Vectorizer = vectorizerName
}
},
Vectorizers =
{
new AzureOpenAIVectorizer(vectorizerName)
{
AzureOpenAIParameters = new AzureOpenAIParameters()
{
ResourceUri = new Uri(_options.OAIEndpoint),
ApiKey = _options.OAIKey,
DeploymentId = _embeddingConfigs.EmbeddingModel
}
}
}
},
Fields =
{
new SimpleField("id", SearchFieldDataType.String) { IsKey = true },
new SearchableField("content") { AnalyzerName = LexicalAnalyzerName.StandardLucene },
new SimpleField("sourcePage", SearchFieldDataType.String) {IsFacetable = true},
new SimpleField("sourceFile", SearchFieldDataType.String) {IsFacetable = true},
new SearchField("embedding", SearchFieldDataType.Collection(SearchFieldDataType.Single))
{
VectorSearchDimensions = _embeddingConfigs.VectorSearchDimensions,
IsSearchable = true,
VectorSearchProfileName = vectorSearchProfileName
}
},
//When using free tier, this can't be used!
//SemanticSearch = new()
//{
// Configurations =
// {
// new SemanticConfiguration(semanticConfigName, new()
// {
// ContentFields =
// {
// new SemanticField("content")
// }
// })
// }
//}
};