Identifying the Need for Using SAP Cloud Software Development Kits for AI

Objective

After completing this lesson, you will be able to describe SAP Cloud SDK for AI and its role in integrating Large Language Models into enterprise applications.

You learned how to create prompts in SAP AI Launchpad to extract key data like urgency, sentiment, and categories from customer communications in a structured JSON format.

While the SAP AI Launchpad is good for interactive prompt development and testing, to move these solutions into production and integrate them seamlessly into your business applications, you need a robust programmatic interface.

This is where Software Development Kits (SDKs) become indispensable. This lesson will explain SDKs and why they are important for integrating LLMs into enterprise-grade applications. You will learn about SAP Cloud SDK for AI, which is the official toolkit for building powerful generative AI solutions within the SAP ecosystem, leveraging SAP AI Core, the generative AI hub, and Orchestration Service.

Role of SDKs in LLM integration

An SDK is a comprehensive collection of tools, libraries, and documentation designed to help developers create software applications for specific platforms or frameworks. For LLMs, SDKs typically wrap Application Programming Interfaces (APIs) in programming language specific functions adding convenience layers on top of APIs.

This simplifies the process of building and integrating your own applications with an LLM service.

Let’s revisit our business problem to know how using SDK can help in solving such problems.

The Facility Solutions company faces high volumes of customer communication (emails, messages), which require efficient processing and prioritization within their internal applications to ensure timely and accurate responses. You developed prompts in the generative AI hub in SAP AI Launchpad to extract key information like urgency, sentiment, and categories.

However, the ultimate business need is to streamline this process to handle large-scale queries automatically and integrate these outputs into operational applications. To achieve this, your applications need a way to programmatically send these customer messages to the LLM (via the generative AI hub) and receive the structured JSON output. SDKs enable this precisely.

Key Advantages of Using SDKs for LLM Integration

For developers integrating LLMs into enterprise applications, SDKs offer clear, tangible value:

  • Accelerated Development: SDKs provide prebuilt tools, libraries, and APIs that abstract away complex low-level details. This simplifies the development workflow, allowing you to focus on your application’s business logic instead of writing boilerplate code for HTTP requests, managing authentication, or handling direct API intricacies.
  • Seamless Integration & Efficiency: SDKs facilitate quicker and easier integration of LLMs into your existing applications. By handling the complexities of model interaction, they help you concentrate on delivering solutions faster.
  • Programmatic Access to Platform Features: SDKs offer programmatic control over advanced platform capabilities, like those in the generative AI hub. This means you can programmatically manage prompts, integrate grounding data, and utilize features like data masking and content filtering directly within your code, tailoring LLM behavior precisely to your use case.

In essence, SDKs help simplify LLM access, boost development efficiency, and support deep customization, and optimize LLM performance for enterprise solutions.

SAP Cloud SDK for AI

The SAP Cloud SDK for AI provides the necessary abstractions and tools to interact seamlessly with SAP AI Core, the generative AI hub, and the Orchestration Service. This SDK is available in multiple programming languages to support diverse development environments.

These SDKs integrate chat completion, leverage generative AI hub features (templating, grounding, data masking, content filtering), and set up/manage your SAP AI Core instance programmatically.

SAP Cloud SDK for AI (JavaScript):

The official SDK for integrating with SAP AI Core, Generative AI Hub, and Orchestration using JavaScript.

Refer to official ​ Documentation, and NPM listings.

SAP Cloud SDK for AI (Java):

The official SDK for integrating with SAP AI Core, Generative AI Hub, and Orchestration using Java.

Refer to official GitHub Repository, Documentation, and Maven listings.

SAP Cloud SDK for AI (Python):

Purpose: The official SDK for integrating with SAP AI Core, Generative AI Hub, and Orchestration using Python. This SDK is composed of three distinct Python distributions:

  • sap-ai-sdk-base: Use this to access the core AI API using Python methods and data structures, providing a fundamental layer of interaction.
  • sap-ai-sdk-core: Enables interaction with SAP AI Core for administration and public lifecycle management, offering control over your AI deployments and resources.
  • sap-ai-sdk-gen: Specifically designed for Generative AI capabilities. Use this to integrate native SDK libraries and LangChain for accessing models on the Generative AI Hub in SAP AI Core, and to leverage the full power of the Orchestration Service (templating, grounding, data masking, content filtering).

Refer to official Pypi Base, Pypi Core, and Pypi Gen.

This course will explain next steps using SAP Cloud SDK for AI (Python). View more information: SAP Cloud SDK for AI (JavaScript) code in the repository.

Getting Started with SAP Cloud SDK for AI (Python)

With the Python SDK, you can programmatically interact with LLMs deployed via the generative AI hub to create natural language completions, chat responses, and embedded elements directly from your Python applications.

  • Prerequisites: It's recommended that you use python kernel 3.11.9 and above to execute all codes in this learning journey. You may refer to python guide here. In case of any errors, ensure that you have properly deployed, configured, and provisioned generative AI hub in SAP BTP.
  • Installation: You can install the Python SDK using the following pip command:
    Python
    123
    pip install "sap-ai-sdk-gen[all]"

    Note

    The [all] extra includes additional packages like langchain, which is not installed by default but is often useful for advanced LLM integrations.
  • Configuration: The SDK reuses configuration settings from the AI Core SDK. These include your client ID, client secret, authentication URL, base URL, and resource group. You can set these values as environment variables or, more conveniently, via a configuration file.

We suggest setting these values for your AI Core credentials via a configuration file. The default path for this file is ~/.aicore/config.json for Mac/Linux. For Windows, it’s typically C:\Users\<current user>\.aicore\config.json. You will obtain these values from your AI Core service key downloaded from BTP.

Configuration Steps (Example for Mac):

  1. Create .aicore folder: If it doesn’t exist, create it using your terminal:
    Code Snippet
    123
    mkdir ~/.aicore/
  2. Edit config.json: Open the file using a text editor (e.g., nano in the terminal or VS Code):
    Code Snippet
    123
    nano ~/.aicore/config.json
  3. Paste JSON content: Replace the placeholder values with your actual AI Core Service Key credentials:
    Python
    12345678
    { "AICORE_AUTH_URL": "https://***.authentication.sap.hana.ondemand.com", "AICORE_CLIENT_ID": "***", "AICORE_CLIENT_SECRET": "***", "AICORE_RESOURCE_GROUP": "***", "AICORE_BASE_URL": "https://api.ai.***.cfapps.sap.hana.ondemand.com/v2" }

Alternatively, you can refer to the https://github.com/SAP-samples/ai-core-samples/blob/main/10_Learning_Journeys/README.md file for detailed configuration steps to execute the notebook for this learning journey in your system.

Usage Examples:

OpenAI-like API Completion: This code snippet demonstrates generating a text completion using a model (e.g., gpt-5-nano ) with an OpenAI-compatible API interface.

Python
12345678910
from gen_ai_hub.proxy.native.openai import completions response = completions.create( model_name="gpt-5-nano ", prompt="The Answer to the Ultimate Question of Life, the Universe, and Everything is", max_tokens=7, temperature=0 ) print(response)

This Python code generates a completion for the given prompt. It asks for a short response about the answer to the ultimate question of life and sets parameters for response length and randomness. It then prints the generated completion.

Chat Completion: This example shows how to simulate a multi-turn chat conversation, leveraging the system, user, and assistant roles.

Python
1234567891011121314
from gen_ai_hub.proxy.native.openai import chat messages = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Does Azure OpenAI support customer managed keys?"}, {"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."}, {"role": "user", "content": "Do other Azure Cognitive Services support this too?"} ] kwargs = dict(model_name='gpt-5-nano ', messages=messages) response = chat.completions.create(**kwargs) print(response)

This code interacts with an LLM (e.g., gpt-5-nano) to simulate a chat conversation. By loading predefined messages structured with system, user, and assistant roles into the messages list and specifying model details, it sends these inputs to the API to generate a response. This allows seamless integration for querying and getting automated replies within your application.

Lesson Summary

You now understand the role of SDKs in programmatically integrating LLMs into your enterprise applications. You’ve learned how SDKs streamline development, enhance efficiency, and provide programmatic access to advanced features of the generative AI hub. Specifically, you’ve been introduced to the SAP Cloud SDK for AI (Python), including its installation, configuration via the config.json file, and basic usage examples for generating completions and managing chat interactions. This foundational knowledge empowers you to move beyond interactive prototyping and begin building scalable, reliable, and secure Generative AI solutions within your SAP business applications using the language of your choice.