LangChain.Databases.Postgres
0.17.1-dev.42
See the version list below for details.
dotnet add package LangChain.Databases.Postgres --version 0.17.1-dev.42
NuGet\Install-Package LangChain.Databases.Postgres -Version 0.17.1-dev.42
<PackageReference Include="LangChain.Databases.Postgres" Version="0.17.1-dev.42" />
<PackageVersion Include="LangChain.Databases.Postgres" Version="0.17.1-dev.42" />
<PackageReference Include="LangChain.Databases.Postgres" />
paket add LangChain.Databases.Postgres --version 0.17.1-dev.42
#r "nuget: LangChain.Databases.Postgres, 0.17.1-dev.42"
#:package LangChain.Databases.Postgres@0.17.1-dev.42
#addin nuget:?package=LangChain.Databases.Postgres&version=0.17.1-dev.42&prerelease
#tool nuget:?package=LangChain.Databases.Postgres&version=0.17.1-dev.42&prerelease
LangChain.Databases
Database abstractions and vector store backends for the LangChain.NET ecosystem.
Philosophy
This project aligns with the Microsoft.Extensions ecosystem. For vector search, we use Microsoft.Extensions.VectorData.Abstractions (MEVA) — the industry-standard .NET vector data abstraction. For backends that have official Semantic Kernel connectors, consumers should reference those packages directly rather than using wrappers.
Packages
Vector stores (MEVA implementations)
These packages implement VectorStore / VectorStoreCollection<TKey, TRecord> from Microsoft.Extensions.VectorData:
| Package | Backend | NuGet |
|---|---|---|
LangChain.Databases.Postgres |
PostgreSQL + pgvector | |
LangChain.Databases.OpenSearch |
OpenSearch k-NN |
Chat message history
| Package | Backend | NuGet |
|---|---|---|
LangChain.Databases.Abstractions |
In-memory, file-based | |
LangChain.Databases.Redis |
Redis | |
LangChain.Databases.Mongo |
MongoDB |
Use SK connectors for other backends
For backends with official Semantic Kernel connectors, use those packages directly:
| Backend | SK Connector Package |
|---|---|
| In-Memory | Microsoft.SemanticKernel.Connectors.InMemory |
| SQLite | Microsoft.SemanticKernel.Connectors.Sqlite |
| Chroma | Microsoft.SemanticKernel.Connectors.Chroma |
| Qdrant | Microsoft.SemanticKernel.Connectors.Qdrant |
| Pinecone | Microsoft.SemanticKernel.Connectors.Pinecone |
| Weaviate | Microsoft.SemanticKernel.Connectors.Weaviate |
| Milvus | Microsoft.SemanticKernel.Connectors.Milvus |
| DuckDB | Microsoft.SemanticKernel.Connectors.DuckDB |
| Azure AI Search | Microsoft.SemanticKernel.Connectors.AzureAISearch |
| Redis (vector) | Microsoft.SemanticKernel.Connectors.Redis |
| MongoDB (vector) | Microsoft.SemanticKernel.Connectors.MongoDB |
Quick start
1. Define a record type
using Microsoft.Extensions.VectorData;
public class DocumentRecord
{
[VectorStoreKey]
public string Id { get; set; } = Guid.NewGuid().ToString();
[VectorStoreData]
public string Text { get; set; } = string.Empty;
[VectorStoreVector(1536)]
public ReadOnlyMemory<float> Embedding { get; set; }
}
2. Create a store and collection
// PostgreSQL + pgvector
var store = new PostgresVectorStore(connectionString);
// Or OpenSearch
var store = new OpenSearchVectorStore(new OpenSearchVectorDatabaseOptions
{
ConnectionUri = new Uri("http://localhost:9200"),
});
// Or SK InMemory
var store = new InMemoryVectorStore();
var collection = store.GetCollection<string, DocumentRecord>("my_collection");
await collection.EnsureCollectionExistsAsync();
3. Upsert and search
await collection.UpsertAsync(new DocumentRecord
{
Text = "hello world",
Embedding = embedding,
});
await foreach (var result in collection.SearchAsync(
new ReadOnlyMemory<float>(queryEmbedding), top: 5))
{
Console.WriteLine($"{result.Record.Text} (score: {result.Score})");
}
Migration from IVectorDatabase
The legacy IVectorDatabase / IVectorCollection interfaces have been removed in favor of MEVA. See the migration guide for detailed before/after examples.
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.VectorData.Abstractions (>= 10.1.0)
- Npgsql (>= 10.0.2)
- Pgvector (>= 0.3.2)
-
net8.0
- Microsoft.Extensions.VectorData.Abstractions (>= 10.1.0)
- Npgsql (>= 10.0.2)
- Pgvector (>= 0.3.2)
- System.Text.Json (>= 10.0.5)
-
net9.0
- Microsoft.Extensions.VectorData.Abstractions (>= 10.1.0)
- Npgsql (>= 10.0.2)
- Pgvector (>= 0.3.2)
- System.Text.Json (>= 10.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.17.1-dev.46 | 33 | 4/1/2026 |
| 0.17.1-dev.44 | 44 | 3/29/2026 |
| 0.17.1-dev.42 | 35 | 3/21/2026 |
| 0.17.1-dev.41 | 37 | 3/21/2026 |
| 0.17.1-dev.40 | 39 | 3/21/2026 |
| 0.17.1-dev.39 | 38 | 3/21/2026 |
| 0.17.1-dev.37 | 34 | 3/20/2026 |
| 0.17.1-dev.36 | 35 | 3/20/2026 |
| 0.17.1-dev.35 | 40 | 3/20/2026 |
| 0.17.1-dev.32 | 39 | 3/20/2026 |
| 0.17.1-dev.31 | 34 | 3/20/2026 |
| 0.17.1-dev.30 | 36 | 3/20/2026 |
| 0.17.1-dev.28 | 35 | 3/20/2026 |
| 0.17.1-dev.27 | 34 | 3/20/2026 |
| 0.17.1-dev.11 | 20,004 | 4/21/2025 |
| 0.17.1-dev.10 | 181 | 4/9/2025 |
| 0.17.1-dev.9 | 1,122 | 3/31/2025 |
| 0.17.1-dev.8 | 173 | 3/28/2025 |
| 0.17.1-dev.5 | 132 | 2/20/2025 |
| 0.17.0 | 3,714 | 1/31/2025 |