BerriAI/litellm · warning · ValueError

For using SAP Filtering Module you must provide at least one

Error message

For using SAP Filtering Module you must provide at least one property: input or output filters.

What it means

FilteringModuleConfig models SAP's input and output content filtering; at least one of 'input' or 'output' must be configured. A model_validator raises this ValueError when both are None, i.e. an empty filtering module was passed.

Source

Thrown at litellm/llms/sap/chat/models.py:600

class FilteringModuleConfig(BaseModel):
    """Module for managing and applying content filters.

    Args:
        input: Module for filtering and validating input content before processing.

        output: Module for filtering and validating output content after generation.
    """

    input: InputFiltering | None = None
    output: OutputFiltering | None = None

    @model_validator(mode="after")
    def enforce_min_properties(self) -> "FilteringModuleConfig":
        """
        Ensure at least one of input or output filtering is provided.
        """
        if self.input is None and self.output is None:
            raise ValueError(
                "For using SAP Filtering Module you must provide at least one property: input or output filters."
            )
        return self


class SAPDocumentTranslationApplyToSelector(BaseModel):
    """
    This selector allows you to define the scope of translation, such as specific placeholders or
    messages with specific roles.
    For example, {"category": "placeholders",
                "items": ["user_input"],
                "source_language": "de-DE"}
                targets the value of "user_input" in placeholder_values specified in the request payload;
                and considers the value to be in German.
    """

    category: Literal["placeholders", "template_roles"]
    items: list[str]

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Configure at least one side, e.g. {'filtering': {'input': {'filters': [my_filter]}}} or an output filter.
  2. If no filtering is wanted, remove the 'filtering' key from the module config entirely.
  3. Add a pre-flight check that strips empty module dicts before sending to SAP.

Example fix

# before
modules={'filtering': {}}
# after - either drop it or configure one side
modules={'filtering': {'input': {'filters': [my_input_filter]}}}
Defensive patterns

Strategy: validation

Validate before calling

def build_filtering(input_filters=None, output_filters=None) -> dict | None:
    cfg = {}
    if input_filters:
        cfg['input'] = {'filters': input_filters}
    if output_filters:
        cfg['output'] = {'filters': output_filters}
    return {'filtering': cfg} if cfg else None

Prevention

When it happens

Trigger: Sending {'filtering': {}} (or FilteringModuleConfig()) in the module config of a sap/ request - the filtering key exists but neither input nor output filter settings were provided.

Common situations: Scaffolded request templates that include every module key by default; toggling filters off by emptying the dict instead of removing the key; YAML/JSON configs where the filter sub-keys are commented out but the parent remains.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/c6cda50b180744fa. Report an issue: GitHub.