Quick Start for Your First AI Project Using SAP AI Core
- How to connect GitHub to SAP AI Core
- How to create scenarios and workflows
- How to check the sync status and debug errors in your AI workflow
- How to run workflows in SAP AI Core
- Have Postman, Python (AI Libraries) or SAP AI Launchpad set up. You can set any of these up using this tutorial
You will create an AI workflow for your Hello, World! workflow, and connect and execute it in your SAP AI Core instance. You will see that workflows between GitHub and SAP AI Core can be auto synced, and it is possible to use this workflow after subscription, to connect to your actual AI code.
The terms “executable” and “workflow” can be used interchangeably to refer to the YAML files, introduced in this tutorial.
- Step 1
Create account on GitHub.
WARNING: If you are using a GitHub account hosted by your organization, it must be external facing (not behind a firewall).
Click New to create a new repository. You will use this GitHub repository to store all of your workflows for SAP AI Core. Each workflow may belong to more than one AI use case.
Create a repository named
aicore-pipelines. It is recommended have this repository’s visibility set to private.
- Step 2
Click on your GitHub profile icon. Select Settings.
Click Developer Settings from the left navigation pane.
Click Personal access tokens. Click on Generate new token. GitHub tokens are an alternative to sharing your GitHub credentials so that you can allow applications like SAP AI Core to access you GitHub repositories, without compromising your account security.
Give the name
my_access_tokenin the Note field and select the checkbox
Full control of private repositoriesin the Select Scopes field.
Scroll to the bottom of page and click Generate token.
Store your generated access token locally.
How are scenarios created in SAP AI Core?
- Step 3
Use the following information as reference:
URL: Paste the URL of your GitHub repository and add the suffix
Username: Your GitHub username.
Password: Paste your GitHub Personal Access Token, generated in the previous step.
You will see your GitHub onboarding completed in a few seconds. In the next steps you will learn how to enable auto syncing of workflows from GitHub.
CAUTION These onboarding steps only store credentials to access the specified SAP AI Core instance within your GitHub account. Therefore, this Completed status does not guarantee that your SAP AI Core is able to access a given file, in your GitHub repository. If you need to debug this, follow the steps of application creation and debugging.
- Step 4
Workflows for SAP AI Core are created using YAML or JSON files that are compatible with the SAP AI Core schema. Let’s start with a simple workflow which will output a log file, containing:
Hello from SAP AI Core.
In your GitHub repository, click Add file > Create new file.
LearningScenarios/hello_pipeline.yamlinto the Name your file field. This will automatically create the folder
LearningScenariosand a workflow named
CAUTION Do not use the name of your workflow file (
hello_pipeline.yaml) as any other identifier within SAP AI Core.
Now copy and paste the following snippet to the editor. The code is also available by following this link.YAMLCopy
apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: first-pipeline # Executable ID (max length 64 lowercase-hyphen-separated), please modify this to any value if you are not the only user of your SAP AI Core instance. Example: `first-pipeline-1234` annotations: scenarios.ai.sap.com/description: "Introduction to SAP AI Core" scenarios.ai.sap.com/name: "Tutorial" executables.ai.sap.com/description: "Greets the user" executables.ai.sap.com/name: "Hello Pipeline" labels: scenarios.ai.sap.com/id: "learning" ai.sap.com/version: "1.0" spec: entrypoint: mypipeline templates: - name: mypipeline steps: - - name: greet template: greeter - name: greeter container: image: docker.io/python:latest command: - python3 - '-c' args: - | print("Hello from SAP AI Core")
CAUTION The key
metadata > namespecifies your executable ID. In the example below, the value
first-pipelinebecomes your executable ID. This executable ID is a unique identifier for your workflow within SAP AI Core. The executable ID of each workflow needs to be unique from all other workflows and GitHub repositories that you sync with your SAP AI Core instance. If your SAP AI Core instance is shared with other users, edit the value to be sure that it is unique, for example,
Scroll to the bottom of page and click Commit new file.
The workflow contains annotations, which are identifiers for SAP AI Core. Your AI use case is termed Scenario (
Tutorialin this case) and within each scenario you create executables (workflows), (
Hello Pipelinein this case). These workflows are used for training, serving or batch inferencing.
IMPORTANT Recall that the executable ID (
namein this case) within your workflow (
first-pipelinein this case) must be unique across all GitHub repositories onboard to your SAP AI Core instance. If your SAP AI Core instance is shared, update the value to
The executable uses a step by step flow and starts with
templates(blocks of code). The order of steps is shown in the example by the values:
mypipeline > greet > greeter.
The code first takes takes a public docker image of python, which is run a using a python interpreter, and prints an output.
What is a Docker Image?
A Docker Image is a portable Linux environment, similar to a virtual machine. Docker images are layered environments, which means you may just have Linux OS (for example
Distrom) as one Docker image or another Docker image which has python layered on top of that Linux.
While the code in this tutorial is written directly in the workflow, in actual production you will store the code scripts within your Docker Image. The number of code files and programming language are your preferences.
Which is the most unique identifier for your workflow? (Hint: This is the identifier you must ensure is unique across all your workflows, even if you onboard multiple GitHub repositories to your SAP AI Core)
- Step 5
Use the following information for reference:
Application Name: An identifier of your choice.
learning-scenarios-appis used as an example of best practice in this tutorial because it is a descriptive name.
Repository URL: Your GitHub account URL and repository suffix. This helps you select the credentials to access the repository.
Path: The folder in your GitHub where your workflow is located. For this tutorial it is
Revision: The is the unique ID of your GitHub commit. Set this to
HEADto have it automatically refer to the latest commit.
IMPORTANT Not all the files from your GitHub repository will be synced. Only the files present in the path mentioned in Path in Repository will be searched for YAML files and synced with SAP AI Core, excluding subfolders. This means that to sync different folders and subfolders of your GitHub in your production system, you are required to create multiple applications. Your path entry should have the format:
- Step 6
If there are any errors in the syntax of your executable then this application status will report
messagewith the error in the code output.
Most common errors likely to occur are:
Message Meaning Unable to resolve … to a commit SHA This means the value of Revision used while creating application is unreachable. repository not found Your GitHub Repository linked with your application is not found.
Please refer the Troubleshooting guide if encounter them.
If you have placed an incorrect pipeline, where would you find the error messages?
- Step 7
- Step 8
Why not directly create an execution ?
An execution is just an instance of the configuration running. The configuration is set of binding information between your workflow and datasets. In this tutorial you are just using the workflow information in the configuration.
- Step 9
Having set all of the automation in the previous steps, it is easy to update your workflow and execute it.
Click Edit (the pencil icon) on your YAML file on your GitHub repository.
Update the greeting message in the executable on your GitHub. It is also recommended to update the version value. The value of
api.sap.com/versionis a string identifier of your choice.
Click Commit Changes.
- Step 10
Note Although the configuration binds using the ID, not the version of the executable, checking the version is a quick way to check if the most recent version is synced or not.
Updating the value of version annotation (api.sap.com/version) in you workflow makes which task easy: