Interface QueryExpander
Providers advertise the exact expansion modes and model identifiers
they support through supports(Search.QueryExpansion, String)
and are discovered with ServiceLoader. TnsAI does not
bundle or impersonate an LLM: provider modules own inference, credentials,
transport, and lifecycle management.
An expansion invocation must return only generated query variations.
The runtime retains the original query, removes blank and duplicate
variations, and enforces QueryExpander.Request.maxExpansions() as a hard bound.
- Since:
- 0.13.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordImmutable input passed to aQueryExpanderprovider. -
Method Summary
-
Method Details
-
supports
Returns whether this provider supports the exact mode/model pair.The answer must be local — no network call — because Role initialization checks provider support before dispatch and the runtime rechecks it on every retrieval dispatch before consulting the result cache.
- Parameters:
mode- expansion mode; neverSearch.QueryExpansion.NONEmodel- exact, case-sensitive model identifier- Returns:
truewhen this provider can serve the request
-
expand
Generates query variations for one retrieval request.Implementations should observe
QueryExpander.Request.cancellationToken()before and after blocking work.- Parameters:
request- immutable expansion request- Returns:
- generated query variations, excluding the original query
-