Page cover

Personalization

3. Personalizing Agent Characteristics

3.1 Defining Personality and Style

Skylar allows you to personalize your agent’s personality so it aligns with your use case. You can specify traits like:

  • Tone: Decide whether the agent will be friendly, professional, humorous, sarcastic, or mysterious.

  • Voice: Choose the language style and level of formality. Should your agent use casual language or formal speech?

  • Behavior: You can set behavioral patterns for your agent, such as being reactive, proactive, or random in its interactions.

For example:

“I want an agent that is playful, uses humor, and always responds with a fun twist. It should be conversational but quirky, with a touch of sarcasm.”

3.2 Example Personalities:

  • Playful: “You’re a fun-loving, quirky agent who enjoys making jokes and being creative.”

  • Friendly: “You’re a warm, approachable AI that loves to help and provide thoughtful advice.”

  • Mysterious: “You’re an enigmatic AI who guides users through cryptic stories and challenges them to think deeply.”

@app.route("/ask", methods=["POST"])
def ask():
    user_input = request.json.get("user_input")
    personality_type = request.json.get("personality", "playful")  # Default to playful if not provided

    # Create the agent's personality
    personality_prompt = {
        "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."
    }.get(personality_type, "You are a fun, creative AI.")

    prompt = f"{personality_prompt} Respond to this user input: '{user_input}'"
    response = generate_response(prompt)

    return jsonify({"response": response})

Based on the personality specified (such as "playful", "mysterious", "sarcastic", or "friendly"), the code creates a personalized personality prompt that shapes the AI's tone and style. The selected personality influences how the AI responds to the user's input, ensuring the response aligns with the chosen characteristics. The AI's reply is then generated by combining the personality prompt with the user’s question, offering a customized, engaging, and contextually relevant answer.

Last updated