Skip to content

Commit b594bd6

Browse files
committed
refactor(aicore/filtering): collapse public API into filters.py
Address review comment #14 ("can we have all public methods on a filters.py? Better to read"). Merge _filters.py + _modules.py + _api.py into a single filters.py (no underscore — signals the public surface). It now owns Severity, ContentFilter, AzureContentFilter, LlamaGuard38bFilter, InputFiltering, OutputFiltering, ContentFiltering, set_filtering, disable_filtering. Tests import directly from .filters; the package __init__ stays a thin re-export for the flat 'from sap_cloud_sdk.aicore import ...' path. Internal-only files (_litellm_patch, exceptions) keep their separate locations; they aren't part of the documented public surface.
1 parent 8bcd53b commit b594bd6

8 files changed

Lines changed: 383 additions & 373 deletions

File tree

src/sap_cloud_sdk/aicore/filtering/__init__.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,26 @@
88
99
See :mod:`sap_cloud_sdk.aicore` user guide for the documented public API.
1010
11-
This module is a thin re-export surface; implementations live in
12-
``_api`` (entry points), ``_filters`` (provider classes + ``Severity``),
13-
``_modules`` (direction containers), ``_litellm_patch`` (LiteLLM patch),
14-
and ``exceptions``.
11+
This module is a thin re-export surface; the public API lives in
12+
:mod:`.filters`. Internal pieces live in ``_litellm_patch`` (LiteLLM patch
13+
and ``_install``) and ``exceptions``.
1514
"""
1615

1716
from __future__ import annotations
1817

19-
from ._api import disable_filtering, set_filtering
20-
from ._filters import (
18+
from ._litellm_patch import extract_filter_blocked
19+
from .exceptions import ContentFilteredError, OrchestrationError
20+
from .filters import (
2121
AzureContentFilter,
2222
ContentFilter,
23+
ContentFiltering,
24+
InputFiltering,
2325
LlamaGuard38bFilter,
26+
OutputFiltering,
2427
Severity,
28+
disable_filtering,
29+
set_filtering,
2530
)
26-
from ._litellm_patch import extract_filter_blocked
27-
from ._modules import ContentFiltering, InputFiltering, OutputFiltering
28-
from .exceptions import ContentFilteredError, OrchestrationError
2931

3032
__all__ = [
3133
"set_filtering",

src/sap_cloud_sdk/aicore/filtering/_api.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/sap_cloud_sdk/aicore/filtering/_filters.py

Lines changed: 0 additions & 147 deletions
This file was deleted.

src/sap_cloud_sdk/aicore/filtering/_modules.py

Lines changed: 0 additions & 146 deletions
This file was deleted.

0 commit comments

Comments
 (0)