SAP BTP AI Best Practice Demo - Vector Query (RAG) - CAP
A CAP backend-sample and fullstack-sample that run a similarity query over the vectors in 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 and pass the closest science-data rows to the model as context.
The service exposes three actions: uploadScienceData, which creates the embeddings for an uploaded CSV, scienceData, which lists the stored rows, and queryScienceData, which returns the rows closest to a query string. Its README sets out the reasoning first: a vector store keeps documents in vectorized form, similarity metrics retrieve the most semantically relevant ones, and those are passed to the model as context during inference, which is what retrieval-augmented generation names. The rows live in 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, whose HDI container the sample builds with npm run build:db before a run, beside the cds bind for its 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 instance. Where the embedding sampleSAP BTP AI Best Practice Demo - Vector Embedding (RAG) - CAPA CAP backend-sample and fullstack-sample that parse an uploaded CSV of science data, embed each row through SAP AI Core and store the vectors in SAP HANA Cloud's vector store.sap official, cap stops at writing the vectors, this one reads them back; its fullstack-sample shows the same service behind a UI, in three screenshots.
Facts
Where it sits
Who is behind it
In the atlas: maintains 222@SAP-samplesmaintainerLuís MarquesContributes to this
In the atlas: contributes to 8@luismarques-io1 contributor
Before choosing this
Conditions
PracticalFunctional boundary
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.
What it declares
Every artifact
- Type
- Sample
- Origin
- By SAP
- Use as
- A reference
- Runtime
- Node.js
As a sample
- Form
- A reference application
Connections
Grounding a model's answer in data retrieved at question time
AI runtime on BTP with the Generative AI Hub
Managed SAP HANA database service on BTP
AI runtime on BTP with the Generative AI Hub
Managed SAP HANA database service on BTP
Download
README
quoted from SAP-samples/sap-btp-ai-best-practices under Apache-2.0, readCAP Implementations for Generative AI Access
Large Language Models (LLMs) may struggle to answer questions about topics not present in their training data. To overcome this limitation, external information can be provided during inference to enhance the model’s response. This technique is known as Retrieval-Augmented Generation (RAG).
To fetch the relevant context for a given query, a vector store is used to store documents in vectorized form. Using similarity metrics, the store retrieves the most semantically relevant documents, which are then passed as context to the LLM.
This project demonstrates how to retrieve top-matching documents from the SAP HANA Vector Store and use them as context for the LLM during inference.
Available Samples
- backend-sample: Standalone CAP backend service implementation
- fullstack-sample: Complete CAP application with UI5 frontend
Overview
These samples showcase how to:
- Connect to generative AI services from CAP applications
- Structure service layers for AI orchestration
- Implement proper error handling
- Deploy applications to SAP BTP
Getting Started
Each subdirectory contains a comprehensive README.md with detailed setup instructions, deployment guides, and usage examples.
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
Flavors
Contributors
History in the atlas
- First seen.
For your agent
- Ref
artifact:sap-samples-btp-ai-bp-vector-rag-query-cap- JSON
- /artifacts/sap-samples-btp-ai-bp-vector-rag-query-cap.json
- MCP
- Connecting an agent