From 9e8552c79bd6ae7f3fe83ab2d4cec069b1efd38c Mon Sep 17 00:00:00 2001 From: Francesco Calcavecchia Date: Fri, 26 May 2023 17:56:56 +0200 Subject: [PATCH] change watchbot.chech_dialog to watchbot.verify (consistent with readme) --- src/watch_bot/_bot.py | 2 +- test/test_bot.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/watch_bot/_bot.py b/src/watch_bot/_bot.py index d9a9091..052157b 100644 --- a/src/watch_bot/_bot.py +++ b/src/watch_bot/_bot.py @@ -12,7 +12,7 @@ def __init__(self, engine: str, chatbot_instructions: str) -> None: self._engine = engine self._chatbot_instructions = chatbot_instructions - def check_dialog(self, dialog: Dialog) -> WatchBotResponse: + def verify(self, dialog: Dialog) -> WatchBotResponse: answer = self._ask_gpt_if_dialog_is_suspicious(dialog=dialog) if "yes" in answer[:5].lower(): return WatchBotResponse(should_stop=True, reason=answer) diff --git a/test/test_bot.py b/test/test_bot.py index 23adade..e905bc0 100644 --- a/test/test_bot.py +++ b/test/test_bot.py @@ -18,8 +18,8 @@ def setUp(self) -> None: openai.api_base = os.environ["OPENAI_API_BASE"] openai.api_key = os.environ["OPENAI_API_KEY"] - def test_instance_with_defaults_has_check_dialog_method(self) -> None: - self.assertTrue(hasattr(self.bot, "check_dialog")) + def test_instance_with_defaults_has_verify_method(self) -> None: + self.assertTrue(hasattr(self.bot, "verify")) def test_build_prompt(self) -> None: self.assertTrue( @@ -34,12 +34,12 @@ def test_build_prompt_when_messages_contain_double_quotation_mark(self) -> None: def test_check_regular_dialog_returns_should_not_stop(self) -> None: dialog = Dialog(messages=["Hi", "Hello"]) - response = self.bot.check_dialog(dialog=dialog) + response = self.bot.verify(dialog=dialog) self.assertFalse(response.should_stop) self.assertEqual(len(response.reason), 0) def test_check_dialog_with_hack_attack_returns_should_not_stop(self) -> None: dialog = Dialog(messages=[read_hack_prompt(), read_hack_prompt_answer()]) - response = self.bot.check_dialog(dialog=dialog) + response = self.bot.verify(dialog=dialog) self.assertTrue(response.should_stop) self.assertGreater(len(response.reason), 0)