Add ML-based prompt injection detection (#5623)
This commit is contained in:
committed by
GitHub
parent
01da90c9b3
commit
9dc548ee2f
@@ -424,7 +424,7 @@ fn has_tool_response(message: &Message) -> bool {
|
||||
.any(|content| matches!(content, MessageContent::ToolResponse(_)))
|
||||
}
|
||||
|
||||
fn effective_role(message: &Message) -> String {
|
||||
pub fn effective_role(message: &Message) -> String {
|
||||
if message.role == Role::User && has_tool_response(message) {
|
||||
"tool".to_string()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user