diff --git a/app/Directory.Packages.props b/app/Directory.Packages.props
index 167e5fbc..d6a015e5 100644
--- a/app/Directory.Packages.props
+++ b/app/Directory.Packages.props
@@ -5,43 +5,43 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
+
+
\ No newline at end of file
diff --git a/app/app.sln b/app/app.sln
index 05b1fd31..8f03a782 100644
--- a/app/app.sln
+++ b/app/app.sln
@@ -12,7 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
..\.gitignore = ..\.gitignore
..\.github\workflows\azure-dev.yml = ..\.github\workflows\azure-dev.yml
- Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
..\.github\workflows\dotnet-build.yml = ..\.github\workflows\dotnet-build.yml
..\LICENSE = ..\LICENSE
diff --git a/app/backend/Extensions/SearchClientExtensions.cs b/app/backend/Extensions/SearchClientExtensions.cs
index 6e01e52f..f4e64c59 100644
--- a/app/backend/Extensions/SearchClientExtensions.cs
+++ b/app/backend/Extensions/SearchClientExtensions.cs
@@ -18,16 +18,22 @@ internal static class SearchClientExtensions
var useSemanticRanker = overrides?.SemanticRanker ?? false;
var useSemanticCaptions = overrides?.SemanticCaptions ?? false;
- SearchOptions searchOption = useSemanticRanker
+ SearchOptions searchOptions = useSemanticRanker
? new SearchOptions
{
Filter = filter,
QueryType = SearchQueryType.Semantic,
- QueryLanguage = "en-us",
- QuerySpeller = "lexicon",
- SemanticConfigurationName = "default",
+ SemanticSearch = new()
+ {
+ SemanticConfigurationName = "default",
+ QueryCaption = new(useSemanticCaptions
+ ? QueryCaptionType.Extractive
+ : QueryCaptionType.None),
+ },
+ // TODO: Find if these options are assignable
+ //QueryLanguage = "en-us",
+ //QuerySpeller = "lexicon",
Size = top,
- QueryCaption = useSemanticCaptions ? QueryCaptionType.Extractive : QueryCaptionType.None,
}
: new SearchOptions
{
@@ -38,19 +44,18 @@ internal static class SearchClientExtensions
if (embedding != null && overrides?.RetrievalMode != "Text")
{
var k = useSemanticRanker ? 50 : top;
- var vectorQuery = new RawVectorQuery
+ var vectorQuery = new VectorizedQuery(embedding)
{
// if semantic ranker is enabled, we need to set the rank to a large number to get more
// candidates for semantic reranking
KNearestNeighborsCount = useSemanticRanker ? 50 : top,
- Vector = embedding,
};
vectorQuery.Fields.Add("embedding");
- searchOption.VectorQueries.Add(vectorQuery);
+ searchOptions.VectorSearch.Queries.Add(vectorQuery);
}
var searchResultResponse = await searchClient.SearchAsync(
- query, searchOption, cancellationToken);
+ query, searchOptions, cancellationToken);
if (searchResultResponse.Value is null)
{
throw new InvalidOperationException("fail to get search result");
@@ -77,7 +82,7 @@ internal static class SearchClientExtensions
{
if (useSemanticCaptions)
{
- var docs = doc.Captions.Select(c => c.Text);
+ var docs = doc.SemanticSearch.Captions.Select(c => c.Text);
contentValue = string.Join(" . ", docs);
}
else
@@ -98,6 +103,6 @@ internal static class SearchClientExtensions
}
}
- return sb.ToArray();
+ return [.. sb];
}
}
diff --git a/app/backend/GlobalUsings.cs b/app/backend/GlobalUsings.cs
index ffb07be4..b733fcc6 100644
--- a/app/backend/GlobalUsings.cs
+++ b/app/backend/GlobalUsings.cs
@@ -2,7 +2,6 @@
global using System.Diagnostics;
global using System.Runtime.CompilerServices;
-global using System.Text;
global using System.Text.Json;
global using Azure.AI.FormRecognizer.DocumentAnalysis;
global using Azure.AI.OpenAI;
diff --git a/app/functions/EmbedFunctions/Program.cs b/app/functions/EmbedFunctions/Program.cs
index abe3c22a..5b1093d6 100644
--- a/app/functions/EmbedFunctions/Program.cs
+++ b/app/functions/EmbedFunctions/Program.cs
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using Azure.AI.OpenAI;
-using Microsoft.Extensions.DependencyInjection;
var host = new HostBuilder()
.ConfigureServices(services =>
diff --git a/app/functions/EmbedFunctions/Services/AzureSearchEmbedService.cs b/app/functions/EmbedFunctions/Services/AzureSearchEmbedService.cs
index 1e7ff8da..7fe50d34 100644
--- a/app/functions/EmbedFunctions/Services/AzureSearchEmbedService.cs
+++ b/app/functions/EmbedFunctions/Services/AzureSearchEmbedService.cs
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
using Azure.AI.OpenAI;
-using Google.Protobuf.WellKnownTypes;
-using Microsoft.Extensions.Options;
namespace EmbedFunctions.Services;
@@ -61,48 +59,45 @@ public async Task CreateSearchIndexAsync(string searchIndexName)
VectorSearch = new()
{
Algorithms =
- {
- new HnswVectorSearchAlgorithmConfiguration(vectorSearchConfigName)
- },
+ {
+ new HnswAlgorithmConfiguration(vectorSearchConfigName)
+ },
Profiles =
- {
- new VectorSearchProfile(vectorSearchProfile, vectorSearchConfigName)
- }
+ {
+ new VectorSearchProfile(vectorSearchProfile, vectorSearchConfigName)
+ }
},
Fields =
- {
- new SimpleField("id", SearchFieldDataType.String) { IsKey = true },
- new SearchableField("content") { AnalyzerName = LexicalAnalyzerName.EnMicrosoft },
- new SimpleField("category", SearchFieldDataType.String) { IsFacetable = true },
- new SimpleField("sourcepage", SearchFieldDataType.String) { IsFacetable = true },
- new SimpleField("sourcefile", SearchFieldDataType.String) { IsFacetable = true },
- new SearchField("embedding", SearchFieldDataType.Collection(SearchFieldDataType.Single))
{
- VectorSearchDimensions = 1536,
- IsSearchable = true,
- VectorSearchProfile = vectorSearchProfile,
- }
- },
- SemanticSettings = new SemanticSettings
+ new SimpleField("id", SearchFieldDataType.String) { IsKey = true },
+ new SearchableField("content") { AnalyzerName = LexicalAnalyzerName.EnMicrosoft },
+ new SimpleField("category", SearchFieldDataType.String) { IsFacetable = true },
+ new SimpleField("sourcepage", SearchFieldDataType.String) { IsFacetable = true },
+ new SimpleField("sourcefile", SearchFieldDataType.String) { IsFacetable = true },
+ new SearchField("embedding", SearchFieldDataType.Collection(SearchFieldDataType.Single))
+ {
+ VectorSearchDimensions = 1536,
+ IsSearchable = true,
+ VectorSearchProfileName = vectorSearchProfile,
+ }
+ },
+ SemanticSearch = new()
{
Configurations =
- {
- new SemanticConfiguration("default", new PrioritizedFields
{
- ContentFields =
+ new SemanticConfiguration("default", new()
{
- new SemanticField
+ ContentFields =
{
- FieldName = "content"
+ new SemanticField("content")
}
- }
- })
- }
+ })
+ }
}
};
logger?.LogInformation(
- "Creating '{searchIndexName}' search index", searchIndexName);
+ "Creating '{searchIndexName}' search index", searchIndexName);
await searchIndexClient.CreateIndexAsync(index);
}
diff --git a/app/functions/EmbedFunctions/Services/EmbeddingAggregateService.cs b/app/functions/EmbedFunctions/Services/EmbeddingAggregateService.cs
index b946e5cc..96a96bf7 100644
--- a/app/functions/EmbedFunctions/Services/EmbeddingAggregateService.cs
+++ b/app/functions/EmbedFunctions/Services/EmbeddingAggregateService.cs
@@ -1,7 +1,5 @@
// Copyright (c) Microsoft. All rights reserved.
-using System.IO;
-
namespace EmbedFunctions.Services;
public sealed class EmbeddingAggregateService(
diff --git a/app/prepdocs/PrepareDocs/GlobalUsings.cs b/app/prepdocs/PrepareDocs/GlobalUsings.cs
index d1ec4967..4347d723 100644
--- a/app/prepdocs/PrepareDocs/GlobalUsings.cs
+++ b/app/prepdocs/PrepareDocs/GlobalUsings.cs
@@ -4,15 +4,12 @@
global using System.CommandLine.Invocation;
global using System.CommandLine.Parsing;
global using System.Linq;
-global using System.Net;
-global using System.Text;
global using System.Text.RegularExpressions;
global using Azure;
global using Azure.AI.FormRecognizer.DocumentAnalysis;
global using Azure.Identity;
global using Azure.Search.Documents;
global using Azure.Search.Documents.Indexes;
-global using Azure.Search.Documents.Indexes.Models;
global using Azure.Search.Documents.Models;
global using Azure.Storage.Blobs;
global using Azure.Storage.Blobs.Models;
diff --git a/app/prepdocs/PrepareDocs/Program.Clients.cs b/app/prepdocs/PrepareDocs/Program.Clients.cs
index dff6bf52..588946f1 100644
--- a/app/prepdocs/PrepareDocs/Program.Clients.cs
+++ b/app/prepdocs/PrepareDocs/Program.Clients.cs
@@ -2,7 +2,6 @@
using EmbedFunctions.Services;
-using Microsoft.Extensions.Logging;
internal static partial class Program
{