Path: redb-route/redb.Route.Llm/Expressions/LlmExpressionResolverSetup.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Llm/Expressions/LlmExpressionResolverSetup.cs
----
using System;
using System.Reflection;
using redb.Route.Abstractions;
using redb.Route.Expressions;
namespace redb.Route.Llm.Expressions;
///
/// Registers ${conversation.*} and ${tool.*} resolvers with
/// . The resolvers read the well-known
/// exchange properties published by
/// (, )
/// and walk the requested path via reflection — so adding fields to
/// /
/// automatically makes them available in templates.
///
public static class LlmExpressionResolverSetup
{
private static int _initialized;
///
/// Idempotently registers the LLM prefix resolvers. Safe to call from
/// every host's composition root — subsequent calls are no-ops.
///
public static void EnsureRegistered()
{
if (System.Threading.Interlocked.CompareExchange(ref _initialized, 1, 0) != 0)
return;
ExpressionResolver.RegisterPrefixResolver("conversation.", (exchange, path) =>
ResolvePath(exchange.getProperty