Class LLMSkillResolver

java.lang.Object
com.tnsai.skills.LLMSkillResolver
All Implemented Interfaces:
SkillResolver

public final class LLMSkillResolver extends Object implements SkillResolver
LLM-driven SkillResolver — asks the configured LLMClient to pick the most relevant skill names from a compact catalog (TNS-289).

Higher accuracy than KeywordSkillResolver when skill triggers are paraphrased by the user (semantic match vs literal word overlap), at the cost of one extra LLM round-trip per turn. Opt-in — operators choose this when the prompt budget is large enough that a poor skill ranking is more expensive than the scorer call itself.

Failure mode

If the LLM call throws or returns an unparseable response, the resolver falls back to KeywordSkillResolver for the same call rather than returning empty — a transient LLM hiccup must not silently strip skills from the agent's prompt. The fallback is logged at WARN.
Since:
0.10.0 (TNS-289)
  • Constructor Details

    • LLMSkillResolver

      public LLMSkillResolver(LLMClient llm)
  • Method Details

    • resolve

      public List<Skill> resolve(String userMessage, List<Skill> candidates, int limit)
      Description copied from interface: SkillResolver
      Pick the limit skills most relevant to userMessage. Returned list is ordered most-relevant-first; size is at most limit; an empty list is valid output (no skill matched the threshold).
      Specified by:
      resolve in interface SkillResolver
      Parameters:
      userMessage - the latest user turn
      candidates - the full set of registered skills (caller typically passes SkillStore.list())
      limit - maximum candidates to return; resolvers MUST not exceed this