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-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 Core.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Demonstrates
LLM integrationBTPLLM integrationcapabilityCalling a language model from application code with the tenant, destination and credential handling already solved instead using an SDK call with a hand-rolled key.Content filteringBTPContent filteringcapabilityChecking what goes into a model and what comes out of it against content rules, and stopping or flagging a request that fails them. Distinct from [data masking](capability:data-masking), which hides values: a filter refuses content.Data maskingBTPData maskingcapabilityReplacing the personal or confidential values in a prompt with placeholders before it leaves for a model, and putting them back in the answer. Anonymisation, where the values are gone for good, and pseudonymisation, where they return, are the two forms; which fields count as sensitive is the application's question, not the module's.Prompt managementBTPPrompt managementcapabilityKeeping the prompts an application sends to a model as templates with placeholders, stored and versioned apart from the code that calls them, so a change of wording is not a deployment. What people conflate under it: the template filled at runtime, the registry it lives in, and the orchestration step that fills it.Retrieval-augmented generationBTPRetrieval-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.
Requires
SAP AI CoreSAP AI Coreartifactthe AI service every example calls; the README lists access to it beside a BTP account as the repository's two requirements.

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerAjinkya PatilPersonContributes to this
In the atlas: contributes to 112
@ajinkyapatil8190
Andrey RzhaksynskiyPersonContributes to this
In the atlas: contributes to 1
@AndreyRzhaksinskiy
Bhagabat Prasad BeheraPersonContributes to this
In the atlas: contributes to 1
@BhagabatP
Dan AntonioPersonContributes to this
In the atlas: contributes to 1
@dantonio-sap
Francisco RobledoPersonContributes to this
In the atlas: contributes to 1
@frrobledo
JRSAPAIPersonContributes to this
In the atlas: contributes to 1
@JRSAPAI
Luís MarquesPersonContributes to this
In the atlas: contributes to 8
@luismarques-io
mara004PersonContributes to this
In the atlas: contributes to 1
@mara004
Ricardo ChinPersonContributes to this
In the atlas: contributes to 1
@roaked
rob-sc-sapPersonContributes to this
In the atlas: contributes to 1
@rob-sc-sap
13 contributors

What it declares

Every artifact

Type
Sample
Origin
By SAP
Use as
A reference

As a sample

Form
does not say

Connections6

README

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

SAP BTP AI Best Practices

REUSE status

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

  1. 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
  2. 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.

Apache-2.0, read

Details

Sources3
Added by handdiscovered herechecked
github.com/SAP-samples/sap-btp-ai-best-practicestree, pushes, contributors, CIchecked
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
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainbtp, ai-and-agents
Contributors13
History in the atlas1
  1. 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