Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<RepositoryUrl>https://github.com/managedcode/graphrag</RepositoryUrl>
<PackageProjectUrl>https://github.com/managedcode/graphrag</PackageProjectUrl>
<Product>Managed Code GraphRag</Product>
<Version>10.0.6</Version>
<PackageVersion>10.0.6</PackageVersion>
<Version>10.0.7</Version>
<PackageVersion>10.0.7</PackageVersion>

</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# GraphRAG for .NET

[![NuGet](https://img.shields.io/nuget/v/ManagedCode.GraphRag.svg)](https://www.nuget.org/packages/ManagedCode.GraphRag/)
[![NuGet Neo4j](https://img.shields.io/nuget/v/ManagedCode.GraphRag.Neo4j.svg?label=Neo4j)](https://www.nuget.org/packages/ManagedCode.GraphRag.Neo4j/)
[![NuGet Postgres](https://img.shields.io/nuget/v/ManagedCode.GraphRag.Postgres.svg?label=Postgres)](https://www.nuget.org/packages/ManagedCode.GraphRag.Postgres/)
[![NuGet CosmosDb](https://img.shields.io/nuget/v/ManagedCode.GraphRag.CosmosDb.svg?label=CosmosDb)](https://www.nuget.org/packages/ManagedCode.GraphRag.CosmosDb/)
[![NuGet JanusGraph](https://img.shields.io/nuget/v/ManagedCode.GraphRag.JanusGraph.svg?label=JanusGraph)](https://www.nuget.org/packages/ManagedCode.GraphRag.JanusGraph/)
[![Build Status](https://github.com/managedcode/graphrag/actions/workflows/ci.yml/badge.svg)](https://github.com/managedcode/graphrag/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

GraphRAG for .NET is a ground-up port of Microsoft's GraphRAG reference implementation to the modern .NET 10 stack. The port keeps parity with the original Python pipelines while embracing native .NET idioms—dependency injection, logging abstractions, async I/O, and strongly-typed configuration.

> ℹ️ The upstream Python code remains available under [`submodules/graphrag-python`](submodules/graphrag-python) for side-by-side reference. Treat it as read-only unless a task explicitly targets the submodule.
Expand Down Expand Up @@ -390,19 +398,19 @@ The Cosmos adapter (`ManagedCode.GraphRag.CosmosDb`) targets the SQL API and wor
1. **Provide a connection string.** Set `COSMOS_EMULATOR_CONNECTION_STRING` or configure options manually.
2. **Register the store.**
```csharp
builder.Services.AddCosmosGraphStore("cosmos", options =>
{
options.ConnectionString = cosmosConnectionString;
options.DatabaseId = "GraphRagIntegration";
options.NodesContainerId = "nodes";
options.EdgesContainerId = "edges";
options.ConfigureClientOptions = clientOptions =>
{
clientOptions.GatewayModeMaxConnectionLimit = 100;
};
options.ConfigureSerializer = serializer => serializer.PropertyNamingPolicy = null;
});
```
builder.Services.AddCosmosGraphStore("cosmos", options =>
{
options.ConnectionString = cosmosConnectionString;
options.DatabaseId = "GraphRagIntegration";
options.NodesContainerId = "nodes";
options.EdgesContainerId = "edges";
options.ConfigureClientOptions = clientOptions =>
{
clientOptions.GatewayModeMaxConnectionLimit = 100;
};
options.ConfigureSerializer = serializer => serializer.PropertyNamingPolicy = null;
});
```
As with other adapters, the first Cosmos store becomes the unkeyed default. If you already have a `CosmosClient`, set `options.ClientFactory` to return it and GraphRAG will reuse that instance.

> **Tip:** `IGraphStore` now exposes full graph inspection and mutation helpers (`GetNodesAsync`, `GetRelationshipsAsync`, `DeleteNodesAsync`, `DeleteRelationshipsAsync`) in addition to the targeted APIs (`InitializeAsync`, `Upsert*`, `GetOutgoingRelationshipsAsync`). These use the same AGE-powered primitives, so you can inspect, prune, or export the graph without dropping down to concrete implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,7 @@ private async Task LoadAgeAsync(NpgsqlConnection connection, CancellationToken c
await using var checkCommand = connection.CreateCommand();
checkCommand.CommandText = "SELECT 1 FROM pg_extension WHERE extname = 'age';";
checkCommand.CommandTimeout = 0;
var result = await checkCommand.ExecuteScalarAsync(cancellationToken).ConfigureAwait(false);

if (result is null)
{
throw new AgeException("AGE extension is not installed.");
}
var result = await checkCommand.ExecuteScalarAsync(cancellationToken).ConfigureAwait(false) ?? throw new AgeException("AGE extension is not installed.");
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

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

This assignment to result is useless, since its value is never read.

Suggested change
var result = await checkCommand.ExecuteScalarAsync(cancellationToken).ConfigureAwait(false) ?? throw new AgeException("AGE extension is not installed.");
await checkCommand.ExecuteScalarAsync(cancellationToken).ConfigureAwait(false) ?? throw new AgeException("AGE extension is not installed.");

Copilot uses AI. Check for mistakes.

await using var load = connection.CreateCommand();
load.CommandText = "LOAD 'age';";
Expand Down
5 changes: 4 additions & 1 deletion src/ManagedCode.GraphRag/Utils/Hashing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ public static string GenerateSha512Hash(IEnumerable<KeyValuePair<string, object?

private static void AppendStringChunked(IncrementalHash hasher, string? value, Span<byte> buffer)
{
if (string.IsNullOrEmpty(value)) return;
if (string.IsNullOrEmpty(value))
{
return;
}

var remaining = value.AsSpan();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using GraphRag.Storage.Postgres.ApacheAge;
using GraphRag.Storage.Postgres.ApacheAge.Types;
using ManagedCode.GraphRag.Tests.Integration;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
using Npgsql;

namespace ManagedCode.GraphRag.Tests.Storage.Postgres;
Expand Down
Loading