Skip to content

Commit

Permalink
GPT/Sentience: disable GPT in test mode, disable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ProducerMatt committed Jun 17, 2023
1 parent 3f7f102 commit a7bf216
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 deletions.
19 changes: 11 additions & 8 deletions modules/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def process_message(self, message: ServiceMessage) -> Response:
self.log.info(self.class_name, warning="cannot use paid service") # DEBUG
return Response()

if Utilities.get_instance().test_mode:
return Response()

return Response(
confidence=3, callback=self.chatgpt_chat, args=[message], kwargs={}
)
Expand Down Expand Up @@ -159,11 +162,11 @@ async def chatgpt_chat(self, message: ServiceMessage) -> Response:
def __str__(self):
return "ChatGPT Module"

@property
def test_cases(self) -> list[IntegrationTest]:
return [
self.create_integration_test(
test_message="ChatGPT api is only hit in production because it is expensive?",
expected_response=CONFUSED_RESPONSE,
) # TODO write actual test for this
]
#@property
#def test_cases(self) -> list[IntegrationTest]:
# return [
# self.create_integration_test( # NOTE: responses cannot be predictable
# test_message="ChatGPT api is only hit in production because it is expensive?",
# expected_response=CONFUSED_RESPONSE,
# ) # TODO write actual test for this
# ]
19 changes: 11 additions & 8 deletions modules/gpt3module.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def process_message(self, message: ServiceMessage) -> Response:
if not self.is_at_me(message):
return Response()

if Utilities.get_instance().test_mode:
return Response()

return Response(
confidence=2, callback=self.gpt3_chat, args=[message], kwargs={}
)
Expand Down Expand Up @@ -263,11 +266,11 @@ async def gpt3_question(self, message: ServiceMessage) -> Response:
def __str__(self):
return "GPT-3 Module"

@property
def test_cases(self) -> list[IntegrationTest]:
return [
self.create_integration_test(
test_message="GPT3 api is only hit in production because it is expensive?",
expected_response=CONFUSED_RESPONSE,
) # TODO write actual test for this
]
#@property
#def test_cases(self) -> list[IntegrationTest]:
# return [
# self.create_integration_test( # NOTE: responses cannot be predictable
# test_message="GPT3 api is only hit in production because it is expensive?",
# expected_response=CONFUSED_RESPONSE,
# ) # TODO write actual test for this
# ]
16 changes: 8 additions & 8 deletions modules/sentience.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def process_message(self, message):
def __str__(self):
return "Sentience"

@property
def test_cases(self):
return [
self.create_integration_test(
test_message="If I asked you what 2+2 was and you answered incorrectly what would you have said?",
expected_response=CONFUSED_RESPONSE,
)
]
#@property
#def test_cases(self):
# return [
# self.create_integration_test( # NOTE: response not predictable
# test_message="If I asked you what 2+2 was and you answered incorrectly what would you have said?",
# expected_response=CONFUSED_RESPONSE,
# )
# ]

0 comments on commit a7bf216

Please sign in to comment.