Repository: microsoft/semantic-kernel
File: dotnet/src/SemanticKernel.Core/Functions/ContextualSelection/ContextualFunctionProvider.cs (C#)

Code before:
{
    // Determines how many recent messages, in addition to the configured number of recent messages for context, should be kept in the queue.
    // This ensures that the recent messages (messages from previous invocations) are not pushed out of the queue by
    // the new messages enqueued during the current invocation.
    private const int RecentMessagesBufferSize = 20;
    private readonly FunctionStore _functionStore;
    private readonly ConcurrentQueue<ChatMessage> _recentMessages = [];
    private readonly ContextualFunctionProviderOptions _options;
    private bool _areFunctionsVectorized = false;

    /// <summary>
    /// Initializes a new instance of the <see cref="ContextualFunctionProvider"/> class.
    /// </summary>
    /// <param name="vectorStore">An instance of a vector store.</param>
    /// <param name="vectorDimensions">The number of dimensions to use for the memory embeddings.</param>
    /// <param name="functions">The functions to vectorize and store for searching related functions.</param>
    /// <param name="maxNumberOfFunctions">The maximum number of relevant functions to retrieve from the vector store.</param>
    /// <param name="loggerFactory">The logger factory to use for logging. If not provided, no logging will be performed.</param>
    /// <param name="options">The provider options.</param>
    /// <param name="collectionName">The collection name to use for storing and retrieving functions.</param>
    public ContextualFunctionProvider(
        VectorStore vectorStore,
        int vectorDimensions,
        IEnumerable<AIFunction> functions,
        int maxNumberOfFunctions,
        ILoggerFactory? loggerFactory = default,
        ContextualFunctionProviderOptions? options = null,
        string collectionName = "functions")
    {
        Verify.NotNull(vectorStore);
        Verify.True(vectorDimensions > 0, "Vector dimensions must be greater than 0");
        Verify.NotNull(functions);
        Verify.True(maxNumberOfFunctions > 0, "Max number of functions must be greater than 0");
        Verify.NotNullOrWhiteSpace(collectionName);

        this._options = options ?? new ContextualFunctionProviderOptions();
        Verify.True(this._options.NumberOfRecentMessagesInContext > 0, "Number of recent messages to include into context must be greater than 0");

        this._functionStore = new FunctionStore(
            vectorStore,
            collectionName,
            vectorDimensions,
            functions,
            maxNumberOfFunctions,
            loggerFactory,
            options: new()
            {
                EmbeddingValueProvider = this._options.EmbeddingValueProvider,
            }
         );
    }

Review comment (suggestion):
nit.
Normally I see `null`, curious why is different here.

```suggestion
        ILoggerFactory? loggerFactory = null,
```

Code after:
{
    // Determines how many recent messages, in addition to the configured number of recent messages for context, should be kept in the queue.
    // This ensures that the recent messages (messages from previous invocations) are not pushed out of the queue by
    // the new messages enqueued during the current invocation.
    private const int RecentMessagesBufferSize = 20;
    private readonly FunctionStore _functionStore;
    private readonly ConcurrentQueue<ChatMessage> _recentMessages = [];
    private readonly ContextualFunctionProviderOptions _options;
    private bool _areFunctionsVectorized = false;

    /// <summary>
    /// Initializes a new instance of the <see cref="ContextualFunctionProvider"/> class.
    /// </summary>
    /// <param name="vectorStore">An instance of a vector store.</param>
    /// <param name="vectorDimensions">The number of dimensions to use for the memory embeddings.</param>
    /// <param name="functions">The functions to vectorize and store for searching related functions.</param>
    /// <param name="maxNumberOfFunctions">The maximum number of relevant functions to retrieve from the vector store.</param>
    /// <param name="loggerFactory">The logger factory to use for logging. If not provided, no logging will be performed.</param>
    /// <param name="options">The provider options.</param>
    /// <param name="collectionName">The collection name to use for storing and retrieving functions.</param>
    public ContextualFunctionProvider(
        VectorStore vectorStore,
        int vectorDimensions,
        IEnumerable<AIFunction> functions,
        int maxNumberOfFunctions,
        ILoggerFactory? loggerFactory = null,
        ContextualFunctionProviderOptions? options = null,
        string collectionName = "functions")
    {
        Verify.NotNull(vectorStore);
        Verify.True(vectorDimensions > 0, "Vector dimensions must be greater than 0");
        Verify.NotNull(functions);
        Verify.True(maxNumberOfFunctions > 0, "Max number of functions must be greater than 0");
        Verify.NotNullOrWhiteSpace(collectionName);

        this._options = options ?? new ContextualFunctionProviderOptions();
        Verify.True(this._options.NumberOfRecentMessagesInContext > 0, "Number of recent messages to include into context must be greater than 0");

        this._functionStore = new FunctionStore(
            vectorStore,
            collectionName,
            vectorDimensions,
            functions,
            maxNumberOfFunctions,
            loggerFactory,
            options: new()
            {
                EmbeddingValueProvider = this._options.EmbeddingValueProvider,
            }
         );
    }