Repository navigation
v0.32.0 - June 30, 2026
What's New
-
Content filtering and Prompt Shield module (
sap_cloud_sdk.aicore.filtering): New subpackage that applies SAP AI Core Orchestration v2 content filtering to everysap/*LiteLLM model call. Filtering is enabled by default whenset_aicore_config()is called.New public types:
Severity— Azure Content Safety threshold enum (STRICT=0,LOW=2,MEDIUM=4,OFF=6).AzureContentFilter— configures per-category thresholds (hate,violence,sexual,self_harm) plus optionalprompt_shield(jailbreak + indirect-injection detection).LlamaGuard38bFilter— opt-in Llama Guard 3 8B filter with per-category boolean toggles.ContentFilter— abstract base for custom provider implementations.InputFiltering/OutputFiltering— direction-specific filter stacks.ContentFiltering— top-level configuration container passed toset_filtering().
New exception types:
ContentFilteredError— raised when a filter blocks input or output; exposesdirection("input"or"output"),details(severity scores), andrequest_id.OrchestrationError— base class for all orchestration-module errors.
-
set_filtering(config?)anddisable_filtering()(sap_cloud_sdk.aicore): New public functions to install or remove aContentFilteringconfiguration at runtime.set_filtering()with no argument re-applies env-var-driven defaults. -
completion()andacompletion()(sap_cloud_sdk.aicore): Thin sync/async wrappers aroundlitellm.completion/litellm.acompletionthat normalise input-filter rejections (HTTP 400) and output-filter rejections (finish_reason="content_filter") into a singleContentFilteredErrortype, so callers need only oneexceptclause. -
set_aicore_config()now auto-activates filtering: After loading credentials,set_aicore_config()automatically callsset_filtering()to install filtering atSeverity.MEDIUMon all categories with Prompt Shield enabled. SetAICORE_FILTER_ENABLED=falsebefore callingset_aicore_config()to opt out.