This repo wants to give users of the SAP Business Technology Platform (BTP) a quick way to learn how to use generative AI with BTP services.
You have access to an SAP BTP global account or an existing SAP BTP sub account.
Visual Studio Code
is installed on your machine with the Dev Container
extension. You understand purpose and basic concepts of Dev Containers in VS Code.
As prerequisite for using dev containers, Docker
is installed on your machine and you understand its basics concepts.
Git
is available on your machine (test with git --version
) and you know how to clone a project from github.
The SAP BTP global account needs to be sufficiently entitled to use the following services and applications:
Name | Service/ Application | Plan |
---|---|---|
AI Core | aicore (service) |
extended |
AI Launchpad (optional) | ai-launchpad (app subscription) |
standard |
HANA Cloud | hana-cloud (service) |
hana |
HANA Cloud Tools | hana-cloud-tools (app subscription) |
tools |
Reopen in Dev Container
).Be aware that opening the dev container can take a while!
config/secrets
rename the file btp_ai_setup.tfvars
to my_btp_ai_setup.tfvars
.
globalaccount
for the subaccount to be created within. You find in the global account landing page ("Subdomain: .....").idp
e.g. <your-ias-tenant>.accounts.ondemand.com
.admins
. This should be looking similar to this: admins = ["[email protected]"]
.config/secrets
rename the file btp_credentials.tfvars
to my_btp_credentials.tfvars
.
BTP_USERNAME
to your email address../run.sh
and enter your BTP_PASSWORD
as well as the password for the HANA DB
(you will be prompted accordingly).
Make sure that the password for the HANA DB matches the minimum requirements (length >= 8, 1+ upper case chars, 2+ lower case chars, 1+ digit)!
In case you want to authenticate via Single-Sign-On (SSO) you should set the enironment variable
BTP_ENABLE_SSO
totrue
. You do this by running the following command within your dev container:export BTP_ENABLE_SSO=true
The startet script will now setup the following things for you in your SAP BTP global account:
my_btp_ai_setup.tfvars
file (folder config/secrets
)..env
that will be copied into the config/secrets
folder.The second step will automatically be taken care of by the running
./run.sh
command from step 1.
After the successful setup of the BTP subaccount, it calls the python scriptpoetry run python main.py
in the folderscripts
.
That python script does the following:
.env
file from step 1 into the environment variables of the session.target_ai_core_model
).After the steps above, you are all set for your first genAI experiments on SAP BTP.
You can proceed by switching to the folder scripts/step03_explore_examples
.
Here you will find some examples with respective instructions and sample code.
❗There is an existing issue that makes AI Core API token invalid for about 1-2 hours after it was created. We implemented a retry mechanism, nevertheless, until the issue is resolved, running the
./run.sh
might result in the following error. As a temporary workaround, just re-run the./run.sh
in 1-2 hours.
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.
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.
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.