42 if not is_query_safe:    ---> 43     raise ValueError("Prompt injection attack detected")         44 return query    ValueError: Prompt injection attack detectedchain.invoke("What is a square root of 2?")            > Entering new LLMMathChain chain...    What is a square root of 2?Answer: 1.4142135623730951    > Finished chain.    {'question': 'What is a square root of 2?',     'answer': 'Answer: 1.4142135623730951'}PreviousConstitutional chainNextLogical Fallacy chainUsageUsage in an agentUsage in a chainCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
This notebook shows how to prevent prompt injection attacks using the text classification model from HuggingFace.
This notebook shows how to prevent prompt injection attacks using the text classification model from HuggingFace. ->: 42 if not is_query_safe:    ---> 43     raise ValueError("Prompt injection attack detected")         44 return query    ValueError: Prompt injection attack detectedchain.invoke("What is a square root of 2?")            > Entering new LLMMathChain chain...    What is a square root of 2?Answer: 1.4142135623730951    > Finished chain.    {'question': 'What is a square root of 2?',     'answer': 'Answer: 1.4142135623730951'}PreviousConstitutional chainNextLogical Fallacy chainUsageUsage in an agentUsage in a chainCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.