How CWA and RAG work together.
RAG Pattern | Description | Primary CWA Layer(s) Implemented |
---|---|---|
Vector-Based RAG | Retrieves semantically similar text chunks from an unstructured document corpus stored in a vector database. The most common form of RAG. 14 | Layer 3 (Curated Knowledge Context): Directly populates this layer with retrieved text. |
Structured RAG | Retrieves data by generating and executing queries against a structured database (e.g., SQL) or knowledge graph (e.g., Cypher). 14 | Layer 7 (Tool Explanation): Contains the database schema. Layer 8 (Function Call Results): Contains the query results. Layer 3 (Curated Knowledge Context): The results are used as grounding knowledge. |
API-Augmented RAG | Retrieves real-time data by calling external APIs (e.g., for weather, stock prices, or flight information). 14 | Layer 7 (Tool Explanation): Contains the API specifications. Layer 8 (Function Call Results): Contains the live data returned from the API call. |
Knowledge-Based RAG | Retrieves information from structured knowledge representations like ontologies or rule-based systems, enabling more precise and explainable reasoning. 14 | Layer 7 (Tool Explanation): Describes the knowledge base rules/ontology. Layer 8 (Function Call Results): Contains the output of the rule engine or knowledge graph traversal. |
Self-Corrective RAG | Involves an iterative process where the agent refines its query or evaluates the relevance of retrieved documents to improve the final result. 10 | Layer 4 (Task/Goal State Context): Manages the iterative process, tracking the goal and the status of sub-queries. Layer 3 (Curated Knowledge Context): Is refined over multiple steps. |