Class RagDiagnostics
@Knowledge and
@Search declarations resolved to.
RAG fails as plausible-but-worse answers more often than as an exception. This is the question a developer asks after the binding exists: which embedding is actually in use, which SPI providers are installed, and what the corpus looks like. It is not a telemetry surface and does not announce itself.
Stable typed accessors
The following are the supported surface:
roleClass()embeddingType()bundledHashFallback()— the question this type exists to answerreranker(),queryExpander(),graphStore()sources()retrieval()
report() is unstable human-readable text
for pasting into an issue. Do not parse it.
Binding construction
of(Class) never ingests. It snapshots a binding already
in the Role cache, and fails if none exists. Pass
ingestIfAbsent=true only when the caller is willing to pay
corpus ingest as the price of asking.
- Since:
- 0.15.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordInstalled SPI providers for one unbundled seam.static final recordOne@Searchdeclaration on the Role.static final recordIngest snapshot for one declared knowledge source. -
Method Summary
Modifier and TypeMethodDescriptionbooleantruewhen retrieval is using the bundled hash embedding, which ranks by token overlap rather than meaning.Fully-qualified type of the resolved embedding function, after unwrapping the registry's validating decorator.Installed graph-store providers, or empty when none.static RagDiagnosticsof(RoleRagBinding binding) Provider lists are a fresh SPI discovery. They report whatRerankerRegistry.discover()and friends find on the classpath now — not the registries this binding actually resolved against.static RagDiagnosticsSnapshot of the cached binding forroleClass.static RagDiagnosticsSnapshot of the binding forroleClass.static RagDiagnosticsof(Class<?> roleClass, List<com.tnsai.rag.KnowledgeSourceConfig> builderSources, boolean ingestIfAbsent) Snapshot of the binding forroleClassbuilt withbuilderSources.Installed query-expander providers, or empty when none.report()Unstable human-readable text.reranker()Installed reranker providers, or empty when none.Type-level and method-level@Searchdeclarations on the Role.Class<?> Role this snapshot describes.sources()Per-source ingest snapshot, in declaration order.
-
Method Details
-
of
Provider lists are a fresh SPI discovery. They report what
RerankerRegistry.discover()and friends find on the classpath now — not the registries this binding actually resolved against. An application that injects its own registries can therefore see names here it does not use, and miss ones it does. Use the package-private overload with explicitProviderStatusvalues when the injected registries are in reach. -
of
Snapshot of the cached binding forroleClass. Does not ingest; fails ifRoleRagBinding.forRole(Class)has not run for this Role.- Parameters:
roleClass- Role whose binding to describe- Returns:
- diagnostic over the cached binding
-
of
Snapshot of the binding forroleClass.- Parameters:
roleClass- Role whose binding to describeingestIfAbsent-trueconstructs the binding (ingests the corpus) when none is cached.falsefails if the Role has not been bound yet- Returns:
- diagnostic over the binding
-
of
public static RagDiagnostics of(Class<?> roleClass, List<com.tnsai.rag.KnowledgeSourceConfig> builderSources, boolean ingestIfAbsent) Snapshot of the binding forroleClassbuilt withbuilderSources.The binding cache is keyed on the pair, not on the Role alone. An application that binds through
RoleRagBinding.forRole(role, sources)has no entry under the empty list, so the no-sources overload cannot find it — it would report "no binding cached" for a Role that is bound and running, and a caller following that advice withingestIfAbsent=truewould build a second, annotation-only binding, pay a full corpus ingest, and then be shown a configuration the application is not using. Pass the same sources here that were passed toforRole.- Parameters:
roleClass- Role whose binding to describebuilderSources- sources the binding was built with; must equal what was passed toRoleRagBinding.forRoleingestIfAbsent-trueconstructs the binding (ingests the corpus) when none is cached.falsefails if the Role has not been bound with these sources- Returns:
- diagnostic over the binding
- Since:
- 0.15.0
-
roleClass
Role this snapshot describes. -
embeddingType
Fully-qualified type of the resolved embedding function, after unwrapping the registry's validating decorator. -
bundledHashFallback
public boolean bundledHashFallback()truewhen retrieval is using the bundled hash embedding, which ranks by token overlap rather than meaning. -
reranker
Installed reranker providers, or empty when none. Never throws. -
queryExpander
Installed query-expander providers, or empty when none. Never throws. -
graphStore
Installed graph-store providers, or empty when none. Never throws. -
sources
Per-source ingest snapshot, in declaration order. -
retrieval
Type-level and method-level@Searchdeclarations on the Role. Empty when the Role declares none. -
report
Unstable human-readable text. Shape and wording may change without notice; use the typed accessors from tests and health endpoints.- Returns:
- diagnostic report
-