When rendering the prompts, exclude turns from the history that errored due to prompt filtration#399
Conversation
…ed due to prompt filtration. This was resulting in users getting stuck in a state where all their subsequent requests were being filtered.
…response-filtered requests should be rendered in the message history whereas prompt-filtered requests should not)
379934e to
18b8b46
Compare
| override render(_state: void, _sizing: PromptSizing): PromptPiece<any, any> | undefined { | ||
| let turnHistory = this.props.history; | ||
| // exclude turns from the history that errored due to prompt filtration | ||
| let turnHistory = this.props.history.filter(turn => turn.responseStatus !== TurnStatus.PromptFiltered); |
There was a problem hiding this comment.
Below there's a check in the forEach loop for Filtered responses, would a similar approach work for prompt filtered responses?
There was a problem hiding this comment.
in the loop below, we are always including the user message and then filtering out the assistant response if it has responseStatus of TurnStatus.Filtered. in contrast, for turns with responseStatus of TurnStatus.PromptFiltered, we don't want the user message included (nor the non-existent assistant response)
| OffTopic = 'offTopic', | ||
| Canceled = 'canceled', | ||
| Filtered = 'filtered', | ||
| PromptFiltered = 'promptFiltered', |
There was a problem hiding this comment.
Is this a new thing? Or we just never handled it before?
There was a problem hiding this comment.
And do you have an example to trigger this? I tried some things and I mostly only get "Sorry I can't assist with this"
This was resulting in users getting stuck in a state where, after one prompt that triggered an RAI 422 error, all their subsequent requests were being filtered.