Skip to content

Commit f6b60c2

Browse files
authored
strip whitespace from llm response (#70392)
sometimes the LLM responds with trailing/beginning whitespace. strip it out.
1 parent 22978b3 commit f6b60c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sentry/feedback/usecases/spam_detection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def is_spam(message):
1313
is_spam = False
1414
response = complete_prompt(usecase=LLMUseCase.SPAM_DETECTION, prompt=PROMPT, message=message)
15-
if response and response.lower() in ("junk", "[junk]"):
15+
if response and response.strip().lower() in ("junk", "[junk]"):
1616
is_spam = True
1717

1818
logger.info(

0 commit comments

Comments
 (0)