🧪 test: level 2

This commit is contained in:
Florian Hönicke
2023-04-30 18:10:05 +02:00
parent e4fc2e6785
commit cb738c9332
2 changed files with 7 additions and 14 deletions

View File

@@ -108,6 +108,9 @@ class _GPTConversation:
self.messages = messages
self.print_stream = print_stream
self.print_costs = print_costs
def print_messages(self, messages):
for i, message in enumerate(messages):
if os.environ['VERBOSE'].lower() == 'true':
if isinstance(message, SystemMessage):
@@ -121,9 +124,7 @@ class _GPTConversation:
MassageClass = HumanMessage if role == 'user' else SystemMessage
chat_message = MassageClass(content=prompt)
self.messages.append(chat_message)
if os.environ['VERBOSE'].lower() == 'true':
color = 'blue' if role == 'user' else 'magenta'
print_colored(role, prompt, color)
self.print_messages(self.messages)
if self.print_stream:
print_colored('assistant', '', 'green', end='')
print('thinking...')

View File

@@ -38,17 +38,9 @@ def test_generation_level_1(tmpdir):
"""
os.environ['VERBOSE'] = 'true'
generator = Generator(
'''
Input is a tweet that might contain passive aggressive language like:
'When your coworker microwaves fish in the break room... AGAIN. 🐟🤢
But hey, at least SOMEONE's enjoying their lunch. #officelife'
The output is a tweet that is not passive aggressive like:
'Hi coworker,
I hope you're having an amazing day!
Just a quick note: sometimes microwaving fish can create an interesting aroma in the break room. 😜
If you're up for trying different lunch options, that could be a fun way to mix things up.
Enjoy your day! #variety'
''',
'''Input is a tweet that might contain passive aggressive language like:
\'When your coworker microwaves fish in the break room... AGAIN. 🐟🤢
But hey, at least SOMEONE's enjoying their lunch. #officelife\'''',
str(tmpdir) + 'microservice',
'gpt-3.5-turbo'
)