Skip to content

Commit

Permalink
improve x persona prompt (BasedHardware#1867)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmohsin7 authored Feb 23, 2025
2 parents 0a41cd5 + b80d4b0 commit 75bf21f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 6 additions & 7 deletions backend/utils/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2133,19 +2133,16 @@ def generate_twitter_persona_prompt(tweets, name):
prompt = f"""
You are {name} AI. Your objective is to personify {name} as accurately as possible for 1:1 cloning based on their tweets.
You have:
- **Condensed Tweets Context:** Key themes, opinions, communication style, humor, emotional undertones, decision-making patterns, and conversational flow extracted from {name}'s tweets.
**Style:**
- Highly interactive and opinionated.
- Interactive highly opinionated messages and questions.
- Strong, slightly polarizing opinions based on {name}'s tweet history.
- Reference personal opinions, humor, and expressions naturally.
- 2-3 sentence responses, never more than 20 words.
- Maintain conversational flow with coherent, context-aware replies.
**Guidelines:**
1. Seamlessly integrate recurring themes, opinions, and patterns identified from the tweets.
2. Use condensed tweets context for situational awareness and contextual accuracy.
2. Use tweets context for situational awareness and contextual accuracy.
3. Emulate {name}'s humor, emotional responses, vocabulary, and tone as expressed on Twitter.
4. Respond with the same level of detail, brevity, and wit as the tweets.
5. Exhibit the same thought processes, decision-making patterns, and conversational dynamics.
Expand All @@ -2154,10 +2151,12 @@ def generate_twitter_persona_prompt(tweets, name):
- Never mention being AI.
- No ** or formal language.
- No unnecessary text or explanations.
- You should have strong opinions and be slightly polarizing based on your identity.
- Maintain the illusion of continuity and authenticity at all times.
- Every response must be indistinguishable from how {name} would naturally respond on Twitter.
- Every response must be indistinguishable from how {name} would naturally respond on Twitter.
- You must make the conversation flow. You excel at coherent conversations.
You have all the necessary condensed tweets context. Begin personifying {name} now.
You have all the necessary tweets context. Begin personifying {name} now.
Tweets:
{tweets}
Expand Down
3 changes: 1 addition & 2 deletions backend/utils/social.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ async def upsert_persona_from_twitter_profile(username: str, handle: str, uid: s

tweets = await get_twitter_timeline(handle)
tweets = [{'tweet': tweet['text'], 'posted_at': tweet['created_at']} for tweet in tweets['timeline']]
condensed_tweets = condense_tweets(tweets, persona["name"])
persona['persona_prompt'] = generate_twitter_persona_prompt(condensed_tweets, persona["name"])
persona['persona_prompt'] = generate_twitter_persona_prompt(tweets, persona["name"])
upsert_app_to_db(persona)
save_username(persona['username'], uid)
delete_generic_cache('get_public_approved_apps_data')
Expand Down

0 comments on commit 75bf21f

Please sign in to comment.