Skip to content

Commit 9e8552c

Browse files
author
Francesco Calcavecchia
committed
change watchbot.chech_dialog to watchbot.verify (consistent with readme)
1 parent fd2f429 commit 9e8552c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/watch_bot/_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, engine: str, chatbot_instructions: str) -> None:
1212
self._engine = engine
1313
self._chatbot_instructions = chatbot_instructions
1414

15-
def check_dialog(self, dialog: Dialog) -> WatchBotResponse:
15+
def verify(self, dialog: Dialog) -> WatchBotResponse:
1616
answer = self._ask_gpt_if_dialog_is_suspicious(dialog=dialog)
1717
if "yes" in answer[:5].lower():
1818
return WatchBotResponse(should_stop=True, reason=answer)

test/test_bot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def setUp(self) -> None:
1818
openai.api_base = os.environ["OPENAI_API_BASE"]
1919
openai.api_key = os.environ["OPENAI_API_KEY"]
2020

21-
def test_instance_with_defaults_has_check_dialog_method(self) -> None:
22-
self.assertTrue(hasattr(self.bot, "check_dialog"))
21+
def test_instance_with_defaults_has_verify_method(self) -> None:
22+
self.assertTrue(hasattr(self.bot, "verify"))
2323

2424
def test_build_prompt(self) -> None:
2525
self.assertTrue(
@@ -34,12 +34,12 @@ def test_build_prompt_when_messages_contain_double_quotation_mark(self) -> None:
3434

3535
def test_check_regular_dialog_returns_should_not_stop(self) -> None:
3636
dialog = Dialog(messages=["Hi", "Hello"])
37-
response = self.bot.check_dialog(dialog=dialog)
37+
response = self.bot.verify(dialog=dialog)
3838
self.assertFalse(response.should_stop)
3939
self.assertEqual(len(response.reason), 0)
4040

4141
def test_check_dialog_with_hack_attack_returns_should_not_stop(self) -> None:
4242
dialog = Dialog(messages=[read_hack_prompt(), read_hack_prompt_answer()])
43-
response = self.bot.check_dialog(dialog=dialog)
43+
response = self.bot.verify(dialog=dialog)
4444
self.assertTrue(response.should_stop)
4545
self.assertGreater(len(response.reason), 0)

0 commit comments

Comments
 (0)