ExtensionsVectorData Lodestar.Extensions.VectorData - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Extensions.VectorData is 0.1.0 — read its documentation.

Home › ExtensionsVectorData

Lodestar.Extensions.VectorData

An in-process Microsoft.Extensions.VectorData store: collections of records with vector search ranked as Lodestar's EmbeddingIndex ranks, keyword search scored as its Bm25Index scores, and hybrid search fusing the two by reciprocal rank, each kept current one written record at a time. Nothing to deploy: the store lives in the process that uses it.

Note is any record class carrying a key, a text and a vector property.

Install

dotnet add package Lodestar.Extensions.VectorData

Example

using Lodestar.Extensions.VectorData;
using Microsoft.Extensions.VectorData;

static async Task<string> FuseAsync()
{
    using var notes = new LodestarVectorStoreCollection<string, Note>("notes");
    await notes.UpsertAsync([
        new Note { Id = "a", Text = "the cat sat on the mat", Embedding = new float[] { 1f, 0f, 0f } },
        new Note { Id = "b", Text = "the dog ran in the park", Embedding = new float[] { 0f, 1f, 0f } },
        new Note { Id = "c", Text = "an elephant crossed the river", Embedding = new float[] { 0f, 0f, 1f } },
    ]);

    List<VectorSearchResult<Note>> hits = await notes
        .HybridSearchAsync(new float[] { 1f, 0f, 0f }, ["elephant", "zebra"], 2)
        .ToListAsync();
    return string.Join(",", hits.Select(hit => hit.Record.Id));   // c,a
}

Parity

Its search sits on Lodestar.Embeddings and Lodestar.Text, which carry the parity; the store follows the Microsoft.Extensions.VectorData contracts. docs/equivalence.md maps each Python call to its C# counterpart, with every deliberate divergence.

Dependencies

An interop package (decision 0003), built for net10.0 and netstandard2.0:

  • Lodestar.Embeddings 0.8.0 or later
  • Lodestar.Text 0.7.0 or later
  • Microsoft.Extensions.VectorData.Abstractions 10.10.0 or later

Documentation

⚠️ **GitHub.com Fallback** ⚠️