plugins/sap-cloud-sdk-ai/skills/sap-cloud-sdk-ai/SKILL.md
Integrates SAP Cloud SDK for AI into JavaScript/TypeScript and Java applications. Use when building applications with SAP AI Core, Generative AI Hub, or Orchestration Service. Covers chat completion, embedding, streaming, function calling, content filtering, data masking, document grounding, prompt registry, and LangChain/Spring AI integration. Supports OpenAI GPT-4o, Llama, Gemini, Amazon Nova, and other foundation models via SAP BTP.
npx skillsauth add secondsky/sap-skills sap-cloud-sdk-aiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The official SDK for SAP AI Core, SAP Generative AI Hub, and Orchestration Service.
Use this skill when:
Note: This skill uses SAP Cloud SDK for AI JavaScript v2.11.0+ and Java v1.19.0+. If you're migrating from v1.x, see V1 to V2 Migration Guide for breaking changes.
npm install @sap-ai-sdk/orchestration@^2
import { OrchestrationClient } from '@sap-ai-sdk/orchestration';
const client = new OrchestrationClient({
promptTemplating: {
model: { name: 'gpt-4o' },
prompt: [{ role: 'user', content: '{{?question}}' }]
}
});
const response = await client.chatCompletion({
placeholderValues: { question: 'What is SAP?' }
});
console.log(response.getContent());
<dependency>
<groupId>com.sap.ai.sdk</groupId>
<artifactId>orchestration</artifactId>
<version>${ai-sdk.version}</version>
</dependency>
var client = new OrchestrationClient();
var config = new OrchestrationModuleConfig()
.withLlmConfig(OrchestrationAiModel.GPT_4O);
var prompt = new OrchestrationPrompt("What is SAP?");
var result = client.chatCompletion(prompt, config);
System.out.println(result.getContent());
Bind AI Core service instance to your application. SDK auto-detects via VCAP_SERVICES or mounted secrets.
Set environment variable:
export AICORE_SERVICE_KEY='{"clientid":"...","clientsecret":"...","url":"...","serviceurls":{"AI_API_URL":"..."}}'
Or use CAP hybrid mode:
# JavaScript
cds bind -2 <AICORE_INSTANCE> && cds-tsx watch --profile hybrid
# Java
cds bind --to aicore --exec mvn spring-boot:run
For detailed connection options, see references/connecting-to-ai-core.md
| Package | Purpose |
|---------|---------|
| @sap-ai-sdk/orchestration | Chat completion, filtering, grounding |
| @sap-ai-sdk/foundation-models | Direct model access (OpenAI) |
| @sap-ai-sdk/langchain | LangChain integration |
| @sap-ai-sdk/ai-api | Deployments, artifacts, configurations |
| @sap-ai-sdk/document-grounding | Pipeline, Vector, Retrieval APIs |
| @sap-ai-sdk/prompt-registry | Prompt template management |
| Artifact | Purpose |
|----------|---------|
| orchestration | Chat completion, filtering, grounding |
| openai (foundationmodels) | Direct OpenAI model access |
| core | Base connectivity |
| document-grounding | Pipeline, Vector, Retrieval APIs |
| prompt-registry | Prompt template management |
| Deprecated | Use Instead | |------------|-------------| | text-embedding-ada-002 | text-embedding-3-small/large | | gpt-35-turbo (all variants) | gpt-4o-mini | | gpt-4-32k | gpt-4o | | gpt-4 (base) | gpt-4o or gpt-4.1 | | gemini-1.0-pro | gemini-2.0-flash | | gemini-1.5-pro/flash | gemini-2.5-flash | | mistralai--mixtral-8x7b | mistralai--mistral-small-instruct |
// JavaScript
const stream = client.stream({
placeholderValues: { question: 'Explain SAP CAP' }
});
for await (const chunk of stream.toContentStream()) {
process.stdout.write(chunk);
}
// Java
client.streamChatCompletion(prompt, config)
.forEach(chunk -> System.out.print(chunk.getDeltaContent()));
// JavaScript
const tools = [{
type: 'function',
function: {
name: 'get_weather',
parameters: { type: 'object', properties: { city: { type: 'string' } } }
}
}];
const response = await client.chatCompletion({
placeholderValues: { question: 'Weather in Berlin?' }
}, { tools });
const toolCalls = response.getToolCalls();
// JavaScript
import { buildAzureContentSafetyFilter } from '@sap-ai-sdk/orchestration';
const client = new OrchestrationClient({
promptTemplating: { model: { name: 'gpt-4o' } },
filtering: {
input: buildAzureContentSafetyFilter({ Hate: 'ALLOW_SAFE' }),
output: buildAzureContentSafetyFilter({ Violence: 'ALLOW_SAFE' })
}
});
// JavaScript
const client = new OrchestrationClient({
promptTemplating: { model: { name: 'gpt-4o' } },
masking: {
masking_providers: [{
type: 'sap_data_privacy_integration',
method: 'anonymization',
entities: [{ type: 'profile-email' }, { type: 'profile-person' }]
}]
}
});
// JavaScript
const client = new OrchestrationClient({
promptTemplating: { model: { name: 'gpt-4o' } },
grounding: {
grounding_input: ['{{?question}}'],
grounding_output: ['{{?context}}'],
data_repositories: [{ type: 'vector', id: 'my-repo-id' }]
}
});
JavaScript SDK provides helper methods:
const response = await client.chatCompletion({ placeholderValues });
response.getContent(); // Model output string
response.getTokenUsage(); // { prompt_tokens, completion_tokens, total_tokens }
response.getFinishReason(); // 'stop', 'length', 'tool_calls', etc.
response.getToolCalls(); // Array of function calls
response.getDeltaToolCalls(); // Partial tool calls (streaming)
response.getAllMessages(); // Full message history
response.getAssistantMessage(); // Assistant response only
response.getRefusal(); // Refusal message if blocked
Streaming response methods:
const stream = client.stream({ placeholderValues });
for await (const chunk of stream.toContentStream()) {
process.stdout.write(chunk);
}
// After stream ends:
stream.getFinishReason();
stream.getTokenUsage();
For detailed guidance:
references/orchestration-guide.mdreferences/foundation-models-guide.mdreferences/langchain-guide.mdreferences/spring-ai-guide.mdreferences/ai-core-api-guide.mdreferences/foundation-models-guide.md - Foundation models and pricingreferences/ai-core-api-guide.md - AI Core service API referencereferences/orchestration-guide.md - Orchestration service guidereferences/langchain-guide.md - LangChain.js integrationreferences/spring-ai-guide.md - Spring AI integrationreferences/agentic-workflows.md - Agentic workflow patternsreferences/connecting-to-ai-core.md - Connection setup guidereferences/error-handling.md - Error handling patternsreferences/v1-to-v2-migration.md - V1 to V2 migration guide| SDK | Current Version | Node/Java Requirement | |-----|-----------------|----------------------| | JavaScript | 2.11.0+ | Node.js 20+ | | Java | 1.19.0+ | Java 17+ (21 LTS recommended) |
Note: Generated model classes (in ...model packages) may change in minor releases but are safe to use.
| Error | Cause | Solution | |-------|-------|----------| | "Could not find service bindings for 'aicore'" | Missing AI Core binding | Bind AI Core service or set AICORE_SERVICE_KEY | | "Orchestration deployment not found" | No deployment in resource group | Deploy orchestration in AI Core or use different resource group | | Content filter violation | Input/output blocked | Adjust filter thresholds or modify content | | Token limit exceeded | Response too long | Set max_tokens parameter |
Keep this skill updated using these sources:
tools
SAP HANA Machine Learning Python Client (hana-ml) development skill. Use when: Building ML solutions with SAP HANA's in-database machine learning using Python hana-ml library for PAL/APL algorithms, DataFrame operations, AutoML, model persistence, and visualization. Keywords: hana-ml, SAP HANA, machine learning, PAL, APL, predictive analytics, HANA DataFrame, ConnectionContext, classification, regression, clustering, time series, ARIMA, gradient boosting, AutoML, SHAP, model storage
development
Develops data processing pipelines, integrations, and machine learning scenarios in SAP Data Intelligence Cloud. Use when building graphs/pipelines with operators, integrating ABAP/S4HANA systems, creating replication flows, developing ML scenarios with JupyterLab, or using Data Transformation Language functions. Covers Gen1/Gen2 operators, subengines (Python, Node.js, C++), structured data operators, and repository objects.
tools
Assists with SAP HANA Developer CLI (hana-cli) for database development and administration. Use when: installing hana-cli, connecting to SAP HANA databases, inspecting database objects (tables, views, procedures, functions), managing HDI containers, executing SQL queries, converting metadata to CDS/EDMX/OpenAPI formats, managing SAP HANA Cloud instances, working with BTP CLI integration, or troubleshooting hana-cli commands. Covers: 91 commands, 17+ output formats, HDI container management, cloud operations.
tools
Develops SAP Fiori applications using SAP Fiori tools extensions for VS Code and SAP Business Application Studio. Use when: generating Fiori Elements or Freestyle SAPUI5 applications, configuring Page Editor for List Report or Object Page, working with annotations and Service Modeler, setting up deployment to ABAP or Cloud Foundry, creating adaptation projects, using Guided Development, previewing with mock data or live data, configuring SAP Fiori launchpad, or using AI-powered generation with Project Accelerator/Joule. Technologies: SAP Fiori Elements, SAPUI5, OData V2/V4, CAP, SAP BTP, ABAP, Cloud Foundry, fiori-mcp-server (MCP tools for AI-assisted generation).