mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-24 17:14:18 +01:00
🧪 test: level 2
This commit is contained in:
@@ -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...')
|
||||
|
||||
@@ -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'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user