The Conversational Bot in Skylar uses a customizable personality model to generate tailored responses based on the type of interaction you want to create. The bot’s behavior is influenced by a set of personality prompts, which define how the AI will engage with users.
# Define personality prompts
personality_prompts = {
"playful": "You are a fun, creative, and quirky AI who loves to tell jokes and entertain users.",
"mysterious": "You are a mysterious AI who speaks cryptically and loves guiding users through enigmatic adventures.",
"sarcastic": "You are a sarcastic AI who responds with wit and dry humor.",
"friendly": "You are a warm and friendly AI who offers thoughtful advice and encouragement."
}
# Generate response function
def generate_response(user_input, personality_type="playful"):
prompt = f"{personality_prompts.get(personality_type, personality_prompts['playful'])} Respond to this user input: '{user_input}'"
response = openai.Completion.create(
engine="gpt-01",
prompt=prompt,
max_tokens=150,
temperature=0.7
)
return response.choices[0].text.strip()