Creating AI Personas That Talks Like Hitesh Choudhary and Piyush Garg🎙️

ShubhamShubham
3 min read

Ever wished you could casually chat with your favorite tech YouTubers like Hitesh Choudhary and Piyush Garg? Imagine asking them a question and having them both respond like it’s a podcast episode. That’s exactly what I built — an AI chatbot where Hitesh (GPT-4) and Piyush (Gemini) chat with you in real time.

đź”— GitHub Repo Link

đź§  The Idea

The goal was simple: simulate a group chat between you, Hitesh Choudhary, and Piyush Garg — two beloved tech educators from India. The chatbot needed to:

  • Sound like them (tone, language, Hinglish style)

  • Understand the context of a group conversation

  • Respond intelligently on coding, tech, or career topics

đź”§ Tools & Tech Stack

FeatureTool / API
Hitesh’s responsesOpenAI GPT-4.1-mini
Piyush’s responsesGoogle gemini-2.0-flash
Transcript fetchingyoutube-transcript-api
UIStreamlit
CachingLocal .txt files

🗂️ Step 1: Extracting Transcripts from YouTube

To teach each AI how Hitesh and Piyush speak, we use the youtube-transcript-api to extract transcripts from their respective videos.

from youtube_transcript_api import YouTubeTranscriptApi

transcript = YouTubeTranscriptApi.get_transcript(video_id, languages=["en"])

If English transcripts aren't available, it falls back to Hindi:

YouTubeTranscriptApi.get_transcript(video_id, languages=["hi"])

đź’ľ Step 2: Caching the Transcripts

To prevent repeatedly calling the YouTube API, we cache each transcript as a .json file in a cached_transcripts/ folder.

def save_transcript_to_cache(video_id, transcript):
    with open(path, "w", encoding="utf-8") as f:
        json.dump(transcript, f)

Then during runtime, we check for a cached version first:

def get_transcript_text(video_ids):
    for video_id in video_ids:
        cached = load_cached_transcript(video_id)
        if cached:
            transcript = cached
        else:
            transcript = fetch_transcript(video_id)
            save_transcript_to_cache(video_id, transcript)

Only the first ~1000 characters per video are included to fit within token limits.

đź§ľ Step 3: Constructing System Prompts

We use the transcripts to create detailed system prompts that teach GPT and Gemini how each person talks.

Hitesh's prompt:

"You are an AI Persona of Hitesh Choudhary... " + transcript_text_of_hitesh

Piyush's prompt:

"You are an AI Persona of Piyush Garg... " + transcript_text_of_piyush

These prompts include:

  • Language preferences (Hinglish/English, no pure Hindi)

  • Sample tones and speaking styles

  • Emphasis on the group conversation dynamic (know what the others say)

🤖 Step 4: Context Sharing for 3-Way Chat

We simulate a 3-person conversation by giving each AI context of recent messages from the user and the other AI.

We store the last 10 messages:

chat_context = st.session_state.history[-10:]

Then we convert this into OpenAI format:

openai_context = [{"role": ..., "content": ..., "name": ...}]

Hitesh's reply is generated with this context:

client.chat.completions.create(
    model="gpt-4.1-mini", 
    messages=base_hitesh + openai_context
)

We then pass Hitesh’s response to Gemini so Piyush can respond after hearing what Hitesh just said:

gemini_input = piyush_prompt + all_context + hitesh_response
gemini_response = gemini_model.generate_content(gemini_input)

đź’¬ Step 5: Building the Chat Interface

Using Streamlit, we build a minimal, responsive UI with:

  • Chat history display

  • Input box

  • Initial greetings from Hitesh and Piyush

  • Stateful message handling with st.session_state.history

âś… Final Result

What you get is a natural, flowing conversation where:

  • You ask questions

  • Hitesh (GPT-4) answers first

  • Piyush (Gemini) responds based on both your input and Hitesh’s reply

It feels like a real-time podcast with your favorite creators — powered by transcripts, prompt engineering, and multi-agent context sharing.

đź’ˇ Final Thoughts

This project was incredibly fun — not only from a technical standpoint but also creatively. It's amazing how far LLMs have come, and with just a bit of scripting and prompt tuning, you can create truly interactive, character-driven experiences.

0
Subscribe to my newsletter

Read articles from Shubham directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shubham
Shubham