Frequently Asked Questions
How to add a custom header to AI Core requests?
SAP AI SDK leverages the destination concept from the SAP Cloud SDK to manage the connection to AI Core. This opens up a wide range of possibilities to customize the connection, including adding custom headers. The following shows how to add custom headers to all requests sent to AI Core.
var service = new AiCoreService();
var destination =
DefaultHttpDestination.fromDestination(service.getBaseDestination())
.header("my-header-key", "my-header-value")
.build();
// AI Core client
service = service.withBaseDestination(destination);
DeploymentApi client = new DeploymentApi(service);
For more information, please refer to the AI Core connectivity guide and the SAP Cloud SDK documentation.
There is also a convenient method to add custom headers to single calls through the orchestration or OpenAI client.
var client = new OrchestrationClient();
var result = client.withHeader("my-header-key", "my-header-value").chatCompletion(prompt, config);
For more information on this feature, see the respective documentation of the OrchestrationClient and OpenAIClient.
Can I apply a minor version update for the SAP Cloud SDK for AI dependency?
Yes, we recommend updating to the latest version of the SAP Cloud SDK for AI. The SAP Cloud SDK for AI follows semantic versioning so minor version updates should generally be safe and backward-compatible. However, there are some exceptional cases where API changes may occur:
Internal Classes
Internal classes are intended for use only within the SAP Cloud SDK for AI itself. Their API signatures may change without notice and are not guaranteed to be stable.
Generated Classes
The following clients are primarily generated by the SAP Cloud SDK Generator. Their API signatures may change, for example, due to updates in the underlying specifications:
There's a vulnerability warning CVE-2021-41251
?
This is a known false-positive finding. Depending on the tooling any product called "SAP Cloud SDK for AI" or similar with a low version number may be marked as vulnerable, incorrectly. Please consider suppressing the warning, as we do.
Are there any example projects?
Explore example applications and code snippets: