Skip to Content

Strategic Prediction with SAP RPT-1: A Comprehensive Guide

In this tutorial, you will learn how to use SAP RPT-1 — SAP's Relational Pretrained Transformer — to run regression and classification predictions on structured business data
You will learn
I321506Smita NaikJuly 2, 2026
Created by
I321506
July 2, 2026
Contributors
I321506

Prerequisites

  1. BTP Account
    If you do not already have a commercial SAP Business Technology Platform (BTP) account, you can use BTP Advanced Trial.
    Create a BTP Account
  2. For SAP Developers or Employees
    Internal SAP stakeholders should refer to the following documentation: How to create BTP Account For Internal SAP Employee, SAP AI Core Internal Documentation
  3. For External Developers, Customers, or Partners
    Follow this tutorial to set up your environment and entitlements: External Developer Setup Tutorial, SAP AI Core External Documentation
  4. Create BTP Instance and Service Key for SAP AI Core
    Follow the steps to create an instance and generate a service key for SAP AI Core. Ensure to use service plan extended:
    Create Service Key and Instance
  5. AI Core Setup Guide
    Step-by-step guide to set up and get started with SAP AI Core:
    AI Core Setup Tutorial
  6. An Extended SAP AI Core service plan is required. For more details, refer to
    SAP AI Core Service Plans
  7. AI Launchpad Setup Guide
    Step-by-step guide to set up AI Launchpad:
    AI Launchpad Tutorial
  8. Bruno API Client
    Download Bruno from usebruno.com/downloads
  9. SAP RPT-1 Sample Collection
    Clone the official SAP RPT-1 Bruno collection from https://github.com/SAP-samples/aicore-genai-samples/tree/main/genai-sample-apps
  10. Get Service Key
    To obtain your service key:
    • Navigate to your BTP subaccount overview page.
    • Navigate to your BTP service instance page and Click on the SAP AI Core instance to view the service key details.
    • click the service key name to view it, then click Download to save it as creds.json to your local machine.

You Will Learn

  • What SAP RPT-1 is, how it works, and when to use it
  • How to deploy SAP RPT-1 using SAP AI Launchpad, Python SDK, and Bruno
  • How to prepare your dataset and run regression and classification predictions simultaneously in a single API call
  • How to run predictions programmatically using the Python SDK (sap-ai-sdk-gen)
  • How to authenticate, build the request payload, and call the RPT-1 predict endpoint using Bruno REST API

Pre-Read

This tutorial provides a complete, practical guide to using SAP RPT-1 — SAP’s first enterprise relational foundation model — for structured business data prediction.

SAP RPT-1 is a Relational Pretrained Transformer model that delivers accurate predictive insights from structured business data using in-context learning, allowing users to provide data records to generate instant, reliable predictions without any model training.

The concept is straightforward: rather than training a new AI model for every business question, you send your existing data rows directly to the model. Rows with known values teach the model the pattern. Rows where you want a prediction are marked with [PREDICT]. The model fills them in — no pipeline, no training job, no waiting.

Unlike large language models that process text sequences, RPT-1 is designed to detect connections and dependencies across rows and columns using a table-native 2D attention scheme, with optimised processing for the unique semantics and data types found in business data.

RPT-1 supports two prediction task types — and both can be run on the same dataset in a single API call:

  • Classification — predicts a category label and returns a confidence score (0–1) alongside each prediction. Examples: demand category, payment risk tier, sales group assignment.
  • Regression — predicts a continuous numeric value. Examples: days late, forecast units, invoice amount.

SAP RPT-1 is available in three variants:

Variant Access Best For
sap-rpt-1-small SAP Gen AI Hub Prototyping, high-volume, cost-sensitive workloads
sap-rpt-1-large SAP Gen AI Hub Production deployments requiring highest accuracy

Key capabilities at a glance:

Feature What It Means
No model training Send data, get predictions — no pipeline, no wait
Multi-target prediction Up to 10 target columns predicted in one API call
index_column Maps each prediction back to its source row reliably
Missing data resilience Handles nulls and incomplete rows — no imputation needed
Semantic column awareness Descriptive column names improve prediction accuracy
Ephemeral data processing Data is never stored or used to modify model weights

When to use RPT-1:

  • You have structured tabular data and need predictions without a training cycle
  • Your data changes frequently and retraining a traditional model is costly
  • You need multiple columns predicted simultaneously
  • Audit trail and confidence scores matter for your use case

Limitations to be aware of:

  • Exclusively for tabular data — does not process text, images, or audio
  • Maximum 128 prediction rows per API call
  • Classification supports up to 256 classes (sap-rpt-1-small) or 1023 classes (sap-rpt-1-large)
  • Does not produce natural language explanations — pair with an LLM via Orchestration if narrative output is needed

By the end of this tutorial, you will have run your first regression and classification predictions using all four access methods: SAP AI Launchpad, Python SDK, Javascript SDK and Bruno (REST API).

⚠️ Beta notice: The @sap-ai-sdk/rpt package is experimental and subject to change. Do not use in production.

Refer to the SAP RPT-1 documentation for complete API reference information.

  • Step 1

    This tutorial uses a single local CSV file. Two prediction targets are demonstrated simultaneously in one API call.

    You can access the DATASET from the GitHub repository.

    NOTE: If you download the ZIP file, extract it and navigate to the DATA folder. Place the file in your designated location for further use.

    Payment Transaction Dataset — column reference:

    Column Role
    Transaction ID Index column — unique row identifier
    Customer ID, Customer Type, Industry, Region Feature columns
    Currency, Invoice Amount, Due Days, Credit Limit Feature columns
    Outstanding, Credit Usage, Relationship Years Feature columns
    Previous Delays, Avg Days Late, Payment Method Feature columns
    Economic Indicator, Quarter, Contact Attempts Feature columns
    Has Dispute, Dispute Amount Feature columns
    Days Late Regression target — numeric prediction
    Risk Score Classification target — category label + confidence

    Rows where a target column contains [PREDICT] are the prediction rows. All other rows with known values act as context rows that teach the model the pattern.

    Sample rows from the dataset:

    Transaction ID    Customer Type    Industry    Region           Currency    Invoice Amount    Days Late    Risk Score
    TXN AZT67X0T      Small Business   Education   Middle East      USD         30214.02          [PREDICT]    [PREDICT]
    TXN SY4HFYMZ      Individual       Healthcare  Middle East      USD         1045.84           14           Medium
    TXN RWO7A9Z2      Small Business   Education   Europe           GBP         17920.85          10           Low
    TXN C18O8PW7      Small Business   Education   Europe           GBP         12768.45          [PREDICT]    [PREDICT]
    

    Note: Rows with known Days Late and Risk Score values are context rows — the model learns from these. Rows marked [PREDICT] are the prediction rows the model will fill in.

  • Step 2

    This tutorial is accompanied by two Jupyter notebooks that provide a complete, executable version of all prediction steps covered in the Python SDK and JavaScript SDK sections. Download them from the tutorial’s GitHub repository before starting the hands-on sections.

    Notebook SDK Runtime Download
    rpt1_python_sdk.ipynb Python (sap-ai-sdk-gen) Jupyter Download from GitHub
    rpt1_javascript_sdk.ipynb JavaScript (@sap-ai-sdk/rpt) Deno Jupyter Kernel Download from GitHub

    Note: Replace the # placeholders above with the actual GitHub repository links once the notebooks are published. Each notebook follows the same step sequence as the corresponding section in this tutorial — credentials setup, dataset loading, context/prediction row split, model call, result parsing, and CSV export.

  • Step 3

  • Step 4

    This step is run once before using any of the prediction methods. The same payment_transactions.parquet file is shared across Python SDK (advanced), JavaScript SDK, and Bruno — no need to create it separately for each method.

    Run the following Python script from your project folder:

    python
    Copy
    import pandas as pd
    
    # Read Excel
    df = pd.read_excel("payment-delay-data.xlsx")
    
    # Convert problematic columns to string
    df["Days Late"] = df["Days Late"].astype(str)
    df["Risk Score"] = df["Risk Score"].astype(str)
    
    # Save as Parquet
    df.to_parquet("payment_transactions.parquet", index=False)
    
    print("Parquet file generated successfully!")
    

    Requirements: pip install pandas pyarrow openpyxl

    Why Parquet? Parquet preserves column data types natively and is significantly more compact than CSV for large datasets. It is the required format for the /predict_parquet endpoint used by the JavaScript SDK and Bruno.

    Row ordering rule: Context rows must appear before [PREDICT] rows. The script validates this and warns if the ordering is incorrect.


  • Step 5

    With the deployment running and credentials configured, you are now ready to send prediction requests.

  • Step 6

    Regardless of which access method you use, the quality of your context rows directly affects prediction accuracy.

    Practice Why It Matters
    Use the recommended context size for your model variant sap-rpt-1-small accepts up to 2048 context rows and 100 columns — SAP recommends 500–2,000 rows for a balanced trade-off between prediction quality, inference speed, and cost. sap-rpt-1-large accepts up to 65536 context rows and 256 columns — SAP recommends 4,000–8,000 rows for complex enterprise use cases requiring highest accuracy. Both variants support up to 128 simultaneous prediction rows and 10 simultaneous target columns per API call. For further details on model specifications, refer to SAP Help Portal — SAP RPT-1
    Sample randomly for balanced datasets For most cases, random sampling from your labeled data works well
    Use stratified sampling for many-class targets If your classification target has many distinct categories, ensure all classes appear in the context rows
    Use recency-biased sampling for drifting data If your data changes over time, weight sampling toward recent records
    Use descriptive column names The model reads column names as semantic signals — PAYMENT_RISK_LABEL gives more signal than COL_7

  • Step 7
    Error Likely Cause Fix
    401 Unauthorized Token expired or wrong credentials Re-run the OAuth token request; verify clientId and clientSecret
    404 Not Found on predict endpoint Wrong deployment ID or deployment not running Verify deployment status is Running in AI Launchpad; confirm deployment ID
    Low confidence scores (below 0.5) Insufficient or unrepresentative context rows Increase context rows; use stratified sampling for many-class targets
    All rows returning the same prediction All context rows belong to one class Ensure context rows contain examples of all possible target categories
    Regression predictions returning None Unparseable value from model Wrap parsing in try/except; check that context rows contain numeric values in the regression target column

  • Step 8

    You have now covered all four ways to work with SAP RPT-1, from the point-and-click AI Launchpad for deployment management, to the Python SDK,JavaScript SDK and Bruno REST API for full programmatic control.

    What You Did Method
    Deployed the model and obtained a Deployment ID SAP AI Launchpad
    Created configuration and deployment programmatically Python SDK / JavaScript SDK / Bruno
    Prepared shared Parquet file from Excel — used by all methods Python (pandas + pyarrow)
    Loaded Excel and ran regression + classification in one API call Python SDK (sap-ai-sdk-gen)
    Ran predictWithoutSchema(), predictWithSchema(), and predictParquet() JavaScript SDK (@sap-ai-sdk/rpt, Deno)
    Fetched an OAuth token, built the multipart payload, and called the predict endpoint Bruno REST API

    Useful references:

Back to top