
1. Environment Setup
First, install dependencies and configure your API key.Make sure your
OPENAI_API_KEY is set in the environment:Helper Functions
2. Loading and Preprocessing the Oscar Dataset
The lab environment already includesdata/oscars.csv. Let’s read and trim it:
3. Creating Dynamic Context Sentences
Next, we generate a self-contained sentence for each nomination, combining name, category, film title, and win status.
Example Context Sentences
4. Next Steps
With thetext column in place, you can now:
- Generate embeddings for each sentence
- Compute similarity scores via dot-product matching
- Build dynamic prompts by selecting the most relevant contexts