public async Task AddAsync()

in src/WebJobs.Extensions.OpenAI/Embeddings/EmbeddingsStoreConverter.cs [78:99]


        public async Task AddAsync(SearchableDocument item, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrEmpty(this.attribute.StoreConnectionName))
            {
                throw new InvalidOperationException("No connection string information was provided.");
            }
            else if (string.IsNullOrEmpty(this.attribute.Collection))
            {
                throw new InvalidOperationException("No collection name information was provided.");
            }

            // Get embeddings from OpenAI
            EmbeddingsContext embeddingsContext = await EmbeddingsHelper.
                GenerateEmbeddingsAsync(this.attribute, this.openAIClientFactory, this.logger, cancellationToken);

            // Add document to the embed store
            item.Embeddings = embeddingsContext;
            item.ConnectionInfo = new ConnectionInfo(this.attribute.StoreConnectionName, this.attribute.Collection);
            this.logger.LogInformation("Adding document to the embed store.");
            await this.searchProvider.AddDocumentAsync(item, cancellationToken);
            this.logger.LogInformation("Finished adding document to the embed store.");
        }