Skip to content

.Net: [Feature Branch] Vector Store Logging - #10865

Merged
Dmytro Struk (dmytrostruk) merged 12 commits into
microsoft:feature-vector-data-telemetryfrom
dmytrostruk:vector-store-logging
Mar 12, 2025
Merged

Dmytro Struk (dmytrostruk) merged 12 commits into
microsoft:feature-vector-data-telemetryfrom
dmytrostruk:vector-store-logging

Conversation

@dmytrostruk

@dmytrostruk Dmytro Struk (dmytrostruk) commented Mar 9, 2025 •

Copy link
Copy Markdown
Member

Motivation and Context

Related: #10596

This PR enhances the vector store functionality by adding builder pattern implementations and logging decorators for key vector data interfaces, along with supporting utilities and DI integration.

Interfaces handled:

  • IKeywordHybridSearch<TRecord>
  • IVectorizableTextSearch<TRecord>
  • IVectorizedSearch<TRecord>
  • IVectorStore
  • IVectorStoreRecordCollection<TKey, TRecord>

Class types added:

  • Builders: implement a pipeline pattern with Use and Build methods.
  • Logging Extensions: provide reusable logging methods for tasks and enumerables, handling success, failure and cancellation.
  • Logging Decorators: wrap the interfaces to add logging by using LoggingExtensions reusable logging methods.
  • Builder Extensions: Add AsBuilder methods to convert service instances into builders.
  • Logging Builder Extensions: Add UseLogging methods to integrate logging into builder pipelines.
  • Service Collection Extensions: Add Add{T} and AddKeyed{T} methods for DI registration with configurable lifetimes.

Other changes:

  • Split Verify class into Verify and KernelVerify in order to be able to use Verify methods in Microsoft.Extensions.VectorData package without a reference to Semantic Kernel specific logic, like ValidPluginName, ValidFunctionName etc.
  • Added unit tests for new classes and methods.
  • Added usage example in Concepts/Memory folder.

Usage example

Logging with manual registration:

var vectorStore = new InMemoryVectorStore()
    .AsBuilder()
    .UseLogging(this.LoggerFactory)
    .Build();

Logging with DI:

serviceCollection.AddInMemoryVectorStore();

serviceCollection
    .AddVectorStore(s => s.GetRequiredService<InMemoryVectorStore>())
    .UseLogging(this.LoggerFactory);

Contribution Checklist

@markwallace-microsoft Mark Wallace (markwallace-microsoft) added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Mar 10, 2025
@github-actions github-actions Bot changed the title [Feature Branch] .Net: Vector Store Logging .Net: [Feature Branch] .Net: Vector Store Logging Mar 10, 2025
@dmytrostruk Dmytro Struk (dmytrostruk) changed the title .Net: [Feature Branch] .Net: Vector Store Logging .Net: [Feature Branch] Vector Store Logging Mar 10, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some documentation updates (I didn't comment everywhere) and the question about adding the same instance twice.

This branch was previously deployed

1 inactive deployment
integration — 450aea6b Deployed Mar 11, 2025 by dmytrostruk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants