Class AzureAISearchService
- Namespace
- FoundationaLLM.Common.Services.Azure
- Assembly
- FoundationaLLM.Common.dll
Implements the Azure AI Search Service.
public class AzureAISearchService : IAzureAISearchService
- Inheritance
-
AzureAISearchService
- Implements
- Inherited Members
- Extension Methods
Constructors
AzureAISearchService(SearchIndexClient, ILogger<AzureAISearchService>)
Implements the Azure AI Search Service.
public AzureAISearchService(SearchIndexClient searchIndexClient, ILogger<AzureAISearchService> logger)
Parameters
searchIndexClient
SearchIndexClientThe Azure SDK client for the Azure AI Search service.
logger
ILogger<AzureAISearchService>The logger used for logging.
Methods
CreateIndexIfNotExists(string, IEnumerable<SearchField>, VectorSearch?)
Creates an index in the Azure AI Search service if it does not already exist.
public Task CreateIndexIfNotExists(string indexName, IEnumerable<SearchField> indexFields, VectorSearch? indexConfiguration = null)
Parameters
indexName
stringThe name of the index to create.
indexFields
IEnumerable<SearchField>The list of fields for the newly created index.
indexConfiguration
VectorSearchThe optionsl vectorization configuration for the newly created index.
Returns
CreateSearchIndexClient(Dictionary<string, object>)
Creates a new instance of the SearchIndexClient class using a dictionary of parameter values.
public static SearchIndexClient CreateSearchIndexClient(Dictionary<string, object> clientParameters)
Parameters
clientParameters
Dictionary<string, object>The dictionary of parameter values used to create the client instance.
Returns
- SearchIndexClient
The requested client instance.
Exceptions
UploadDocuments(string, List<string>, List<object[]>)
Uploads documents to the specified index in the Azure AI Search service.
public Task UploadDocuments(string indexName, List<string> fieldNames, List<object[]> fieldValues)
Parameters
indexName
stringThe name of the index in which the documents should be uploaded.
fieldNames
List<string>The names of the fields of the documents.
fieldValues
List<object[]>The values of the fields of the documents.