Package com.tnsai.rag
Class ChatKnowledgeBindingValidator
java.lang.Object
com.tnsai.rag.ChatKnowledgeBindingValidator
The one rule a chat knowledge binding must meet before it grounds a
conversation, whoever installs it: an agent, its builder or an integration.
A binding is valid for an owner when
- it belongs to that exact owner: its owner id equals the owner's id when the caller knows one, and its exact owner object, when it was created with one, is the owner itself;
- every source it searches is an enabled SEARCH entry of the owner's
chat knowledge, as
KnowledgeDeclarations.chatScope(List)reads it, so a GRAPH entry never backs a binding; and - its topK equals the topK the owner's SEARCH entries declare, merged
field by field over
KnowledgeDeclarations.chatSearchDefaults()as the agent wires them.
AgentBuilder gives is layered into the same entries
first, so it is checked the same way.- Since:
- 0.18.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidvalidate(ChatKnowledgeBinding binding, Object owner, String ownerId, List<KnowledgeEntry> knowledge, String where) Checks a binding against the owner's declared knowledge.
-
Method Details
-
validate
public static void validate(ChatKnowledgeBinding binding, Object owner, String ownerId, List<KnowledgeEntry> knowledge, String where) Checks a binding against the owner's declared knowledge.- Parameters:
binding- the binding to installowner- the exact conversation ownerownerId- the owner's id, ornullwhen the caller has none and the binding must name the owner objectknowledge- the owner's knowledge entries; only the SEARCH ones in its chat scope countwhere- the declaration site, used in messages- Throws:
IllegalArgumentException- when the binding breaks the rule
-