sap-btp-ai-best-practices
SAP's collection of sample implementations for AI-powered applications on SAP BTP, one directory per topic under best-practices, in TypeScript, Python, Java and CAP.
Building an AI-powered application on SAP BTP raises the same five problems each time, and each one is worked out in a directory of its own here: reaching a generative AI model securely, filtering the model's output, masking PII in what is sent to it, writing prompt templates, and building a retrieval-augmented generation system. Each carries code samples in TypeScript, Python, Java and CAP, and its own setup instructions; there is no shared install step. Beside them a use-cases directory holds end-to-end implementations, and the prose documentation for the code sits on a site of its own. It needs an SAP BTP account with access to 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.
Facts
Where it sits
Who is behind it
In the atlas: maintains 222@SAP-samplesmaintainerAjinkya PatilContributes to this
In the atlas: contributes to 112@ajinkyapatil8190Andrey RzhaksynskiyContributes to this
In the atlas: contributes to 1@AndreyRzhaksinskiyBhagabat Prasad BeheraContributes to this
In the atlas: contributes to 1@BhagabatPDan AntonioContributes to this
In the atlas: contributes to 1@dantonio-sapFrancisco RobledoContributes to this
In the atlas: contributes to 1@frrobledoJRSAPAIContributes to this
In the atlas: contributes to 1@JRSAPAILuís MarquesContributes to this
In the atlas: contributes to 8@luismarques-iomara004Contributes to this
In the atlas: contributes to 1@mara004Ricardo ChinContributes to this
In the atlas: contributes to 1@roakedrob-sc-sapContributes to this
In the atlas: contributes to 1@rob-sc-sap13 contributors
What it declares
Every artifact
- Type
- Sample
- Origin
- By SAP
- Use as
- A reference
As a sample
- Form
- does not say
Connections
Checking model input and output against content rules
Replacing personal values in a prompt with placeholders
Calling a language model with tenant and credential handling solved
Prompt templates stored and versioned apart from the code
Grounding a model's answer in data retrieved at question time
AI runtime on BTP with the Generative AI Hub
Download
README
quoted from SAP-samples/sap-btp-ai-best-practices under Apache-2.0, readSAP BTP AI Best Practices
For comprehensive documentation related to this code: SAP BTP AI Best Practices
Description
This repository provides a comprehensive collection of best practices and sample implementations for AI-powered applications on SAP Business Technology Platform (BTP). It serves as a practical guide for developers looking to implement enterprise-grade AI solutions using SAP's AI services and integration with generative AI models.
The examples provided demonstrate how to:
- Securely access generative AI models
- Implement content filtering for AI-generated outputs
- Apply data masking for PII protection
- Create effective prompt templates
- Build retrieval-augmented generation (RAG) systems
Each best practice includes code samples in multiple programming languages (TypeScript, Python, Java, CAP) to support various technology stacks and development approaches.
Requirements
- SAP Business Technology Platform account
- Access to SAP AI Core service
Download and Installation
-
Clone the repository:
git clone https://github.tools.sap/btp-ai-best-practices/sap-btp-ai-best-practices.git cd sap-btp-ai-best-practices -
Follow the setup instructions in the README of each specific best practice directory.
For example, to run the TypeScript example for accessing generative AI models:
cd best-practices/access-to-generative-ai-models/typescript npm install cp .env.example .env # Edit the .env file with your service key npm start
Repository Structure
sap-btp-ai-best-practices/
├── best-practices/ # Best practices implementations
└── use-cases/ # End-to-end use case implementations
For a detailed overview of available best practices, see the best practices directory.
Known Issues
No known issues.
How to obtain support
Create an issue in this repository if you find a bug or have questions about the content.
For additional support, ask a question in SAP Community.
Contributing
If you wish to contribute code, offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses the standard DCO text of the Linux Foundation.
License
Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.
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
Contributors
History in the atlas
- First seen.
For your agent
- Ref
artifact:sap-samples-sap-btp-ai-best-practices- JSON
- /artifacts/sap-samples-sap-btp-ai-best-practices.json
- MCP
- Connecting an agent