in src/WebJobs.Extensions.OpenAI.AzureAISearch/AzureAISearchProvider.cs [80:96]
public async Task AddDocumentAsync(SearchableDocument document, CancellationToken cancellationToken)
{
if (document.ConnectionInfo is null)
{
throw new ArgumentNullException(nameof(document.ConnectionInfo));
}
this.searchConnectionNamePrefix = document.ConnectionInfo.ConnectionName;
this.SetConfigSectionProperties();
SearchIndexClient searchIndexClient = this.GetSearchIndexClient(document.ConnectionInfo);
SearchClient searchClient = this.GetSearchClient(document.ConnectionInfo);
await this.CreateIndexIfDoesntExist(searchIndexClient, document.ConnectionInfo.CollectionName ?? defaultSearchIndexName, cancellationToken);
await this.IndexSectionsAsync(searchClient, document, cancellationToken);
}