Class DefaultRetrievalSpi
java.lang.Object
com.tnsai.intelligence.rag.binding.DefaultRetrievalSpi
- All Implemented Interfaces:
com.tnsai.rag.RetrievalSpi
Action enforcement boundary backed by the unified retrieval engine.
The SPI owns action-specific configuration resolution, query selection, prompt-context assembly, and reserved context keys. Source loading, strategy composition, ranking, caching, failure policy, reranking, and deduplication are delegated to the same engine implementation used by chat retrieval.
- Since:
- 0.5.4
-
Field Summary
Fields inherited from interface com.tnsai.rag.RetrievalSpi
HOLDER, KNOWLEDGE_SCOPE_KEY, RESOLVED_SOURCE_PATHS_KEY, RETRIEVED_CONTEXT_KEY, RETRIEVED_CONTEXT_TRUNCATED_KEY, RETRIEVED_DOCUMENT_COUNT_KEY, RETRIEVED_KNOWLEDGE_USAGE_KEY, RETRIEVED_STALE_FALLBACK_KEY -
Constructor Summary
ConstructorsConstructorDescriptionCreates the ServiceLoader-discovered production implementation. -
Method Summary
Modifier and TypeMethodDescriptionvoidenforce(com.tnsai.metadata.ActionMetadata action, com.tnsai.roles.Role role, Map<String, Object> params, Map<String, Object> context) voidenforce(com.tnsai.metadata.ActionMetadata action, Object target, Map<String, Object> params, Map<String, Object> context) com.tnsai.rag.ChatKnowledgeContextprepareChatKnowledge(Object agent, List<com.tnsai.rag.KnowledgeEntry> entries, com.tnsai.llm.LLMClient llm) requireLoaded(Object target, Collection<String> names, Map<String, Object> context) KnowledgePreflight.requireLoaded(Object, Collection, Map)under the scope and with the locations a dispatch with this context uses, read from the context exactly asenforce(com.tnsai.metadata.ActionMetadata, com.tnsai.roles.Role, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>)reads them.requireReady(Object target, Map<String, Object> context) KnowledgePreflight.requireReady(java.lang.Object, java.util.List<com.tnsai.rag.KnowledgeEntry>, java.util.Map<java.lang.String, java.nio.file.Path>, com.tnsai.rag.KnowledgeScope)over the reach a dispatch with this context has, the host's knowledge and the agent's, under the scope and with the locations read from the context exactly asenforce(com.tnsai.metadata.ActionMetadata, com.tnsai.roles.Role, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>)reads them.voidvalidateConfiguration(Class<?> targetClass) voidvalidateConfiguration(Class<?> targetClass, List<com.tnsai.rag.KnowledgeEntry> outer, com.tnsai.llm.LLMClient llm) voidvalidateConfiguration(Class<?> targetClass, List<com.tnsai.rag.KnowledgeEntry> outer, com.tnsai.llm.LLMClient llm, boolean pathsPerRun) voidvalidateConfiguration(Class<?> targetClass, List<com.tnsai.rag.KnowledgeEntry> outer, com.tnsai.llm.LLMClient llm, Map<String, List<String>> actionKnowledge)
-
Constructor Details
-
DefaultRetrievalSpi
public DefaultRetrievalSpi()Creates the ServiceLoader-discovered production implementation.
-
-
Method Details
-
validateConfiguration
- Specified by:
validateConfigurationin interfacecom.tnsai.rag.RetrievalSpi
-
validateConfiguration
public void validateConfiguration(Class<?> targetClass, List<com.tnsai.rag.KnowledgeEntry> outer, com.tnsai.llm.LLMClient llm) - Specified by:
validateConfigurationin interfacecom.tnsai.rag.RetrievalSpi
-
validateConfiguration
public void validateConfiguration(Class<?> targetClass, List<com.tnsai.rag.KnowledgeEntry> outer, com.tnsai.llm.LLMClient llm, boolean pathsPerRun) - Specified by:
validateConfigurationin interfacecom.tnsai.rag.RetrievalSpi
-
validateConfiguration
public void validateConfiguration(Class<?> targetClass, List<com.tnsai.rag.KnowledgeEntry> outer, com.tnsai.llm.LLMClient llm, Map<String, List<String>> actionKnowledge) - Specified by:
validateConfigurationin interfacecom.tnsai.rag.RetrievalSpi
-
prepareChatKnowledge
public com.tnsai.rag.ChatKnowledgeContext prepareChatKnowledge(Object agent, List<com.tnsai.rag.KnowledgeEntry> entries, com.tnsai.llm.LLMClient llm) DIRECT sources load and are measured here, at agent init, so an oversized source fails before the first turn; each turn reuses the loaded sources and checks the budget again for its filters. No DIRECT source loads lazily today; a lazy loader type, if ever added, would be skipped here and checked per turn only.
- Specified by:
prepareChatKnowledgein interfacecom.tnsai.rag.RetrievalSpi
-
enforce
public void enforce(com.tnsai.metadata.ActionMetadata action, com.tnsai.roles.Role role, Map<String, Object> params, Map<String, Object> context) - Specified by:
enforcein interfacecom.tnsai.rag.RetrievalSpi
-
enforce
public void enforce(com.tnsai.metadata.ActionMetadata action, Object target, Map<String, Object> params, Map<String, Object> context) - Specified by:
enforcein interfacecom.tnsai.rag.RetrievalSpi
-
requireLoaded
public Map<String,Integer> requireLoaded(Object target, Collection<String> names, Map<String, Object> context) KnowledgePreflight.requireLoaded(Object, Collection, Map)under the scope and with the locations a dispatch with this context uses, read from the context exactly asenforce(com.tnsai.metadata.ActionMetadata, com.tnsai.roles.Role, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>)reads them.- Specified by:
requireLoadedin interfacecom.tnsai.rag.RetrievalSpi
-
requireReady
KnowledgePreflight.requireReady(java.lang.Object, java.util.List<com.tnsai.rag.KnowledgeEntry>, java.util.Map<java.lang.String, java.nio.file.Path>, com.tnsai.rag.KnowledgeScope)over the reach a dispatch with this context has, the host's knowledge and the agent's, under the scope and with the locations read from the context exactly asenforce(com.tnsai.metadata.ActionMetadata, com.tnsai.roles.Role, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>)reads them.- Specified by:
requireReadyin interfacecom.tnsai.rag.RetrievalSpi
-