CineGraph
A movie assistant over a Wikidata film graph: factual questions, recommendations and pictures, in a public web app.
LiveTry the live demoOverview
CineGraph is a movie assistant built for the University of Zurich AI Core curriculum. It uses a local RDF knowledge graph to connect films with people, genres and other attributes, so one agent can answer factual questions, recommend films and retrieve images.
Developed with Leyla Khasiyeva. I later turned the agent into a public web app: a Next.js site on Vercel that calls a FastAPI service on Modal, which holds the 2.4 million-fact graph in memory.
What I built
- Entity and relation resolution that maps names and wording to graph labels and canonical relations.
- SPARQL queries over the local graph, with a TransE embedding fallback when no graph answer is found.
- A recommender that scores films with weighted Jaccard over metadata, optionally blended with embedding similarity.
- Image retrieval for posters, portraits and scenes, answered through a command line interface or Speakeasy.
- Later: a question parser that reads the asked relation, the film or person and series positions (“the first Harry Potter film”), so free wording maps to one graph query.
- Later: a FastAPI service on Modal and a Next.js web app on Vercel with film, person and catalogue pages and a “How it was found” view of each answer.
CLI / Speakeasy message
agent.py · interactive_agent.py
main.py: CLI without embeddings
Responser.generate_response()
Label maps → image intent first → other request routing
Person / company / language rewrites can select the factual branch.
↓ One route per request
Images
- Entity + person / film type
- IMDb ID → image map
- Poster, portrait or scene
- Speakeasy image token
Local inputsRDF graph · images.json
Recommendations
- Metadata: Weighted Jaccard
- Optional embedding cosine similarity
- Constraints → ranked film titles
- No seeds: theme matching
Local inputsGraph · ratings · entity vectors
Factual questions
- Entity + relation → SPARQL
- Graph answer → return directly
↓ No answer, and vectors loaded?
TransE fallback
Head + relation → nearest entity
Entity + relation vectors
Local inputsLocal RDF graph + label maps
↓ Route returns its result
Return to CLI / Speakeasy
- Formatted answer
- Ranked titles
- Image token
- Explanatory message
Request flow of the original agent from core/responser.py; the three routes are alternative paths, not consecutive stages.
Results
- Three request routes in one agent: factual questions, recommendations and images.
- Question wording set: 386 / 386 answered correctly; first held-out set 165 / 165; a second, unseen held-out set 245 / 265 (92.5%).
- Labelled parser set: 110 of 112 answers correct, relation read correctly in 111.
- Evaluation checks cover SPARQL prompts with expected answers, plus regex and robustness scripts for media, rate limiting, concurrency and timeouts.
- A 6-page evaluation report (8 December 2025) documents the implemented routes and worked examples.
Limits
- The checks are focused scripts and question sets written for this project, not a public benchmark.
- Answers are only as complete as the Wikidata snapshot; when the graph has no fact, a TransE guess is shown and marked as a guess.




