Class RedbPromptTemplateRegistry
REDB-backed . One
row per (name, version); the composite
business key "{name}@{version}" lives in _objects.value_string
(partial index on PostgreSQL/SQLite; MSSQL cannot index NVARCHAR(MAX)) and,
normalized, in _objects._value_unique — a version registers exactly
once, concurrent registrations of one version resolve first-wins.
"Latest" lookup is server-side: filter by the value_string prefix
"{name}@" and pick the most recently created row.
The registry does not own an instance — each
call resolves one through IRouteContext.GetRedbService(name, exchange),
which honours the per-exchange scope cache. The redb name is read from
exchange.Properties[LlmKeys.RedbName] (set by the LLM endpoint URI),
falling back to the constructor-supplied default name and then to the host's
default unnamed instance.
public sealed class RedbPromptTemplateRegistry : IPromptTemplateRegistry
Inheritance
Implements
Methods
GetAsync(string, string?, IExchange?, CancellationToken)
Returns the requested template. When version is null,
public Task<PromptTemplate?> GetAsync(string name, string? version = null, IExchange? exchange = null, CancellationToken ct = default)
ListAsync(IExchange?, CancellationToken)
Enumerates every version of every template — used for tooling.
public Task<IReadOnlyList<PromptTemplate>> ListAsync(IExchange? exchange = null, CancellationToken ct = default)
SetAsync(PromptTemplate, IExchange?, CancellationToken)
Registers or updates a template version.
public Task SetAsync(PromptTemplate template, IExchange? exchange = null, CancellationToken ct = default)
Constructors
RedbPromptTemplateRegistry(IRouteContext, string?)
Creates the registry. Scheme is synced by the host's redb.InitializeAsync().