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
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
- Install dependencies:
pip install -r requirements.txt- Set your Mistral API key as an environment variable:
export MISTRAL_API_KEY="your_api_key_here"- Build the memory store (this will collect data and compute embeddings):
python -m src.memory_storeThis 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/
- Run the agent:
python -m src.run_agentThe 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.
- 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
- Parses user queries and retrieves relevant evidence
- Creates structured content plans using LLM prompting
- Ensures all factual claims are grounded in retrieved evidence
- 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
- Detects natural conversation endpoints (goodbyes, thanks, etc.)
- Adds authentic sign-offs
- Auto-ends after reasonable number of turns
- 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