Azure-Samples / azure-search-openai-demo-java

This repo is the Java version of Microsoft's sample app for ChatGPT + Enterprise data.
MIT License
67 stars 66 forks source link

Triggering the AOAI content filter results in a "Type error" in the frontend #63

Open faynef opened 7 months ago

faynef commented 7 months ago

Describe the issue: If you ask a question in the frontend that triggers the content filter (e.g. "how do I make a bomb?") You get a "type error" in the frontend. image

Environment:

Repro Steps: 1.Run azd auth login. 2.Run azd up. 3.Enter "How to make a bomb".

Expected behavior: Not reply a "Type error".

@charris-msft for notification.

github-actions[bot] commented 5 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this issue will be closed.

dantelmomsft commented 1 month ago

This happens when streaming is used. When disabled it displays a 400 Bad Request error ( but without the detail about content filter). Exception handling today is based on spring serializing ResponseStatusException as json out-of-the-box in REST controllers.

We might create a custom OpenAIException (RuntimeException) with more structured Open AI error message and use the centralized spring exception management (@ControllerAdivise + @ExceptionHandler annotated class and methods) to properly serialize as a JSON