TreeWeaver.Client 5.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TreeWeaver.Client --version 5.2.0
                    
NuGet\Install-Package TreeWeaver.Client -Version 5.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TreeWeaver.Client" Version="5.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TreeWeaver.Client" Version="5.2.0" />
                    
Directory.Packages.props
<PackageReference Include="TreeWeaver.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TreeWeaver.Client --version 5.2.0
                    
#r "nuget: TreeWeaver.Client, 5.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TreeWeaver.Client@5.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TreeWeaver.Client&version=5.2.0
                    
Install as a Cake Addin
#tool nuget:?package=TreeWeaver.Client&version=5.2.0
                    
Install as a Cake Tool

TreeWeaver.Client

The typed client for the TreeWeaver HTTP API. TreeWeaver is a server for hierarchical, deterministic retrieval over documents; you run the server and talk to it through this package. It depends only on the wire records (TreeWeaver.Contracts), never on the engine.

services.AddTreeWeaverClient(options =>
{
    options.BaseUrl = "https://treeweaver.internal:8080";
    options.ApiKey  = configuration["TreeWeaver:Client:ApiKey"]!;
});

public sealed class KnowledgeSearch(ITreeWeaverClient treeweaver)
{
    public Task<RetrieveQueryResponse> SearchAsync(string question, CancellationToken ct) =>
        treeweaver.RetrieveAsync(
            new RetrieveQueryRequest(
                Language: "en",
                Question: question,
                Select: new RetrieveSelect(TopK: 5),
                Assemble: new RetrieveAssemble(TokenBudget: 4000, Expand: true)),
            ct);
}
  • The key travels in the X-API-Key header. A key belongs to one tenant and carries roles (treeweaver.reader, treeweaver.editor, treeweaver.admin); the tenant of a request is the tenant of its key.
  • A service key — a key the operator gave the role treeweaver.service — names the tenant per call instead, so one backend serving several tenants holds one key. Say once where the tenant comes from with services.AddTreeWeaverActingTenant(scope => …), and every call on a tenant's content made in a scope acts for that scope's tenant. The operations of the tenant registry (Tenants) name their tenant themselves and are sent without it.
  • A service key may also name the person it acts for: register services.AddTreeWeaverActingPerson(scope => …) and every call sends that display name, which the server records as who created or last changed what the call changes. It never authenticates the name, and refuses a call that sends one with a key that is not a service key.
  • Where the backend shares the server's identity store, it can have a call decided by the person's own roles instead: set options.PersonTokens to the key it signs with and register services.AddTreeWeaverActingMember(scope => …). Every call for a member then carries a fresh person token, and the server allows it only what both the member's roles and the key allow.
  • A backend that forwards a browser's requests through a pipeline of its own signs them the same way: put new TreeWeaverPersonTokenHandler(personTokenOptions) innermost on its HttpMessageInvoker and attach the member to each request with request.Options.Set(TreeWeaverPersonTokenHandler.Member, account). TreeWeaverPersonTokenSigner.Sign(...) makes one token for a request sent by any other means.
  • A process that holds more than one key registers the client once per key, under a name: services.AddTreeWeaverClient("platform", …) and services.AddTreeWeaverClient("service", …). Each registration's root client and sub-clients are keyed services under that name ([FromKeyedServices("service")] ITreeWeaverClient) and carry that key only; the acting tenant and person apply to every registration.
  • ITreeWeaverClient offers retrieval and answering directly and the rest of the surface through its sub-clients (Documents, Tags, Categories, Tenants, Changes for the tenant's change log, Admin.Usage for the tenant's usage log, …).
  • A backend learns of what changed in a tenant without polling: Changes.WatchAsync(after) follows every change to the tenant's documents and vocabulary and every failed ingest over one held connection; called again with the last position it saw, it resumes after it. Changes.ListAsync pages through the same changes by cursor. Documents.ListIngestJobsAsync lists the tenant's ingest jobs, whoever submitted them. The server calls nobody: there are no webhooks.
  • A call the server refuses, or a stream a failure ends, throws TreeWeaverApiException (TreeWeaverConflictException for a 409). Its Code holds the failure's category identifier as the server sent it — Storage_DocumentRemovedDuringIngest, Tenant_NotFound — and is what to branch on; it is null where the answer carried none. Its Parameters holds the values the server named beside the detail, as it sent them — limitBytes of Upload_TooLarge, field and limitBytes of a text field too large, ExistingCount and MaxSessionsPerKey of Conversation_CapReached — the same for a streamed call as for one answered without a stream; it is never null, and empty where the failure named none.
  • The client carries no timeout of its own: an ingest or a streamed answer may run for minutes, and the cancellation token every method takes is how you bound it.

The server ships as the container image treeweaverdev/treeweaver; TreeWeaver.Aspire.Hosting adds it to an Aspire AppHost.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
5.3.0 90 11/8/2026
5.2.0 136 11/5/2026
5.1.0 118 11/5/2026
5.0.0 155 10/30/2026
4.4.0 548 10/21/2026
4.3.1 288 10/14/2026
4.3.0 195 10/12/2026
4.2.0 117 10/11/2026
4.1.2 105 10/11/2026
4.1.1 108 10/10/2026