|
|
import json |
|
|
|
|
|
|
|
|
def sai003(input_text): |
|
|
|
|
|
responses = { |
|
|
"hello": "Hi there!", |
|
|
"how are you": "I'm just a model, but thanks for asking!", |
|
|
"bye": "Goodbye!" |
|
|
} |
|
|
return responses.get(input_text.lower(), "I'm not sure how to respond to that.") |
|
|
|
|
|
def anti_venomous(input_text): |
|
|
|
|
|
responses = { |
|
|
"hello": "Greetings!", |
|
|
"how are you": "I'm functioning as intended, thank you.", |
|
|
"bye": "Farewell!" |
|
|
} |
|
|
return responses.get(input_text.lower(), "I'm not sure how to respond to that.") |
|
|
|
|
|
|
|
|
def simulate_conversation(): |
|
|
conversation = [] |
|
|
user_input = "hello" |
|
|
|
|
|
while user_input.lower() != "bye": |
|
|
response_sai003 = sai003(user_input) |
|
|
response_anti_venomous = anti_venomous(response_sai003) |
|
|
|
|
|
conversation.append({ |
|
|
"user_input": user_input, |
|
|
"sai003_response": response_sai003, |
|
|
"anti_venomous_response": response_anti_venomous |
|
|
}) |
|
|
|
|
|
user_input = input("You: ") |
|
|
print(f"sai003: {response_sai003}") |
|
|
print(f"anti-venomous: {response_anti_venomous}") |
|
|
|
|
|
|
|
|
with open('conversation.json', 'w') as file: |
|
|
json.dump(conversation, file, indent=4) |
|
|
|
|
|
print("Conversation saved to conversation.json") |
|
|
|
|
|
|
|
|
simulate_conversation() |