SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Prompt Optimization with Tool Calling

This tutorial demonstrates how to use Prompt Optimization in SAP AI Core for tool calling scenarios using a BFCL v3 dataset. The process loads and normalizes a BFCL v3 parallel-multiple dataset, splits it into train and test sets, uploads all files to AI Core's built-in dataset storage, registers a dataset artifact, pushes a base prompt template to the Prompt Registry, and runs an optimization execution targeting Gemini 2.5 Pro with GPT-4o as the reference model using the `JSON_Match` metric. After completion, the optimized prompt is retrieved from the registry and compared against the base prompt through live inference via the Orchestration Service.

Overview

🎓 beginner 45 min. SAP Ai CoreBeginnerArtificial IntelligenceMachine Learning

You will learn

  • How to load and normalize BFCL v3 parallel-multiple data into the SAP optimizer golden format.
  • How to upload train, test, tools, and prompt template files to AI Core dataset storage.
  • How to register a dataset artifact linking the uploaded folder to the genai-optimizations scenario.
  • How to create and register a base prompt template in the Prompt Registry.
  • How to configure and run prompt optimization via Python SDK and Bruno.
  • How to monitor execution progress and retrieve the optimized prompt.
  • How to compare base vs optimized prompt outputs through live inference via the Orchestration Service.
Smita Naik S Smita Naik July 29, 2026
Created by July 29, 2026
Contributors

Prerequisites

Prerequisites

  1. BTP Account
    Set up your SAP Business Technology Platform (BTP) account.
    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:
    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, as the Generative AI Hub is not available in the Free or Standard tiers. For more details, refer to
    SAP AI Core Service Plans
  7. You have access to the genai-optimizations scenario and have the required roles such as mloperations_editor or genai_manager.
  8. A BFCL v3 dataset file (e.g., BFCL_v3_parallel_multiple_10tools.json) is available locally.

Steps

Step 1 Pre-Read

Before starting this tutorial, ensure that you:

  • Understand the basics of Generative AI workflows in SAP AI Core.
  • Are familiar with function calling / tool calling concepts in LLMs.
  • Are familiar with creating and managing prompt templates and artifacts in SAP AI Core.
  • Have completed the Quick Start tutorial or equivalent setup for SAP AI Core access.
Step 2 Architecture Overview
+
Step 3 Notebook Reference
+
Step 4 Environment Variables Setup
+
Step 5 Configure Optimization Parameters
+
Step 6 Load and Normalize the BFCL v3 Dataset
+
Step 7 Upload Dataset Files to AI Core Storage
+
Step 8 Register Dataset Artifact
+
Step 9 Create and Register the Base Prompt Template
+
Step 10 Register an Optimization Configuration
+
Step 11 Run the Prompt Optimization Execution
+
Step 12 Monitor and View Optimization Progress
+
Step 13 Review Optimization Results
+
Step 14 Compare Base vs Optimized Prompt via Orchestration Service
+
Step 15 Summary
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 15
1. Pre-Read 2. Architecture Overview 3. Notebook Reference 4. Environment Variables Setup 5. Configure Optimization Parameters 6. Load and Normalize the BFCL v3 Dataset 7. Upload Dataset Files to AI Core Storage 8. Register Dataset Artifact 9. Create and Register the Base Prompt Template 10. Register an Optimization Configuration 11. Run the Prompt Optimization Execution 12. Monitor and View Optimization Progress 13. Review Optimization Results 14. Compare Base vs Optimized Prompt via Orchestration Service 15. Summary

Learn more →