All skills
secondsky avatar

/sap-ai-core

@620a19a
by Eddiesecondsky/sap-skills456 stars
120

Guides development with SAP AI Core and SAP AI Launchpad for enterprise AI/ML workloads on SAP BTP. Use when: deploying generative AI models, building orchestration workflows with templating/filtering/grounding, implementing RAG with vector databases, managing ML training pipelines with Argo Workflows, configuring content filtering and data masking for PII protection, using the Generative AI Hub for prompt experimentation, managing prompt templates via the Prompt Registry, or integrating AI capabilities into SAP applications. Covers service plans (Free/Standard/Extended), model providers (Azure OpenAI, AWS Bedrock, GCP Vertex AI, Mistral, IBM, Perplexity), orchestration modules, embeddings, tool calling, and structured outputs.

Use this Skill: https://skilld.dev/gh/secondsky/sap-skills/sap-ai-core

This session only. Nothing lands on disk.

referencesorchestration-modules.md

≈3.8k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Orchestration Modules Reference

Complete reference for all SAP AI Core orchestration modules.

Documentation Source: https://github.com/SAP-docs/sap-artificial-intelligence/tree/main/docs/sap-ai-core


Orchestration V2 API

Endpoint

V2 Endpoint: POST {{deployment_url}}/v2/completion

V1 to V2 Migration

If migrating from V1 to V2:

  1. Update endpoint from /completion to /v2/completion
  2. Modify payload structure to use config.modules format
  3. Test with existing orchestration configurations

V2 Request Structure

{
  "config": {
    "modules": {
      "prompt_templating": { /* template config */ },
      "llm": { /* model config */ },
      "grounding": { /* optional */ },
      "filtering": { /* optional */ },
      "masking": { /* optional */ },
      "translation": { /* optional */ }
    }
  },
  "placeholder_values": {
    "variable_name": "value"
  }
}

Key V2 Changes

Aspect V1 V2
Endpoint /completion /v2/completion
Module structure module_configurations config.modules
Embeddings Not available POST /v2/embeddings

V2 Module Naming

In the V2 API, modules use short keys within config.modules:

Module V1 Key V2 Key Required
Templating templating_module_config prompt_templating Yes
Model llm_module_config (included in llm) Yes
Grounding grounding_module_config grounding No
Filtering filtering_module_config filtering No
Masking masking_module_config masking No
Translation translation_module_config translation No

V2 Output with Citations

For Perplexity Sonar and Sonar Pro models, the V2 orchestration response includes a citations section with source URLs. This is the only model family that supports citations output.


Module Execution Order

The orchestration pipeline executes modules in this fixed order:

1. Grounding → 2. Templating → 3. Input Translation → 4. Data Masking →
5. Input Filtering → 6. Model Configuration → 7. Output Filtering → 8. Output Translation

Only Templating and Model Configuration are mandatory.


1. Templating Module (Mandatory)

Compose prompts with placeholders that get populated during inference.

Configuration

{
  "templating_module_config": {
    "template": [
      {"role": "system", "content": "You are {{?assistant_type}}"},
      {"role": "user", "content": "{{?user_message}}"}
    ],
    "defaults": {
      "assistant_type": "a helpful assistant"
    }
  }
}

Placeholder Syntax

Syntax Description
{{?variable}} Required placeholder (must be provided)
{{?variable}} with defaults Optional if default provided
{{$grounding_output}} System variable from grounding module

Message Roles

  • system: System instructions
  • user: User input
  • assistant: Assistant responses (for multi-turn)
  • tool: Tool call results

2. Model Configuration Module (Mandatory)

Configure the LLM parameters.

Configuration

{
  "llm_module_config": {
    "model_name": "gpt-4o",
    "model_version": "latest",
    "model_params": {
      "max_tokens": 2000,
      "temperature": 0.7,
      "top_p": 0.95,
      "frequency_penalty": 0,
      "presence_penalty": 0,
      "stop": ["\n\n"]
    }
  }
}

Common Parameters

Parameter Type Description Range
max_tokens int Maximum response tokens 1-4096+
temperature float Randomness 0.0-2.0
top_p float Nucleus sampling 0.0-1.0
frequency_penalty float Repetition penalty -2.0 to 2.0
presence_penalty float Topic diversity -2.0 to 2.0
stop array Stop sequences Up to 4

Model Version Options

  • "latest": Auto-upgrade to newest version
  • Specific version: e.g., "2024-05-13" for pinned version

3. Content Filtering Module

Filter harmful content in input and output.

Azure Content Safety Configuration

{
  "filtering_module_config": {
    "input": {
      "filters": [
        {
          "type": "azure_content_safety",
          "config": {
            "Hate": 2,
            "Violence": 2,
            "Sexual": 2,
            "SelfHarm": 2
          }
        }
      ]
    },
    "output": {
      "filters": [
        {
          "type": "azure_content_safety",
          "config": {
            "Hate": 0,
            "Violence": 0,
            "Sexual": 0,
            "SelfHarm": 0
          }
        }
      ]
    }
  }
}

Azure Content Safety Categories

Category Description Severity Levels
Hate Discriminatory, hateful content 0, 2, 4, 6
Violence Violent content and threats 0, 2, 4, 6
Sexual Sexual content 0, 2, 4, 6
SelfHarm Self-harm promotion 0, 2, 4, 6

Severity Scale:

  • 0: Safe
  • 2: Low severity
  • 4: Medium severity (blocked by Azure global filter)
  • 6: High severity (blocked by Azure global filter)

PromptShield Configuration

Detect prompt injection attacks:

{
  "filtering_module_config": {
    "input": {
      "filters": [
        {
          "type": "azure_content_safety",
          "config": {
            "PromptShield": true
          }
        }
      ]
    }
  }
}

Llama Guard 3 Configuration

{
  "filtering_module_config": {
    "input": {
      "filters": [
        {
          "type": "llama_guard_3",
          "config": {
            "categories": [
              "violent_crimes",
              "hate",
              "sexual_content",
              "self_harm"
            ]
          }
        }
      ]
    }
  }
}

Llama Guard 3 Categories (14)

Category Description
violent_crimes Violence and violent crimes
non_violent_crimes Non-violent criminal activities
sex_crimes Sexual crimes
child_exploitation Child sexual abuse material
defamation Defamation and libel
specialized_advice Unqualified professional advice
privacy Privacy violations
intellectual_property IP infringement
indiscriminate_weapons Weapons of mass destruction
hate Hate speech
self_harm Self-harm content
sexual_content Explicit sexual content
elections Election interference
code_interpreter_abuse Malicious code execution

4. Data Masking Module

Anonymize or pseudonymize PII before sending to LLM.

Pseudonymization Configuration

{
  "masking_module_config": {
    "masking_providers": [
      {
        "type": "sap_data_privacy_integration",
        "method": "pseudonymization",
        "entities": [
          {"type": "profile-person"},
          {"type": "profile-email"},
          {"type": "profile-phone"},
          {"type": "profile-credit-card-number"}
        ]
      }
    ]
  }
}

Anonymization Configuration

{
  "masking_module_config": {
    "masking_providers": [
      {
        "type": "sap_data_privacy_integration",
        "method": "anonymization",
        "entities": [
          {"type": "profile-person"},
          {"type": "profile-ssn"}
        ]
      }
    ]
  }
}

Complete Entity Type Reference (25)

Personal Identifiers:

Entity Type Coverage Description
profile-person English Person names
profile-email Global Email addresses
profile-phone International Phone numbers with country codes
profile-address US Physical addresses
profile-url Global User-accessible URLs
profile-username-password Global Credentials via keywords

Organizations:

Entity Type Coverage Description
profile-org Global SAP customers + Fortune 1000
profile-university Global Public universities
profile-location US US locations

Government/Financial IDs:

Entity Type Coverage Description
profile-nationalid 20+ countries National ID numbers
profile-ssn US, Canada Social Security Numbers
profile-passport 30+ countries Passport numbers
profile-driverlicense 30+ countries Driver's license numbers
profile-iban 70+ countries Bank account numbers
profile-credit-card-number Global Credit card numbers

SAP-Specific:

Entity Type Coverage Description
profile-sapids-internal SAP Staff IDs (C/I/D + 6-8 digits)
profile-sapids-public SAP S-user (S + 6-11 digits), P-user (P + 10 digits)

Sensitive Attributes:

Entity Type Coverage Description
profile-nationality 190+ countries Country names and codes
profile-religious-group 200+ groups Religious affiliations
profile-political-group 100+ parties Political affiliations
profile-pronouns-gender Global Gender pronouns
profile-gender Global Gender identifiers
profile-sexual-orientation Global Sexual orientation
profile-trade-union Global Trade union membership
profile-ethnicity Global Ethnic identifiers
profile-sensitive-data Global Composite of sensitive attributes

Custom Entity with Regex

{
  "masking_module_config": {
    "masking_providers": [
      {
        "type": "sap_data_privacy_integration",
        "method": "pseudonymization",
        "entities": [
          {
            "type": "custom",
            "pattern": "EMP-[0-9]{6}",
            "replacement": "EMPLOYEE_ID"
          }
        ]
      }
    ]
  }
}

5. Grounding Module

Inject external context from vector databases (RAG).

Basic Grounding Configuration

{
  "grounding_module_config": {
    "grounding_service": "document_grounding_service",
    "grounding_service_configuration": {
      "grounding_input_parameters": ["user_query"],
      "grounding_output_parameter": "context",
      "filters": [
        {
          "id": "<pipeline-id>",
          "search_configuration": {
            "max_chunk_count": 5
          }
        }
      ]
    }
  }
}

Grounding with Metadata Filters

{
  "grounding_module_config": {
    "grounding_service": "document_grounding_service",
    "grounding_service_configuration": {
      "grounding_input_parameters": ["user_query"],
      "grounding_output_parameter": "context",
      "filters": [
        {
          "id": "<pipeline-id>",
          "data_repositories": ["<repo-id>"],
          "document_metadata": [
            {
              "key": "department",
              "value": "HR"
            }
          ],
          "search_configuration": {
            "max_chunk_count": 10,
            "max_document_count": 5
          }
        }
      ]
    }
  }
}

Using Grounding Output in Template

{
  "templating_module_config": {
    "template": [
      {
        "role": "system",
        "content": "Answer questions using only the following context:\n\n{{$context}}"
      },
      {
        "role": "user",
        "content": "{{?user_query}}"
      }
    ]
  }
}

6. Translation Module

Translate input and output between languages.

Input Translation Configuration

{
  "translation_module_config": {
    "input": {
      "source_language": "auto",
      "target_language": "en"
    }
  }
}

Output Translation Configuration

{
  "translation_module_config": {
    "output": {
      "source_language": "en",
      "target_language": "{{?user_language}}"
    }
  }
}

Combined Translation

{
  "translation_module_config": {
    "input": {
      "source_language": "auto",
      "target_language": "en"
    },
    "output": {
      "source_language": "en",
      "target_language": "auto"
    }
  }
}

Complete Orchestration Example

All modules combined:

{
  "config": {
    "module_configurations": {
      "grounding_module_config": {
        "grounding_service": "document_grounding_service",
        "grounding_service_configuration": {
          "grounding_input_parameters": ["user_query"],
          "grounding_output_parameter": "context",
          "filters": [{"id": "<pipeline-id>"}]
        }
      },
      "templating_module_config": {
        "template": [
          {"role": "system", "content": "You are a helpful assistant. Use this context:\n{{$context}}"},
          {"role": "user", "content": "{{?user_query}}"}
        ]
      },
      "translation_module_config": {
        "input": {"source_language": "auto", "target_language": "en"},
        "output": {"source_language": "en", "target_language": "auto"}
      },
      "masking_module_config": {
        "masking_providers": [{
          "type": "sap_data_privacy_integration",
          "method": "pseudonymization",
          "entities": [
            {"type": "profile-person"},
            {"type": "profile-email"}
          ]
        }]
      },
      "filtering_module_config": {
        "input": {
          "filters": [{
            "type": "azure_content_safety",
            "config": {"Hate": 2, "Violence": 2, "Sexual": 2, "SelfHarm": 2}
          }]
        },
        "output": {
          "filters": [{
            "type": "azure_content_safety",
            "config": {"Hate": 0, "Violence": 0, "Sexual": 0, "SelfHarm": 0}
          }]
        }
      },
      "llm_module_config": {
        "model_name": "gpt-4o",
        "model_version": "latest",
        "model_params": {
          "max_tokens": 2000,
          "temperature": 0.5
        }
      }
    }
  },
  "input_params": {
    "user_query": "What are the company's vacation policies?"
  }
}

Documentation Links

Source: SKILL.md on GitHub

1 alert16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides a comprehensive documentation suite and template library for developing with SAP AI Core and SAP AI Launchpad on the SAP Business Technology Platform (BTP). It includes detailed guidance on model orchestration, RAG (Retrieval-Augmented Generation), and ML training pipelines. The skill emphasizes security best practices, including content filtering and data masking, and no malicious patterns were identified.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    9/14 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 620a19a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 months ago
Other metadata
metadata
{
  "maintainer": "Eduard Jiglau",
  "maintainer_email": "hello@sap-ai-skills.com",
  "website": "https://sap-ai-skills.com",
  "version": "2.4.1",
  "last_verified": "2026-06-12",
  "production_tested": "No; documentation-audited only, no live tenant/runtime evidence",
  "runtime_verification": "pending tenant evidence"
}

README badge

README badge for secondsky/sap-skills/sap-ai-core