Turn an AI/ML project into evidence employers trust.
A practical masterclass using a restaurant review assistant: from problem discovery and notebook workflow to a recruiter-ready GitHub repository, CV bullet, and interview story.
A practical masterclass using a restaurant review assistant: from problem discovery and notebook workflow to a recruiter-ready GitHub repository, CV bullet, and interview story.
Translate a recurring business decision into an AI task with a clear user and outcome.
Move from raw reviews to clean data, structured LLM output, evaluation, and responses.
Document inputs, outputs, failures, design trade-offs, and reproducible setup.
Tailor the same project for analyst, product, GenAI, and ML-focused roles.
Managers cannot consistently read and answer every review.
Review ID, customer name, rating, text, and timestamps.
Sentiment → aspects → evidence → response draft.
Export reviews, process them, approve and import replies.
Evaluation, GitHub documentation, CV bullet, interview narrative.
“Python, NLP, prompt engineering, LLM APIs.”
The reviewer still cannot tell whether you solved a problem, handled failure, or shipped anything useful.
“Built a review-response workflow that converts unstructured feedback into aspect sentiment, evidence phrases, and manager-ready drafts; documented failure cases and a reproducible demo.”
A person repeatedly reads text, compares signals, makes a category decision, or drafts a similar response.
Define one input, one output, one user, and one action. Avoid “build an AI platform.”
Accuracy, valid JSON rate, reviewer agreement, draft acceptance, or time saved per item.
If you can finish this sentence, the project has a spine: “When [user] receives [input], the system helps them [decision/action], so [outcome].”
The domain changes. The reusable pattern is: unstructured input → structured judgment → evidence → action.
Reviews arrive throughout the week. A manager reads each, interprets food/service/ambience, then drafts a response when time allows. Tone and specificity vary.
The system analyses each review, surfaces the phrases behind each label, and drafts a reply. The manager reviews before publishing.
The model does not promise compensation, accuse staff, or publish without review. The workflow supports judgment; it does not remove accountability.
Valid JSON, correct aspect coverage, evidence grounded in the review, acceptable tone, and fewer minutes spent per draft.
A model trained on large amounts of text to predict the next token. That prediction ability lets it classify, extract, summarise and generate language—but it does not guarantee factual truth.
The instructions and input sent to the model. A strong prompt defines the role, task, allowed labels, output format, constraints and the review text to analyse.
Models process pieces of words rather than characters or full sentences. Input and generated output both consume tokens, which affects context limits, latency and API cost.
The maximum tokens available for instructions, examples, review text and the response together. If the input is too large, important content must be selected, chunked or summarised.
The model is not being retrained when our notebook sends a review. It is performing inference: generating an answer from the supplied prompt and its learned parameters.
A lower setting usually makes outputs more consistent; a higher setting allows more variation. Classification and JSON extraction generally benefit from controlled, repeatable output.
The model may invent a detail that sounds reasonable. We reduce this risk by limiting the task, extracting evidence, validating fields and keeping a human in the approval loop.
Instead of free-form prose, the model returns named JSON fields with allowed values. The application can parse, validate and route the result reliably.
Many reviews can follow the same repeatable function instead of manual copy-and-paste.
We use a capable hosted model without downloading or operating large-model infrastructure.
Calls can be logged, validated and evaluated for latency, token usage, cost and failures.
Create a project key in the model provider’s console and set an appropriate usage limit.
Save the key in a Colab secret or environment variable—not in a notebook cell.
Read the named environment variable only when the notebook runs, keeping code and credentials separate.
Choose the model, token limit and messages, then send one small test request.
Parse JSON, check required fields and log failures before processing every row.
The key proves who is paying and who is allowed to call the service. Never commit it to GitHub, print it in output, or place it in browser-side code. If exposed, revoke it and create a new one.
Keep dependencies minimal and name versions in your repository so another person can reproduce the environment.
Use an environment variable or Colab secret for the API key. Never commit a key to GitHub.
Centralise model name, token limit, message format and return handling. Every later task uses the same call path.
import os, anthropic client = anthropic.Anthropic( api_key=os.environ["ANTHROPIC_API_KEY"] ) MODEL = "your-supported-model" def ask_claude(prompt: str) -> str: message = client.messages.create( model=MODEL, max_tokens=1024, messages=[{"role": "user", "content": prompt}] ) return message.content[0].text.strip()
Test whether /content/reviews_export.json exists.
Extract review_id, review text and optional name.
The sample keeps the notebook runnable, but must never look like user history.
One row per review; stable ID becomes the join key for import.
review_id is the contract across website export, notebook processing, and website import. Without it, a response can attach to the wrong review.
Character, word and sentence counts catch empty, very short, or unusually long inputs.
Handle Unicode, HTML, URLs and repeated whitespace before sending text to the model.
Store review_original and review_clean. Evidence should remain auditable against the original text.
Punctuation, negation and emojis may carry sentiment. Remove only what damages the task.
Lowercase and strip everything, then overwrite the only copy of the review. “Not bad!” can lose a useful emphasis signal.
Keep the original, create a cleaned field, document each transformation, and compare outputs on a small set before scaling.
You are analyzing restaurant reviews.
Classify the sentiment of the review below as one of:
- Positive
- Negative
- Neutral
Review:
{review}Can the model make the basic classification without examples?
Print the exact input and raw output. Read both before applying the function to all rows.
A natural-language explanation cannot reliably populate a dataframe column. Stage 1 proves capability, not integration.
“The food was delicious, but we waited forty minutes for a table.”INPUT REVIEW
“The dosa was crisp and the sambar was hot, but the waiter ignored us and the dining room was noisy.”ONE REVIEW · THREE EXPERIENCES
Add Not Applicable for unmentioned aspects. Forcing every review into every category creates false claims and weakens trust.
Useful for a dashboard, but impossible for a manager to verify quickly.
Features: “waiter ignored us”, “waited forty minutes”. Now the label is traceable to the source text.
"Service": { "sentiment": "Negative", "features": [ "waiter ignored us", "waited forty minutes" ] }
Require short phrases and empty lists for unmentioned aspects. Check that extracted phrases are grounded in the review.
Reference the experience the customer described—cold food, long wait, friendly staff—not generic “feedback.”
For negative feedback: apologise for the specific issue and state one credible action. For positive: thank and reinforce what worked.
Maximum three sentences. No compensation, policy commitment, invented investigation, or autonomous publishing.
The output is a draft. A manager owns the final wording and publication. This is both a product design decision and a responsible-AI control.
def parse_json_response(text):
if not text:
return {}
try:
text = remove_code_fences(text)
payload = extract_first_json_object(text)
result = json.loads(payload)
validate_schema(result)
return result
except Exception as error:
log_failure(text, error)
return {}When parsing fails, keep what the model actually returned. Otherwise debugging becomes guesswork.
A syntactically valid JSON object can still contain “Mostly Positive,” which breaks the contract.
Report valid JSON percentage and schema-valid percentage separately.
If you add retries, retry parse/schema failures with a correction prompt—not every response blindly.
How many calls parse successfully and contain every required field?
On a labelled sample, how often do model and reviewer agree by aspect?
Are feature phrases present in, or faithful to, the source review?
Would a manager approve, lightly edit, heavily edit, or reject the response?
Create 20–30 reviews covering positive, negative, neutral, mixed, sarcasm, one-aspect-only, very short, multilingual, and policy-sensitive cases. Report the composition; do not hide the hard examples.
Risk: literal positive classification.
Response: include sarcasm examples in evaluation; route low-confidence or contradiction cases for manual review.
Risk: language coverage is undocumented.
Response: state supported languages, add representative Hinglish tests, or detect and route unsupported inputs.
Risk: draft promises compensation or action beyond authority.
Response: prohibit compensation commitments and require manager review.
The site produces reviews_export.json with stable review IDs.
Load, clean, classify, extract evidence, draft responses, validate.
Manager checks tone, factual grounding, and operational promises.
Import manager_responses.json; IDs attach each response correctly.
For a portfolio demo, file exchange keeps the architecture visible and explainable. In production, an API, queue, access controls, monitoring, and audit logs would replace the manual hand-off.
[
{
"review_id": 1042,
"name": "Guest",
"review": "Food was excellent…"
}
][
{
"review_id": 1042,
"Overall": "Positive",
"Food Quality": "Positive",
"Service": "Not Applicable",
"Ambience": "Not Applicable",
"manager_response": "Thank you…"
}
]Explain how you would validate unique IDs, reject unknown IDs, handle duplicate imports, and preserve the manager’s edited response.
Keep the exploratory narrative, sample calls, and visible outputs.
Move reusable prompts, parsing and pipeline logic out of copy-pasted cells.
Use non-sensitive, clearly labelled examples with an expected output.
At minimum, test code-fence stripping, malformed JSON, missing fields and invalid labels.
“This project uses Python, pandas, Anthropic API, NLP and prompt engineering for sentiment analysis.”
“Restaurant managers often reply to reviews late or inconsistently. This project turns each review into aspect-level sentiment, supporting evidence, and a manager-reviewable response draft.”
Restaurant manager reviewing customer feedback.
Understand issues and prepare a specific response faster.
Consistent, evidence-grounded drafts with human approval.
Why JSON? What fields are required? How are IDs generated?
What is cleaned? What remains unchanged? What is sent to the model?
What labels and schema are allowed? What happens when parsing fails?
Who approves the draft? How is the response matched to a review?
Show exact shell commands and supported Python version.
Pin the main library versions in requirements.txt.
Provide .env.example; never include a real API key or committed notebook output containing one.
One command or notebook sequence should work with labelled sample reviews.
Explain the filename, location, schema and generated output file.
git clone <repo-url> cd review-response-assistant python -m venv .venv source .venv/bin/activate pip install -r requirements.txt cp .env.example .env # add your own key locally jupyter notebook
“The biryani was aromatic, but delivery took 70 minutes and the food arrived cold.”INPUT · anonymised sample
Dataset size, label mix, language mix, valid JSON rate, aspect agreement, and draft acceptance method.
Include 3–5 examples: sarcasm, mixed language, implicit complaints, irrelevant text, and unsafe requests.
Examples, schema validation, language routing, human review, monitoring, and cost/latency trade-offs.
A limitation is not an admission of failure. It shows that you tested beyond the happy path and understand the boundary of your solution.
Problem statement, one-line outcome, architecture image.
Input/output example, demo GIF, clear repo structure.
Notebook, prompts, parser, tests, evaluation table.
Quick start, sample data, dependency file, secret setup.
Use the problem and outcome in one sentence. Add precise topics—not every buzzword.
Pin the project to your profile and use the same name on your CV.
Tag a stable version so interviewers see the version you prepared to discuss.
“Worked on sentiment analysis using LLMs and Python.”
“Built a Python + LLM workflow that converts restaurant reviews into sentiment across three aspects, supporting evidence phrases, and manager-reviewable response drafts; added schema validation and a website JSON export/import loop.”
Use an ownership verb.
Name the moving parts.
Give concrete boundaries.
Add only a metric you actually evaluated.
Restaurant managers reply late and inconsistently.
Analyse three aspects and draft—not publish—a response.
Export → clean → prompt → validate → review → import.
Structured output and grounding mattered more than a clever prompt.
Format validity, aspect agreement, evidence fidelity, draft review.
Language support, schema enforcement, API workflow and monitoring.
Interview one user or observe one repetitive task. Write the problem sentence.
Create 10–20 permitted examples, labels, and the expected JSON contract.
Start with one input; add structure, aspects, evidence, then generation.
Parse, validate, log raw failures, and create edge-case tests.
Create a small interface or a clear file-based hand-off another person can use.
Measure, inspect disagreements, and document limitations.
README, demo, pinned repo, CV bullet, and a two-minute interview walkthrough.
Not “businesses”—a person with a repeated job and a consequence.
From original input through prompt, schema, evidence, validation, and review.
Clear repo, working sample, honest evaluation, limitations, and setup steps.
Build something small enough to own completely—and document it deeply enough that another person can trust your decisions.
Pick one part to discuss: problem framing, notebook flow, prompt design, evaluation, GitHub structure, CV positioning, or interview storytelling.