Files
semantic-kernel/python/semantic_kernel
Julio Carlos MenendezandEvan Mattson 7f68a88c25 Python: Supports better exceptions when Azure OpenAI content filtering is triggered (#4428)
### Motivation and Context

When an Azure OpenAI content filter error is triggered the current
`AIException` hides the details of that specific error. This makes it
hard for the consumer to see a more detailed description of the error in
their prompt or input.
Solves #4197

### Description

Detects when a content filter error is raised, then parses the
meaningful information about it and raises a new
`ContentFilterAIException` with that information ready for the consumer
to use.

### Contribution Checklist

- [X] The code builds clean without any errors or warnings
- [X] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [X] All unit tests pass, and I have added new tests where possible
- [X] I didn't break anyone 😄

---------

Co-authored-by: Evan Mattson <[email protected]>
2024-01-04 14:52:50 +00:00
..