![]() |
VOOZH | about |
dotnet add package Mythosia.VectorDb.InMemory --version 4.1.0
NuGet\Install-Package Mythosia.VectorDb.InMemory -Version 4.1.0
<PackageReference Include="Mythosia.VectorDb.InMemory" Version="4.1.0" />
<PackageVersion Include="Mythosia.VectorDb.InMemory" Version="4.1.0" />Directory.Packages.props
<PackageReference Include="Mythosia.VectorDb.InMemory" />Project file
paket add Mythosia.VectorDb.InMemory --version 4.1.0
#r "nuget: Mythosia.VectorDb.InMemory, 4.1.0"
#:package Mythosia.VectorDb.InMemory@4.1.0
#addin nuget:?package=Mythosia.VectorDb.InMemory&version=4.1.0Install as a Cake Addin
#tool nuget:?package=Mythosia.VectorDb.InMemory&version=4.1.0Install as a Cake Tool
Provides InMemoryVectorStore, a thread-safe in-memory implementation of IVectorStore using cosine similarity search.
Suitable for development, testing, and small-scale workloads.
Automatically used as the default vector store in Mythosia.AI.Rag:
// Explicit selection (same as default)
.WithRag(rag => rag
.AddDocument("docs.txt")
.UseInMemoryStore()
)
ConcurrentDictionary for safe concurrent access[0, 1]VectorFilter operator set (Eq/Ne/In/NotIn/Gt/Gte/Lt/Lte/Like/Exists/NotExists, And/Or groups)IRagDiagnosticsStore: ListAllRecordsAsync, ScoredListAsync, GetTotalRecordCountusing Mythosia.VectorDb;
using Mythosia.VectorDb.InMemory;
var store = new InMemoryVectorStore();
await store.UpsertAsync(new VectorRecord
{
Id = "doc-1",
Content = "Some text content",
Vector = new float[] { 0.1f, 0.2f, 0.3f },
Metadata =
{
["source"] = "manual.txt",
["namespace"] = "my-namespace",
["scope"] = "tenant-1"
}
});
var filter = new VectorFilter()
.Where("namespace", "my-namespace")
.Where("scope", "tenant-1");
var results = await store.SearchAsync(queryVector, topK: 5, filter: filter);
Bm25Index provides in-memory BM25 keyword search for hybrid retrieval. When UseHybridSearch() is called with InMemoryVectorStore, the RAG pipeline automatically builds a BM25 index alongside the vector store and merges results via RRF.
// Automatic — just enable hybrid search in the builder
var store = await RagStore.BuildAsync(config => config
.AddText("환불은 14일 이내 가능합니다.", id: "refund")
.UseLocalEmbedding(512)
.UseInMemoryStore()
.UseHybridSearch() // BM25 index is built automatically
);
Standalone usage:
using Mythosia.VectorDb.InMemory;
var bm25 = new Bm25Index();
bm25.Index("doc1", "machine learning neural network");
bm25.Index("doc2", "cooking recipe pasta");
var results = bm25.Search("machine learning", topK: 5);
// results[0].Id == "doc1", results[0].Score > 0
When hybrid search is used, fused RRF scores are normalized to the [0, 1] range so VectorFilter.MinScore is applied consistently to the final merged score.
For the full operator reference and fluent API examples (Where, WhereNot, WhereIn, WhereLike, WhereExists, Or, And, WithMinScore, etc.), see the .
InMemory-specific note: Range operators (
WhereGreaterThan,WhereLessThan, etc.) usestring.Compare(ordinal). Store numeric values zero-padded (e.g."0042") for correct ordering.
// Fetch multiple records by ID in one call
var filter = new VectorFilter().Where("namespace", "docs");
var records = await store.GetBatchAsync(new[] { "id-1", "id-2", "id-3" }, filter);
// Count all records matching a filter
long count = await store.CountAsync(new VectorFilter().Where("namespace", "docs"));
// Count with additional metadata filter
long filtered = await store.CountAsync(
new VectorFilter().Where("namespace", "docs").Where("storage_id", storageId));
GetBatchAsync performs O(1)-per-ID lookups via ConcurrentDictionary.TryGetValue — no vector scoring, just direct key access. Records not found or not matching the filter are omitted.
InMemoryVectorStore implements IDisposable. A Bm25Index (Lucene writer, analyzer, RAMDirectory) is maintained alongside the vector store. Dispose the store when it is no longer needed to release these resources:
using var store = new InMemoryVectorStore();
// ... use store
// Lucene resources released on Dispose
ReplaceByFilterAsync is available via the IVectorStore default interface method. It performs sequential DeleteByFilterAsync → UpsertBatchAsync (non-transactional, suitable for in-memory usage):
IVectorStore store = new InMemoryVectorStore();
var filter = new VectorFilter()
.Where("full_path", "/docs/file.md");
await store.ReplaceByFilterAsync(filter, newRecords);
For transactional guarantees (zero query gap), use PostgresStore which wraps both operations in a single database transaction.
IVectorStore (e.g., Qdrant, Chroma, Pinecone)| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on Mythosia.VectorDb.InMemory:
| Package | Downloads |
|---|---|
|
Mythosia.AI.Rag
RAG (Retrieval Augmented Generation) orchestration for Mythosia.AI. Implements Mythosia.AI.Rag.Abstractions v6.x. Includes RagPipeline, text splitters, context builder, OpenAI/vLLM embedding providers, hybrid search (BM25 + Vector + RRF), re-ranking (Cohere, LLM, vLLM), Agentic RAG tool registration with per-call RagQueryOptions and structured search traces, search gate, keyword extraction, weighted-blend final selection, progress reporting, DoclingDocument-to-RagDocument conversion, and per-query VectorFilter passthrough (StoreFilter). Depends on Mythosia.AI.Abstractions (IAIService) instead of the full Mythosia.AI implementation. |
This package is not used by any popular GitHub repositories.
v4.1.0: Removed obsolete namespace parameter from diagnostic methods (ListAllRecordsAsync, ScoredListAsync). Use VectorFilter for filtering instead.