TreeWeaver.Client
5.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package TreeWeaver.Client --version 5.1.0
NuGet\Install-Package TreeWeaver.Client -Version 5.1.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.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TreeWeaver.Client" Version="5.1.0" />
<PackageReference Include="TreeWeaver.Client" />
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.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TreeWeaver.Client, 5.1.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.1.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.1.0
#tool nuget:?package=TreeWeaver.Client&version=5.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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-Keyheader. 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 withservices.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. - A process that holds more than one key registers the client once per key, under a name:
services.AddTreeWeaverClient("platform", …)andservices.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. ITreeWeaverClientoffers retrieval and answering directly and the rest of the surface through its sub-clients (Documents,Tags,Categories,Tenants,Changesfor the tenant's change log,Admin.Usagefor 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.ListAsyncpages through the same changes by cursor.Documents.ListIngestJobsAsynclists 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(TreeWeaverConflictExceptionfor a 409). ItsCodeholds the failure's category identifier as the server sent it —Storage_DocumentRemovedDuringIngest,Tenant_NotFound— and is what to branch on; it isnullwhere the answer carried none. ItsParametersholds the values the server named beside the detail, as it sent them —limitBytesofUpload_TooLarge,fieldandlimitBytesof a text field too large,ExistingCountandMaxSessionsPerKeyofConversation_CapReached— the same for a streamed call as for one answered without a stream; it is nevernull, 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 | Versions 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.
-
net10.0
- Microsoft.Extensions.Http (>= 10.0.14)
- Microsoft.Extensions.Options (>= 10.0.14)
- TreeWeaver.Contracts (>= 5.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.