Skip to content

krrishapatel/Celebrity-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serena Williams Conversational Agent

Built for CIS 1990: Designing AI Agents

A conversational agent that embodies Serena Williams, built with:

  • Memory Store: Semantic search over curated information about Serena Williams
  • Content Module: Grounded response planning based on retrieved evidence
  • Style Module: Voice transformation to match Serena's distinctive speaking style
  • Chat Runner: Interactive CLI for conversations with the agent

Project layout

celebrity_agent/
  README.md
  requirements.txt
  data/
    index/
      index.json          # Memory chunks with metadata
      embeddings.npy      # Precomputed embeddings for semantic search
    sample_sources.json   # Example source format
    sample_index.json     # Example index format
  src/
    __init__.py
    memory_store.py       # Memory ingestion, indexing, and retrieval
    content_module.py     # Content planning from retrieved evidence
    style_module.py       # Stylization to Serena's voice
    run_agent.py          # Main chat loop
    llm.py                # Mistral API wrapper

Quick start

  1. Install dependencies:
pip install -r requirements.txt
  1. Set your Mistral API key as an environment variable:
export MISTRAL_API_KEY="your_api_key_here"
  1. Build the memory store (this will collect data and compute embeddings):
python -m src.memory_store

This will:

  • Collect information about Serena Williams from Wikipedia and curated sources
  • Chunk the text by paragraph with topic labels (career, motherhood, race, business, mental_health, advocacy)
  • Compute embeddings for semantic search
  • Save everything to data/index/
  1. Run the agent:
python -m src.run_agent

The agent will load the memory store and start an interactive conversation. Type your messages and the agent will respond as Serena Williams. Type "bye" or "thanks" to end the conversation.

Implementation Details

Memory Store

  • Uses Wikipedia API and curated sources covering Serena's career, advocacy, motherhood, business ventures, and more
  • Chunks text by paragraph with automatic topic classification
  • Uses sentence-transformers (all-MiniLM-L6-v2) for semantic embeddings
  • Retrieves top-k most relevant chunks based on cosine similarity

Content Module

  • Parses user queries and retrieves relevant evidence
  • Creates structured content plans using LLM prompting
  • Ensures all factual claims are grounded in retrieved evidence

Style Module

  • Transforms content plans into Serena's authentic voice
  • Captures her confident, direct style with frequent "I" statements
  • Reflects her competitive mindset, advocacy themes, and references to being underestimated
  • Preserves factual accuracy while matching her conversational patterns

Conversation Management

  • Detects natural conversation endpoints (goodbyes, thanks, etc.)
  • Adds authentic sign-offs
  • Auto-ends after reasonable number of turns

Notes

  • The memory store needs to be built before running the agent
  • First run of build_memory_store() will download the sentence transformer model (~90MB)
  • The agent uses Mistral's API - ensure you have API credits and network access

About

AI agent that mimics celebrity personas using LLMs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages