{"ref":"artifact:sap-samples-btp-ai-bp-vector-rag-query-cap","page":"/artifacts/sap-samples-btp-ai-bp-vector-rag-query-cap","json":"/artifacts/sap-samples-btp-ai-bp-vector-rag-query-cap.json","generated":"2026-10-26","drafted_with_ai":true,"entity":{"id":"sap-samples-btp-ai-bp-vector-rag-query-cap","name":"SAP BTP AI Best Practice Demo - Vector Query (RAG) - CAP","artifact_type":"sample","ecosystem":"cap","serves_ecosystems":["btp"],"flavors":[{"key":"node","source":{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README, prerequisites","checked":"2026-10-19","quote":"Node.js LTS version"}}],"use_as":"reference","domain":"ai-and-agents","origin_ring":"sap-official","description":{"one_line":"A CAP backend-sample and fullstack-sample that run a similarity query over the vectors in [SAP HANA Cloud](artifact:btp-hana-cloud) and pass the closest science-data rows to the model as context.","short":"CAP samples running RAG similarity queries over SAP HANA Cloud vectors","what_it_solves":"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](artifact:btp-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](artifact:btp-ai-core) instance. Where [the embedding sample](artifact:sap-samples-btp-ai-bp-vector-rag-embedding-cap) stops at writing the vectors, this one reads them back; its fullstack-sample shows the same service behind a UI, in three screenshots.","when_not_to_use":"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."},"links":{"repo":"https://github.com/SAP-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/vector-rag-query/cap"},"type_properties":{"form":{"value":"reference-application","sources":[{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README","checked":"2026-10-19","quote":"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."}]}},"identity":{"license":"Apache-2.0"},"source_available":true,"compat":{"runtimes":["node"]},"demonstrates":["capability:retrieval-augmented-generation"],"requires":[{"ref":"artifact:btp-ai-core","for":"The service instance the samples bind to at runtime: the embeddings for an upload, and the model the retrieved documents are passed to.","sources":[{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README","checked":"2026-10-19","quote":"Access to SAP AI Core service"}]},{"ref":"artifact:btp-hana-cloud","for":"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.","sources":[{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README, local deployment","checked":"2026-10-19","quote":"Build the HANA / HDI Container\n\n   ```bash\n   npm run build:db\n   ```"}]}],"connects":[{"ref":"artifact:btp-ai-core","kind":"data","direction":"outbound","for":"The rows sent for embedding on upload, and the retrieved documents passed to the model as context at inference.","sources":[{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README, configuration","checked":"2026-10-19","quote":"The application requires proper configuration to connect to the SAP AI Core service. This is handled through CDS bindings in both local and remote deployments."},{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README","checked":"2026-10-19","quote":"use them as context for the LLM during inference"}]},{"ref":"artifact:btp-hana-cloud","kind":"data","direction":"outbound","for":"The similarity search over the stored vectors, and the top-matching documents it returns.","sources":[{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README","checked":"2026-10-19","quote":"This project demonstrates how to retrieve top-matching documents from the SAP HANA Vector Store"},{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README, usage","checked":"2026-10-19","quote":"GET `/queryScienceData` query the uploaded science data for similar records using vector query"}]}],"interfaces":[{"kind":"api","protocol":"odata-v4","direction":"in","for":"Upload a CSV and create the embeddings for it, view the uploaded science data, and query it for similar records using vector query.","sources":[{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README, usage","checked":"2026-10-19","quote":"The application will serve the following APIs:\n\n - POST `/uploadScienceData` upload and created embeddings for the science data from a CSV file.\n - GET `/scienceData` view the uploaded science data\n - GET `/queryScienceData` query the uploaded science data for similar records using vector query"},{"url":"https://raw.githubusercontent.com/SAP-samples/sap-btp-ai-best-practices/main/best-practices/generative-ai/vector-rag-query/cap/backend-sample/README.md","title":"SAP-samples/sap-btp-ai-best-practices — vector-rag-query/cap/backend-sample README, usage","checked":"2026-10-19","quote":"--url 'http://localhost:4004/odata/v4/rag/queryScienceData(query=%27how%2520to%2520test%2520for%2520fat%2520in%2520foods%27)'"}]}],"maintainers":["actor:sap-samples"],"drafted_with_ai":true,"provenance":{"discovered_via":[{"source":"source:curator"}],"first_seen":"2026-09-14"},"contributors":["actor:luismarques-io"]},"effective_normative_relations":[],"readings":{"liveness":[{"label":"Maintenance","tier":"unknown","evidence":"no release data"},{"label":"Continuity","tier":"good","evidence":"15 contributors, org-owned"},{"label":"Repository","tier":"good","evidence":"pushed 2026-10, not archived"}],"compatibility":[{"label":"Declared for","tier":"fair","evidence":"nothing declared"},{"label":"Survived majors","tier":"unknown","evidence":"no release dates"},{"label":"Maintainer's CI","tier":"fair","evidence":"no CI configured"}],"practice":[{"label":"Tests","tier":"good","evidence":"214 test files"},{"label":"Docs","tier":"fair","evidence":"README 1 KB"},{"label":"Changelog","tier":"fair","evidence":"none in the repo"}],"reach":[{"value":null,"unit":"installs/week"},{"value":68,"unit":"watching"}]},"signals":{"crawled_at":"2026-10-25","npm":"not published under this name","stars":68,"forks":59,"open_issues":8,"archived":false,"pushed_at":"2026-10-19","license_spdx":"Apache-2.0","org_owned":true,"default_branch":"main","created_at":"2025-03-07T14:29:58Z","open_prs":6,"tree_truncated":false,"test_files":214,"workflows":0,"other_ci":false,"readme_bytes":1304,"docs_files":0,"changelog":false,"license_file":true,"dts_files":2,"first_commit":"2025-05-27","last_commit":"2025-05-27","commits":1,"contributors":15,"readme_path":"best-practices/generative-ai/vector-rag-query/cap/README.md","readme_sha":"47712b96589a45ee4edebf1487cda970848c082c","repo_read":"2026-10-25"},"edges":{"maintainers":[{"ref":"actor:sap-samples","name":"SAP Samples","json":"/actors/sap-samples.json"}],"contributors":[{"ref":"actor:luismarques-io","name":"Luís Marques","json":"/actors/luismarques-io.json"}],"explained_by":[],"alternative_to_this":[],"needed_by":[],"available_via":[],"parts":[],"add_ons":[],"answered_through_parts":[]}}