SampleSampletypeA worked example you read or clone. Evidence: it demonstrates, it never provides.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →Reference

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 Cloud 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 Cloud, whose HDI container the sample builds with npm run build:db before a run, beside the cds bind for its SAP AI Core instance. Where the embedding sample stops at writing the vectors, this one reads them back; its fullstack-sample shows the same service behind a UI, in three screenshots.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Demonstrates
Retrieval-augmented generationCAPBTPRetrieval-augmented generationcapabilityGrounding 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.
Serves
Flavors
Requires
SAP AI CoreSAP AI CoreartifactThe service instance the samples bind to at runtime: the embeddings for an upload, and the model the retrieved documents are passed to.SAP HANA CloudSAP HANA CloudartifactWhere the vectors are stored and searched: the sample's schema is built into an HDI container by its own build:db step before a query can run.

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerLuís MarquesPersonContributes to this
In the atlas: contributes to 8
@luismarques-io
1 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

Connections5

SAP BTP AI Best Practice Demo - Vector Query (RAG) - CAP connectionsSAP BTP AI Best PracticeDemo - Vector Query(RAG) - CAPPROVIDES→ demonstrates1demonstrates authoredRetrieval-augmented generationNEEDS→ connects to2connects to stated The rows sent for embedding on upload, and the retrieved documents passed to the model as context at inference. SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README, configuration: https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README: https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.mdSAP AI Coreconnects to stated The similarity search over the stored vectors, and the top-matching documents it returns. SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README: https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README, usage: https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.mdSAP HANA Cloud→ needs2needs stated The service instance the samples bind to at runtime: the embeddings for an upload, and the model the retrieved documents are passed to. SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README: https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.mdSAP AI Coreneeds stated Where the vectors are stored and searched: the sample's schema is built into an HDI container by its own `build:db` step before a query can run. SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README, local deployment: https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.mdSAP HANA Cloud

README

quoted from SAP-samples/sap-btp-ai-best-practices under Apache-2.0, read
SAP-samples/sap-btp-ai-best-practices/best-practices/generative-ai/vector-rag-query/cap/README.mdOn GitHub

CAP 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

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.

Apache-2.0, read

Details

Sources3
Added by handdiscovered herechecked
best-practices/generative-ai/vector-rag-query/cap/README.mdquoted, and what the entry declareschecked

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
runtimesnode
discovered viaAdded by hand
first seen in the atlas
ecosystem and domaincap, ai-and-agents
Flavors1
Contributors1

From the repository’s contributor list, .

History in the atlas1
  1. 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