Sample CAP Application with SAP Cloud SDK for AI
A CAP backend-sample and fullstack-sample pair that call 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 through the SAP Cloud SDK for AI: a capital-of-country question and a templated chat completion.
The backend-sample is a standalone CAP service with an orchestration CDS service exposing two actions, askCapitalOfCountry and a templated chatCompletion, built with @sap-ai-sdk/ai-api@sap-ai-sdk/ai-apiThe AI Core API surface of SAP's AI SDK, covering deployments, configurations and the rest of the control plane, as opposed to calling a model.sap official, cap, @sap-ai-sdk/foundation-models@sap-ai-sdk/foundation-modelsThe package of SAP's AI SDK that calls foundation models through SAP AI Core and the Generative AI Hub, and the one an application actually reaches for.sap official, cap and @sap-ai-sdk/orchestration@sap-ai-sdk/orchestrationThe Orchestration Service client of SAP's AI SDK, which applies templating, grounding, filtering and masking around a model call rather than in the application.sap official, cap; the fullstack-sample pairs the same service with a UI5 app under app/ask-capital that calls it over OData V4. For a local run both bind to an 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 with cds bind; the deployed fullstack sample names the instance in its mta.yml instead.
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 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
Calling a language model with tenant and credential handling solved
AI runtime on BTP with the Generative AI Hub
AI runtime on BTP with the Generative AI Hub
Download
README
quoted from SAP-samples/sap-btp-ai-best-practices under Apache-2.0, readCAP Implementations for Generative AI Access
This directory contains Cloud Application Programming (CAP) model implementations that demonstrate best practices for accessing generative AI models through SAP BTP services.
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-access-to-generative-ai-models-cap- JSON
- /artifacts/sap-samples-btp-ai-bp-access-to-generative-ai-models-cap.json
- MCP
- Connecting an agent