llama-stack-mirror/llama_stack/providers/inline/safety
Mustafa Elbehery 4a13ef45e9
fix: Implement missing run_moderation method in PromptGuardSafetyImpl (#3101)
# What does this PR do?
<!-- Provide a short summary of what this PR does and why. Link to
relevant issues if applicable. -->
This PR addresses an issue where `PromptGuardSafetyImpl` was an
incomplete implementation of an abstract class. The class was missing
the required run_moderation method from its parent interface.


Currently, running `pre-commit` locally fails with the error below.

```
llama_stack/providers/inline/safety/prompt_guard/__init__.py:15: error: Cannot instantiate abstract class "PromptGuardSafetyImpl" with abstract attribute "run_moderation"  [abstract]
Found 1 error in 1 file (checked 410 source files)
```

This PR fixes the issue as follows

- Added the missing run_moderation method to PromptGuardSafetyImpl
- Method raises NotImplementedError with appropriate message indicating
this functionality is not implemented for PromptGuard
- This allows the class to be properly instantiated while clearly
indicating the limitation

<!-- If resolving an issue, uncomment and update the line below -->
<!-- Closes #[issue-number] -->

Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
2025-08-12 08:32:52 -07:00
..
code_scanner chore: enable pyupgrade fixes (#1806) 2025-05-01 14:23:50 -07:00
llama_guard feat: Add moderations create api (#3020) 2025-08-06 13:51:23 -07:00
prompt_guard fix: Implement missing run_moderation method in PromptGuardSafetyImpl (#3101) 2025-08-12 08:32:52 -07:00
__init__.py add missing inits 2024-11-08 17:54:24 -08:00