-
Notifications
You must be signed in to change notification settings - Fork 1.5k
When rendering the prompts, exclude turns from the history that errored due to prompt filtration #399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a new thing? Or we just never handled it before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nvm I got it
roblourens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
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.