Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.

Latest commit

 

History

History
63 lines (46 loc) · 4.11 KB

File metadata and controls

63 lines (46 loc) · 4.11 KB

Use SAP Cloud SDK for AI (Java)

This track introduces attendees to using orchestration capabilities of SAP Generative AI Hub using the SAP Cloud SDK for AI (Java). You can find all mentioned features and some most samples in the SDK documentation portal.

1. Prerequisite

  1. Follow all the instructions as described in the How to Start section.
  2. After receiving the test system access details via email, update the .env, by using the attached file.
AICORE_SERVICE_KEY='{"clientid": "<demo-credentials-file.js.clientid>","clientsecret": "<demo-credentials-file.js.clientsecret>","url": "<demo-credentials-file.js.url>","serviceurls": {"AI_API_URL": "<demo-credentials-file.js.serviceurls.AI_API_URL>"}}'
  1. It is highly recommended to use an IDE like IntelliJ. Open the project that you cloned from the previous step.
  2. Check whether Maven is installed and a modern version of Java (i.e. JRE17+). Your installed IDE (e.g. IntelliJ) may already provide the relevant tools for you.

2. Project Structure

The project used for this session is a neat Spring Boot-based web application.

2.1 Dependencies

The necessary dependencies for the exercises are specified in the pom.xml. Additional dependencies or plugins are not required for the exercises. However, you are free to add any dependencies or plugins you find useful.

The SAP Cloud SDK for AI uses the group-id com.sap.ai.sdk, e.g., com.sap.ai.sdk:orchestration, for orchestration service consumption.

2.2 Related Source Code

  • The Application class defines the application root, including application based annotations. You can execute the main() method from here to start the application easily.

  • The OrchestrationController class contains all relevant endpoint definitions and their implementation details. Here we'll write the code for calling the orchestration service using the client libraries provided by the SAP Cloud SDK. You will mainly work with this file during your exercises.

Note

Most endpoints will not return meaningful responses until the exercises are completed.

Tip

While the method stubs are provided, the implementation is left to you. The exercises give hints and solution to approach the target implementation, but you are encouraged to just try out. See how the IDE guides you, what methods and options are available. Maybe you can figure out the solution by yourself. This approach will allow you to experience the full developer workflow, including useful features like auto-completion and debugging. By typing the code, you’ll better understand the logic, discover useful functions, and build muscle memory, all of which contribute to a deeper learning experience.

Exercises

The exercises demonstrate how to use the SAP generative AI hub SDK to interact with the orchestration service, enabling you to build AI-driven workflows by combining multiple modules such as templating, large language models (LLM), and content filtering.

Start from here.

Troubleshooting

If you encounter errors, please look closely at the exceptions and stacktraces.

For detailed HTTP context, you can enable the debug logging for different packages in the src/main/resources/application.properties file. Use DEBUG instead of WARN to extract verbose logs.