Replies: 1 comment
-
|
At that exact tag,
The 1.51.0 source is here:
Because your code already creates the embedding, the direct replacement is: private static IVectorStoreRecordCollection<string, SqliteVectorRecord> _collection;
// ... create/upsert as before
var results = await _collection
.SearchEmbeddingAsync(embedding, top: 3)
.ToListAsync();
foreach (var match in results)
{
Console.WriteLine($"{match.Score}: {match.Record.Text}");
}The important type change is I would also align the package versions. The example mixes Semantic Kernel
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I'm working on a C# service that uses Semantic Kernel’s SqliteVectorStore together with GoogleAIEmbeddingGenerator (models/embedding-001) to store and search embeddings.
I’m running into a compilation issue when attempting to call GetNearestMatchesAsync on a SqliteVectorStoreRecordCollection.
Environment Details
NuGet Package Versions (from dotnet list package):
Environment:
Windows Server 2022
.NET SDK 8.0.401
Visual Studio 2022
Minimal Reproducible Code:
using Microsoft.SemanticKernel.Connectors.Google;
using Microsoft.SemanticKernel.Connectors.Sqlite;
using Microsoft.Extensions.VectorData;
using Microsoft.Extensions.VectorData.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace VectorSearchRepro
{
public class SqliteVectorRecord : IVectorStoreRecord
{
public string Id { get; set; } = string.Empty;
public string Text { get; set; } = string.Empty;
public ReadOnlyMemory Vector { get; set; }
#pragma warning disable SKEXP001
#pragma warning disable SKEXP0070
_generator = new GoogleAIEmbeddingGenerator(
modelId: "models/embedding-001",
apiKey: geminiApiKey);
#pragma warning restore SKEXP0070
#pragma warning restore SKEXP001
}
Error Message: 'IVectorStoreVectorCollection<string, SqliteVectorRecord>' does not contain a definition for 'GetNearestMatchesAsync'
and no accessible extension method 'GetNearestMatchesAsync' accepting a first argument of type
'IVectorStoreVectorCollection<string, SqliteVectorRecord>' could be found
(are you missing a using directive or an assembly reference?)
What I’ve Tried
Added using Microsoft.Extensions.VectorData;
Added using Microsoft.Extensions.VectorData.Core;
Verified _collection type is SqliteVectorStoreRecordCollection<string, SqliteVectorRecord>
Checked Semantic Kernel and VectorData assemblies for extension methods
No overload or extension method for nearest neighbor search appears to exist
Question
In Semantic Kernel v1.51.0 (with VectorData 9.x):
Where has the GetNearestMatchesAsync method been moved?
Which interface or class now exposes nearest-neighbor vector search for SqliteVectorStore collections?
Is there a new API (e.g., IVectorSearchCollection, IVectorQueryExecutor) that replaces this method?
If the API was refactored between 1.51.0-preview and 1.52.0-alpha, could you please point to the relevant example or PR?
Goal
I simply want to:
Generate embeddings using GoogleAIEmbeddingGenerator (models/embedding-001)
Store them in a local SQLite vector store
Perform semantic similarity search (kNN)
using Semantic Kernel’s built-in vector connectors.
Expected Behavior
_collection.GetNearestMatchesAsync() should return the top-N semantically similar text records.
Actual Behavior
Compilation fails — the method is no longer defined on IVectorStoreVectorCollection.
Beta Was this translation helpful? Give feedback.
All reactions