Retrieval-augmented generation

Grounding a model's answer in data retrieved at question time: text split into chunks, each chunk embedded as a vector, and the chunks nearest to the question placed into the prompt. Semantic search is the same retrieval with a person reading the matches, and fine-tuning changes the model's weights, not its input.

Overview

InCAPRAG on CDSassessed

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.

SAP SHIPS
Node.js →

@cap-js/ai Out-of-the-box value-help recommendations powered by SAP RPT-1, SAP AI Core as a standard CAP service, and an experimental local embedding model behind SQLite's vector functions.

@sap/cds 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.

Not covered: At the vector. Which text of a record gets embedded, how a text too long for one embedding is split, how many rows go into the prompt and what the prompt says are written by hand in every entry here, and capire's guide documents no chunking. On PostgreSQL capire states that CAP provides no built-in vector_embedding, so the embedding is computed in the application or by a custom database function, and the local embeddings in @cap-js/ai are declared experimental and intended for local development only.

Both are present because the core answers the modelled half and the layer above it is written in every entry here. No source states why each stops where it does, so the relationship stays unassessed.

Built into @sap/cds
THE COMMUNITY ADDS

What the community adds is that layer above the vector. cap-llm-plugin folds the similarity search, the embedding and the model call into one retrieval method, and @saptarishi/cds-plugin-vector-hana keeps a vector table in step with an annotated entity and declares the search and the ask as actions on it. mi8y-cap-agents-aicore-vectorstore takes the other route and reaches an AI Core Document Grounding collection through the LangChain vector store interface, so the application stores no vectors.

InABAPassessed

In ABAP the data is already in the system and the model is not. The ABAP AI SDK reaches a language model through Intelligent Scenario Lifecycle Management, and embeddings and similarity search over ABAP tables are built beside it.

SAP SHIPS

Present, not yet described.

Not covered: The released classes of the ABAP AI SDK send a prompt to a language model and return the completion, and the classes SAP lists for it stop there. None of them stores an embedding or searches for the nearest one, so retrieval over ABAP tables is written beside the SDK.

The completion call is SAP's, and SAP AI Core serves this door with Document Grounding over documents in a connected repository. The ABAP AI SDK was checked only through SAP's cheat sheet, not through its help pages.

THE COMMUNITY ADDS

Retrieval over ABAP tables comes from community code such as zvdb by Alice V., a vector store written in ABAP that returns the document chunks for a prompt.

InBTP/BAIPDocument groundingassessed

On this door the question is not how to embed your own records but which document store to point the service at. SAP AI Core connects a repository and answers from it, and SAP AI Launchpad carries the Grounding Management app for the pipelines.

SAP SHIPS

Document Grounding, a managed service under the Generative AI Hub in SAP AI Core: a connector to Amazon S3, SharePoint, SAP Document Management Service, SAP Build Work Zone or an SFTP server, and the service does ingestion, chunking, embedding and retrieval itself; a Vector API takes pre-chunked, pre-embedded data for the cases that want that control.

Not covered: At documents in a connected repository. Records in your own database, the CDS entities this capability is named for, are not a grounding source; for those the vector column in SAP HANA Cloud and the pipeline hand-written on the CAP door are still the route.

THE COMMUNITY ADDS

Community code works on the side the service leaves open: sap-knowledge-pipeline by Yassin Bahri turns records from an OData service or a HANA SELECT into chunked documents that carry the business key they came from.

Licence1

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 →

Artifacts11

Group by11 of 11 artifacts
ArtifactSignals
CDS plugins4
@cap-js/aiValue-help recommendations and SAP AI Core as a CAP service
Signals
Use terms
@saptarishi/cds-plugin-llmCAP service kind putting eleven model providers behind one API
Signals
Use terms
@saptarishi/cds-plugin-vector-hanaVector storage and similarity search on SAP HANA from CAP
Signals
Use terms
cap-llm-pluginGenerative AI in CAP with fields anonymised through SAP HANA
Signals
Functional boundary+1
Packages5
@mi8y/cap-agents-aicore-vectorstoreLangChain vector store on SAP AI Core Document Grounding
Signals
none
@mi8y/cap-agents-cds-vectorstoreLangChain vector store with CDS entities for embeddings
Signals
none
@sap/cdsCAP Node.js runtime
Signals
none
sap-knowledge-pipelinePython library turning OData or HANA records into chunked documents
Signals
Functional boundary
zvdbVector database implemented in ABAP for document chunk retrieval
Signals
none
Services2
SAP AI CoreAI runtime on BTP with the Generative AI Hub
Signals
none
SAP HANA CloudManaged SAP HANA database service on BTP
Signals
Functional boundary

Tasks1Beta

CoversCovers, under conditionsNot assessed
Answer a question from records in a CAP service3 covers, 3 under conditions

A question asked in plain words is answered from rows the CAP model already holds: the records nearest to the question in meaning are found and put in front of a language model, so the answer rests on those records rather than on what the model remembers.

Covers embedding the records, finding the nearest ones and getting them into the prompt. The call to the model is LLM integration, answering from documents in a connected repository is document grounding on the BTP door, and who may see a retrieved row is authorization. Which entitlements a subaccount holds is a project question and is not assessed here.

Covers@sap/cdsThe Vector type is built into CDS, so the embedding is an element of the entity it describes, and vector_embedding, cosine_similarity and l2distance are functions of the query language, so the retrieval is a WHERE clause and not a call to anything outside the model. A stored calculated element keeps a row's embedding in the database and recomputes it whenever the row changes on CREATE or UPDATE, which answers the question of when a record's vector is written.

Remaining work: Everything above the vector: choosing which fields of a record are embedded, splitting a text too long for one embedding, deciding how many rows to take and writing the prompt they go into. capire's guide documents no chunking function and no prompt assembly.

Open artifact →

Covers@saptarishi/cds-plugin-llmThe half the store composes with: the provider that produces the embeddings and runs the chat call, with the model chosen there rather than in the store. The store's README names it for exactly that, and lists the providers it can be pointed at.

Remaining work: Configure a provider and its credentials. Which model is used, and what it costs, is decided in this package and not in the store.

Open artifact →

Covers@saptarishi/cds-plugin-vector-hanaMoves the embed-on-write and the search into the model: a @rag annotation on an entity names the fields to embed, the plugin builds the vector table and keeps it in sync on every CRUD operation, and what is embedded is one row's projected fields as one vector. A SQLite fallback ships with it, so the same code runs on a laptop without SAP HANA Cloud.

Remaining work: Choose the fields to embed and install a provider for the embedding and chat calls, which are not in this package. A record whose text does not fit one vector is not addressed: the README describes no chunking. The README says its HANA backend is verified against a mock hdb client and not yet against a HANA Cloud instance, which it names as its top open item; the SQLite backend is what its integration tests exercise.

Open artifact →

Covers, under conditions@cap-js/aiMakes the similarity search on a laptop behave like the one in the database. Without it, capire states that SQLite and H2 emulate vector_embedding with lexical character-hash vectors, which match spelling rather than meaning; with it, the standard sqlite database generates semantic embeddings from a local ONNX model and no external service is called.

Conditions: @sap/cds ^10.1 and @cap-js/sqlite ^3.1, the versions capire states the local embeddings require Local development: the README calls the facility experimental and sends production vector workloads to SAP HANA's vector engine

Remaining work: Install the plugin in a project on the stated versions. The retrieval, the prompt and the model call are the same work as on the core path, and the answer still has to be built somewhere else for production.

Open artifact →

Covers, under conditionsSAP HANA CloudHolds the vectors in the same database as the records: REAL_VECTOR is an SQL data type of the vector engine, and COSINE_SIMILARITY and L2DISTANCE are its functions, which is what the CDS Vector type and the CQL functions map to. capire adds where the embedding model itself comes from on this database, the NLP extension or an SAP AI Core remote source, so the text-to-vector step can run inside the database rather than in the application.

Conditions: The application's database is SAP HANA Cloud. On the CAP-native way that is the way itself. On the way through [@saptarishi/cds-plugin-vector-hana](artifact:saptarishi-cds-plugin-vector-hana) it is the store's HANA backend rather than the SQLite fallback the README ships for a laptop, and that README says the HANA backend is verified against a mock client and not yet against a HANA Cloud instance.

Remaining work: Provision the database and, for vector_embedding, make an embedding model reachable from it. Nothing here retrieves for a question or writes a prompt.

Open artifact →

Covers, under conditionscap-llm-pluginCollapses the steps into one method: the README's retrieval feature embeds through SAP AI Core, searches SAP HANA Cloud's vector engine and hands the result to the model, with the embedding and the similarity search also available on their own for a handler that wants them apart.

Conditions: The vectors are in SAP HANA Cloud's vector engine, which every retrieval feature in the README is written against An SAP AI Core binding provides the embedding and chat models

Remaining work: Fill the vector table first: the README describes generating embeddings and searching them, and neither chunking nor an embed-on-write handler is part of it. The README also states that the plugin is not an official SAP product and is published as a community contribution.

Open artifact →

Content24

Group by24 of 24 pieces
Piece, what it offers
CAP in the age of AI #7 - vector embeddings wrap-up
YouTube — SAP Developers playlists, DJ Adams, Johannes Vogt, part 7 of 7, Video
CAP in the age of AI #6 - vector embeddings
YouTube — SAP Developers playlists, DJ Adams, Johannes Vogt, Daniel Schlachter, part 6 of 7, Video
🟣 Bring AI into Your ABAP Applications with ISLM: Build, Integrate, and Consume AI Natively
YouTube — SAP Developers playlists, SAP Developers, Talk
Show 15 more
CAP in the age of AI
YouTube — SAP Developers playlists, DJ Adams, Johannes Vogt, Simon Engel, Stefan Rudi, Daniel Schlachter, Series
Michael Jackson: AI Cognitive Pipeline on SAP BTP, SAP CAP, ElevenLabs, Claude, HANA DB, Solace
SAP Community, Shahid, BlogThe reasoning
A Use Case for HANA Cloud Knowledge Graph: AI‑Driven Tender Analysis
SAP Community, giacomo_dantonio, BlogThe reasoning
Semantic search in CAP (Node.js): vector embeddings and cosine similarity
SAP Community, Nico Schoenteich, BlogThe reasoningRunnable code
Building a Generative AI-powered Inventory Assistant with SAP CAP, RAG, and Vector Database
SAP Community, furkan5, BlogThe reasoningRunnable code
Generative AI on SAP BTP
SAP Architecture Center, SAP Architecture Center, Reference architectureThe reasoningA reference
Core changed
Multi-modal RAG Proof of Concept: facilitating tech support
SAP Community, maxlienhardt, BlogThe reasoning
Out-of-the-Box Document Grounding in SAP AI Core: RAG with SAP Help Portal
SAP Community, Joni, Blog
HANA Cloud’s VECTOR EMBEDDING in CAP and Comparison with OpenAI Embedding
SAP Community, lalitmohan, BlogThe reasoningA recipeRunnable code
Using HANA Cloud’s "VECTOR_EMBEDDING" Function in CAP
SAP Community, Mio Yasutake, BlogThe reasoningRunnable code
RAG with SAP HANA Cloud Vector Engine, GenAI Hub & CAP
SAP Community, KevinR, BlogThe reasoningA recipeRunnable code
Document Grounding
SAP BTP AI Best Practices, SAP, DocThe reasoningA reference
Vector RAG vs Graph RAG
SAP BTP AI Best Practices, SAP, DocThe reasoning
Conversational search for the Cloud Integration capability
SAP TechEd — session catalogue, Vadim Klimov, TalkThe reasoning
Building agentic applications with SAP HANA Cloud
SAP TechEd — session catalogue, TalkA recipe
CAP in the age of AI #7 - vector embeddings wrap-up
YouTube — SAP Developers playlists, DJ Adams, Johannes Vogt, part 7 of 7, Video
CAP in the age of AI #6 - vector embeddings
YouTube — SAP Developers playlists, DJ Adams, Johannes Vogt, Daniel Schlachter, part 6 of 7, Video
🟣 Bring AI into Your ABAP Applications with ISLM: Build, Integrate, and Consume AI Natively
YouTube — SAP Developers playlists, SAP Developers, Talk
Show 2 more
Document Grounding
SAP BTP AI Best Practices, SAP, DocThe reasoningA reference
Building agentic applications with SAP HANA Cloud
SAP TechEd — session catalogue, TalkA recipe
CAP in the age of AI #7 - vector embeddings wrap-up
YouTube — SAP Developers playlists, DJ Adams, Johannes Vogt, part 7 of 7, Video
CAP in the age of AI #6 - vector embeddings
YouTube — SAP Developers playlists, DJ Adams, Johannes Vogt, Daniel Schlachter, part 6 of 7, Video
Building agentic applications with SAP HANA Cloud
SAP TechEd — session catalogue, TalkA recipe
Show 6 more
Accelerating Your Analytics with Delta Table Replication into SAP HANA Cloud
SAP Community, SeungjoonLee, Blog
Talking to your database: The new data exploration tools in SAP HANA Cloud
SAP TechEd — session catalogue, TalkThe reasoning
Build AI agents and applications natively on SAP HANA Cloud
SAP TechEd — session catalogue, TalkThe reasoning
Road map for SAP HANA Cloud: What’s next for the AI database
SAP TechEd — session catalogue, Thomas Hammer, TalkThe reasoning
SAP HANA Cloud: The data foundation for contextualizing and reasoning
SAP TechEd — session catalogue, TalkThe reasoning
SAP HANA Cloud as the AI database for SAP Business Data Cloud
SAP TechEd — session catalogue, Thomas Hammer, TalkThe reasoning
CAP in the age of AI #7 - vector embeddings wrap-up
YouTube — SAP Developers playlists, DJ Adams, Johannes Vogt, part 7 of 7, Video
HANA Cloud’s VECTOR EMBEDDING in CAP and Comparison with OpenAI Embedding
SAP Community, lalitmohan, BlogThe reasoningA recipeRunnable code
RAG with SAP HANA Cloud Vector Engine, GenAI Hub & CAP
SAP Community, KevinR, BlogThe reasoningA recipeRunnable code

Seen working11

ArtifactSignals
Samples11
cap-bp-ragEvent-driven RAG app with CAP, Cloud Integration and SAP HANA Cloud
No license
cap-embedding-functionCAP service computing embeddings with HANA Cloud vector_embedding
none
cap-vector-hcVECTOR_EMBEDDING in a CDS entity for FAQ similarity search
No license
SAP BTP AI Best Practice Demo - Vector Embedding (RAG) - CAPCAP samples embedding CSV rows into the SAP HANA Cloud vector store
Functional boundary
SAP BTP AI Best Practice Demo - Vector Query (RAG) - CAPCAP samples running RAG similarity queries over SAP HANA Cloud vectors
Functional boundary
sap-btp-ai-best-practicesSample implementations for AI-powered applications on SAP BTP
none
sap-genai-hub-with-sap-hana-cloud-vector-engineWorkshop on HANA Cloud vector engine, Generative AI Hub and LangChain
none
SAP-samples/btp-cap-genai-ragCAP reference app for GenAI email support with RAG on HANA Cloud
none
SAP-samples/btp-cap-genai-semantic-searchCAP sample for semantic search with Generative AI Hub and HANA Cloud
none
SAP-samples/generative-ai-codejamCodeJam deploying an LLM on Generative AI Hub and building RAG
none
teched2025-DA261TechEd 2025 workshop on SAP HANA Cloud's AI capabilities
none

Details

What changed — and what it makes stale1
CAP Java 4.9.0, CAP, Java

Before this, the core's similarity function was HANA's alone, and turning text into a vector at query time meant calling SAP HANA's VECTOR_EMBEDDING directly rather than through a CQL function. CAP Java gained CQL.vectorEmbedding, which calls VECTOR_EMBEDDING for you, and CQL.cosineSimilarity / CQL.l2Distance now work — per capire — as 'Retrieval-augmented generation (RAG) with vector embeddings on all the four databases,' not just HANA. It ships Beta and CAP-Java-only; Node.js has no equivalent. CAP Java 4.9.0 reached Maven Central on 2026-04-23.

Makes stale:

Guidance that the CAP-modelled similarity function only ever runs against HANA, or that turning text into a query-time vector always means a raw HANA call outside CQL — true for CAP Java before April 2026, not since. It does not touch Node.js, and it does not touch chunking or the embed-on-write pipeline, which is still every entry in this capability's own job.

SourceCAP Release April 26 — capirechecked
Coverage
statecore and community, CAP
assessed
state in ABAPcore and community, assessed
state in BTP/BAIPcore and community, assessed
relationshipunassessed
also inABAP, BTP/BAIP
Designs that place it1
Integrating and Extending JouleIntegrating and Extending Joulereference architecturedocument grounding in customer-owned content
For your agent
Ref
capability:retrieval-augmented-generation
JSON
/capabilities/retrieval-augmented-generation.json
MCP
Connecting an agent