RAG on CDS
Answering a question from your own data rather than from what a model remembers — embeddings stored beside the records they describe, and a similarity search that runs where the data already is.
Showing artifacts, examples and content with confirmed Node.js applicability. View All CAP
Overview
Redirects the standard sqlite database so that VECTOR_EMBEDDING and the vector functions run against a local ONNX model, the current default being sentence-transformers/all-MiniLM-L6-v2. Without it, capire states that SQLite and H2 emulate vector_embedding with character-hash vectors, which match spelling rather than meaning, so this is what makes a similarity search on a laptop behave like the one on SAP HANA. The README declares it experimental and points production vector workloads at SAP HANA's vector engine, and capire scopes it to local development.
Carries the modelled half: the Vector type is built into CDS and the vector functions are part of the query language, so an embedding is an element of an entity and a retrieval is a WHERE clause. vector_embedding turns a text into a vector, cosine_similarity and l2distance compare two, and a stored calculated element keeps a row's embedding in the database and recomputes it whenever the row changes. Splitting a text into chunks and assembling what was found into a prompt are not here.
A Node.js coverage assessment has not been written. View all flavors
Puts the retrieval into one call: a single method that embeds the question through SAP AI CoreSAP AI CoreSAP's AI service on BTP: the runtime for AI assets, and through the Generative AI Hub inside it the access to foundation models, the orchestration service with its templating, masking, filtering and grounding modules, the Prompt Registry and Document Grounding.sap official, btp, searches SAP HANA CloudSAP HANA CloudThe managed database under most of this: CAP's default target, the store Datasphere and Analytics Cloud sit on, and a service with plans and components.sap official, btp's vector engine for the nearest rows and sends them on to the model. The embedding and the similarity search are also exposed on their own, for a handler that wants to keep the steps apart. What gets embedded, and when, is the application's: the README describes no chunking and no embed-on-write.
Reaches a Document Grounding collection through the LangChain vector store interface, so ingestion, chunk storage, embedding and retrieval happen in SAP AI Core and nothing is persisted in the application's database.
Holds chunks, their embeddings and their metadata as CDS entities in the application's own database, and retrieves them by cosine similarity through the LangChain vector store interface.
Answers the generation half only. ragChain takes documents the caller has already retrieved, assembles them into a prompt under a context budget and sends it to the configured provider; embed on the same client produces the vectors, and semanticCache and embeddingDedup reuse earlier answers. The store, the index and the search are not in the package, which is what @saptarishi/cds-plugin-vector-hana@saptarishi/cds-plugin-vector-hanaVector storage and similarity search on SAP HANA from CAP, packaged as a plugin so the embedding column and the query are modelled rather than hand-written.independent, cap composes with it to supply.
Answers the storage and retrieval half inside a CAP project: a vector table per @rag-annotated entity kept in sync by the plugin's own CRUD handlers, top-K cosine search with an optional metadata filter, hybrid vector-and-keyword retrieval fused by reciprocal rank, and a RAG helper that assembles the hits into a citation-tagged prompt and calls a chat provider, with a streaming variant that returns the hits before the first token. The embedding and chat models come from a separate provider plugin, and the embedded unit is one row's projected fields.
A Node.js coverage assessment has not been written. View all flavors
Licence
LicenceSAP Developer License Agreement 3.2 CAP§ 3AlwaysCovered SAP materials or a covered CAP customer application are included in training data, model development or model refinement.
- § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
Retrieval and inference are not automatically AI training. The section becomes relevant if the indexed or retrieved covered material is instead used for training, developing or refining the model or system.
SAP Developer License Agreement 3.2 CAP →Artifacts
Content
Show 2 more
Seen working
Neither the package manifest nor the repository tree declares a licence.
Neither the package manifest nor the repository tree declares a licence.
Every CDS service in both samples is marked `@requires: 'any'` and left publicly accessible, which the README says simplifies the testing and deployment process, and it asks for proper authentication mechanisms to be applied in their place.
Every CDS service in both samples is marked `@requires: 'any'` and left publicly accessible, which the README says simplifies the testing and deployment process, and it asks for proper authentication mechanisms to be applied in their place.
Details
Coverage
Designs that place it
For your agent
- Ref
capability:retrieval-augmented-generation- JSON
- /capabilities/retrieval-augmented-generation.json
- MCP
- Connecting an agent