Trix 0.1.0
dotnet add package Trix --version 0.1.0
NuGet\Install-Package Trix -Version 0.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="Trix" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Trix" Version="0.1.0" />
<PackageReference Include="Trix" />
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 Trix --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Trix, 0.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 Trix@0.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=Trix&version=0.1.0
#tool nuget:?package=Trix&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Trix SDK for .NET
The official .NET SDK for Trix - a memory and knowledge management API.
Installation
Install via NuGet:
dotnet add package Trix.Client
Or via the Package Manager Console:
Install-Package Trix.Client
Quick Start
using Trix;
using Trix.Models;
// Create client with API key
using var client = new TrixClient("your_api_key");
// Or from environment variables (TRIX_API_KEY)
using var client = TrixClient.FromEnvironment();
// Create a memory
var memory = await client.Memories.CreateAsync(new CreateMemoryRequest
{
Content = "Trix is a powerful memory and knowledge management API.",
Type = MemoryType.Text,
Tags = new List<string> { "introduction", "trix" }
});
Console.WriteLine($"Created memory: {memory.Id}");
// Search memories
var results = await client.Memories.ListAsync(new ListMemoriesRequest
{
Q = "memory management",
Mode = SearchMode.Semantic,
Limit = 10
});
foreach (var m in results.Data)
{
Console.WriteLine($"- {m.Content}");
}
Features
- Memories: Create, read, update, delete, and search memories
- Relationships: Connect memories with typed relationships
- Clusters: Group related memories into clusters
- Spaces: Organize memories into workspaces
- Facts & Entities: Knowledge graph with facts and named entities
- Async/Await: Full async support with cancellation tokens
- Resilience: Built-in retry with exponential backoff
- Type Safety: Strongly typed request/response models
Configuration
Basic Configuration
var options = new TrixClientOptions
{
ApiKey = "your_api_key",
BaseUrl = "https://api.trixdb.com", // Default
Timeout = TimeSpan.FromSeconds(30), // Default
MaxRetries = 3 // Default
};
using var client = new TrixClient(options);
Environment Variables
// Reads from TRIX_API_KEY and optionally TRIX_BASE_URL
using var client = TrixClient.FromEnvironment();
Dependency Injection
// In Startup.cs or Program.cs
services.AddSingleton(sp =>
{
var options = new TrixClientOptions
{
ApiKey = configuration["Trix:ApiKey"]
};
return new TrixClient(options);
});
Resources
Memories
// Create
var memory = await client.Memories.CreateAsync(new CreateMemoryRequest
{
Content = "Hello, Trix!",
Type = MemoryType.Text,
Tags = new List<string> { "greeting" }
});
// Get
var memory = await client.Memories.GetAsync("mem_123");
// Update
var updated = await client.Memories.UpdateAsync("mem_123", new UpdateMemoryRequest
{
Content = "Updated content",
Tags = new List<string> { "updated" }
});
// Delete
await client.Memories.DeleteAsync("mem_123");
// List with filters
var memories = await client.Memories.ListAsync(new ListMemoriesRequest
{
Q = "search query",
Mode = SearchMode.Semantic,
Tags = new List<string> { "tag1" },
Limit = 20
});
// Iterate all matching memories
await foreach (var memory in client.Memories.ListAllAsync())
{
Console.WriteLine(memory.Content);
}
Relationships
// Create relationship
var relationship = await client.Relationships.CreateAsync(
sourceId: "mem_1",
targetId: "mem_2",
relationshipType: RelationshipTypes.RelatedTo,
strength: 0.8
);
// Reinforce a relationship
await client.Relationships.ReinforceAsync("rel_123", amount: 0.1);
// Weaken a relationship
await client.Relationships.WeakenAsync("rel_123", amount: 0.1);
// Get relationships for a memory
var incoming = await client.Relationships.GetIncomingAsync("mem_123");
var outgoing = await client.Relationships.GetOutgoingAsync("mem_123");
Clusters
// Create cluster
var cluster = await client.Clusters.CreateAsync("My Cluster",
description: "A collection of related memories");
// Add memory to cluster
await client.Clusters.AddMemoryAsync("cluster_123", "mem_456");
// Expand cluster with similar memories
var expansion = await client.Clusters.ExpandAsync("cluster_123",
limit: 10,
threshold: 0.7);
Spaces
// Create space
var space = await client.Spaces.CreateAsync("My Workspace",
description: "A workspace for my project");
// List spaces
var spaces = await client.Spaces.ListAsync();
// Create memory in a space
var memory = await client.Memories.CreateAsync(new CreateMemoryRequest
{
Content = "Memory in specific space",
SpaceId = space.Id
});
Error Handling
The SDK throws specific exceptions for different error types:
try
{
var memory = await client.Memories.GetAsync("mem_invalid");
}
catch (NotFoundException ex)
{
Console.WriteLine($"Memory not found: {ex.Message}");
}
catch (AuthenticationException ex)
{
Console.WriteLine($"Invalid API key: {ex.Message}");
}
catch (RateLimitException ex)
{
Console.WriteLine($"Rate limited. Retry after {ex.RetryAfterSeconds}s");
}
catch (ValidationException ex)
{
Console.WriteLine($"Validation failed: {ex.Message}");
foreach (var error in ex.Errors ?? new Dictionary<string, string[]>())
{
Console.WriteLine($" {error.Key}: {string.Join(", ", error.Value)}");
}
}
catch (TrixException ex)
{
Console.WriteLine($"Trix error: {ex.Message}");
Console.WriteLine($" Status: {ex.StatusCode}");
Console.WriteLine($" Request ID: {ex.RequestId}");
}
Cancellation
All async methods support cancellation tokens:
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
try
{
var memories = await client.Memories.ListAsync(cancellationToken: cts.Token);
}
catch (OperationCanceledException)
{
Console.WriteLine("Operation was cancelled");
}
Logging
Configure logging via the options:
using Microsoft.Extensions.Logging;
var loggerFactory = LoggerFactory.Create(builder =>
builder.AddConsole().SetMinimumLevel(LogLevel.Debug));
var options = new TrixClientOptions
{
ApiKey = "your_api_key",
LoggerFactory = loggerFactory
};
using var client = new TrixClient(options);
Requirements
- .NET 10.0 or later
Related SDKs
License
MIT License - see LICENSE for details.
| 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.DependencyInjection.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Http.Resilience (>= 10.1.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
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.1.0 | 93 | 12/30/2025 |