🔧 ProgrammierungRequest lifecycle: HandlerMapping HandlerAdapter resolvers(16.09.2026 um 00:08 Uhr)
🔧 ProgrammierungChapter 1 - The Funkiest of All Machines(16.09.2026 um 00:13 Uhr)
🔧 AI Nachrichten President Trump Called Nvidia’s Jensen Huang About A.I. Slowdown(15.09.2026 um 23:45 Uhr)
🔧 AI Nachrichten Google’s Simulated Fruit Fly Brain Did Not Write This Article(16.09.2026 um 00:00 Uhr)
🔧 ProgrammierungRequest lifecycle: HandlerMapping HandlerAdapter resolvers(16.09.2026 um 00:08 Uhr)
🔧 ProgrammierungChapter 1 - The Funkiest of All Machines(16.09.2026 um 00:13 Uhr)
🔧 AI Nachrichten President Trump Called Nvidia’s Jensen Huang About A.I. Slowdown(15.09.2026 um 23:45 Uhr)
🔧 AI Nachrichten Google’s Simulated Fruit Fly Brain Did Not Write This Article(16.09.2026 um 00:00 Uhr)

🔧 AI Nachrichten 🕛 vor 2 Jahren 10 Min Lesezeit
0

Recreating Andrej Karpathy’s Weekend Project — a Movie Search Engine

↗ Quelle (towardsdatascience.com)
🗣️ Stimme:
📑 Inhaltsübersicht

Recreating Andrej Karpathy’s Weekend Project — a Movie Search Engine

Building a movie recommender system with OpenAI embeddings and a vector database

Movie recommender system build with AI (OpenAI, Weaviate)
Stylized screenshot of the , one of the founding members of OpenAI and former Director of AI at Tesla, shared this fun weekend hack, a

Despite its popularity, Karpathy unfortunately has not publicly shared the project’s source code.

Screenshot of to store the embeddings, which is populated with a Python script
  • Frontend: HTML, CSS, Js
  • Backend: NodeJs
  • Thus, to follow along in this tutorial, you will need the following:

    • Python for data processing and populating the vector database
    • Docker and Docker-Compose for running the vector database locally.
    • Node.js and npm for running the application locally.
    • OpenAI API key to access the OpenAI embedding model

    Implementing a Movie Search Engine

    This section analyzes Karpathy’s weekend hack and aims to recreate it with its own little twists. To build a simple movie search engine, follow these steps:

    • .

      Preparation: Movie dataset

      Karpathy’s project indexes all 11,762 movies since 1970, including the plot and the summary from Wikipedia.

      To achieve something similar without manually scraping Wikipedia, you can use the following two datasets from Kaggle:

      • ) for the columns 'id', 'name', 'PosterLink', 'Genres', 'Actors', 'Director', 'Description', 'Keywords', and 'DatePublished'.
      • ), for the column 'plot'.

      The two datasets are merged on the movie title and release year and then filtered by movies released after 1970. You can find the detailed preprocessing steps in the , which should be used for semantic similarity.

    Additionally, the similarity is calculated based on each movie’s Wikipedia summary and plot with two choices for a similarity ranker:

    • k-Nearest Neighbor (kNN) using cosine similarity
    • Support Vector Machine

    Karpathy suggests a combination of under original Tweet (Screenshot by author)

    In this project, we will also use the *, an open source vector database. Although I could argue that vector databases are much faster than when you store your embeddings in np.arraybecause they use vector indexing, let’s be honest here: At this scale (thousands), you won’t notice any difference in speed. My main reason for using a vector database here is that Weaviate has many convenient built-in functionalities you can use out of the box, such as automatic vectorization using embedding models.

    First, as shown in the embedding model. Additionally, you can define the cosine distance as the similarity measure.

    movie_class_schema = {
    "class": "Movies",
    "description": "A collection of movies since 1970.",
    "vectorizer": "text2vec-openai",
    "moduleConfig": {
    "text2vec-openai": {
    "vectorizeClassName": False,
    "model": "ada",
    "modelVersion": "002",
    "type": "text"
    },
    },
    "vectorIndexConfig": {"distance" : "cosine"},
    }

    Next, you define the movie data objects’ properties and for which properties to generate vector embeddings. In the following shortened code snippet, you can see that for the properties movie_id and title no vector embeddings are generated because of the "skip" : True setting for the vectorizer module. This is because, we only want to generate vector embeddings for the description and plot.

    movie_class_schema["properties"] = [
    {
    "name": "movie_id",
    "dataType": ["number"],
    "description": "The id of the movie",
    "moduleConfig": {
    "text2vec-openai": {
    "skip" : True,
    "vectorizePropertyName" : False
    }
    }
    },
    {
    "name": "title",
    "dataType": ["text"],
    "description": "The name of the movie",
    "moduleConfig": {
    "text2vec-openai": {
    "skip" : True,
    "vectorizePropertyName" : False
    }
    }
    },
    # shortened for brevity ...
    {
    "name": "description",
    "dataType": ["text"],
    "description": "overview of the movie",
    },
    {
    "name": "Plot",
    "dataType": ["text"],
    "description": "Plot of the movie from Wikipedia",
    },
    ]

    # Create class
    client.schema.create_class(movie_class_schema)

    Finally, you define a batch process to populate the vector database:

    # Configure batch process - for faster imports 
    client.batch.configure(batch_size=10)

    # Importing the data
    for i in range(len(df)):
    item = df.iloc[i]

    movie_object = {
    'movie_id':float(item['id']),
    'title': str(item['Name']).lower(),
    # shortened for brevity ...
    'description':str(item['Description']),
    'plot': str(item['Plot']),
    }

    client.batch.add_data_object(movie_object, "Movies")

    Step 2: Search for movies

    In Karpathy’s project, the search bar is a simple keyword-based search that tries to match your exact query to movie titles verbatim. When some people stated that they expected the search to allow semantic search for movies, Karpathy agreed that this could be a good extension of the project:

    Screenshot of file:

    • keyword-based search (, which is a combination of keyword-based search and semantic search.

    Each of these searches will return num_movies = 20 movies with the properties ['title', 'poster_link', 'genres', 'year', 'director', 'movie_id'].

    To enable keyword-based search, you can use a .withBm25() search query across the properties ['title', 'director', 'genres', 'actors', 'keywords', 'description', 'plot']. You can give the property 'title' a bigger weight by specifying 'title^3'.

    async function get_keyword_results(text) {
    let data = await client.graphql
    .get()
    .withClassName('Movies')
    .withBm25({query: text,
    properties: ['title^3', 'director', 'genres', 'actors', 'keywords', 'description', 'plot'],
    })
    .withFields(['title', 'poster_link', 'genres', 'year', 'director', 'movie_id'])
    .withLimit(num_movies)
    .do()
    .then(info => {
    return info
    })
    .catch(err => {
    console.error(err)
    })
    return data;
    }

    To enable semantic search, you can use a .withNearText() search query. This will automatically vectorize the search query and retrieve its closest movies in the vector space.

    async function get_semantic_results(text) {
    let data = await client.graphql
    .get()
    .withClassName('Movies')
    .withFields(['title', 'poster_link', 'genres', 'year', 'director', 'movie_id'])
    .withNearText({concepts: [text]})
    .withLimit(num_movies)
    .do()
    .then(info => {
    return info
    })
    .catch(err => {
    console.error(err)
    });
    return data;
    }

    To enable hybrid search, you can use a .withHybrid() search query. The alpha : 0.5 means that keyword search and semantic search are weighted equally.

    async function get_hybrid_results(text) {
    let data = await client.graphql
    .get()
    .withClassName('Movies')
    .withFields(['title', 'poster_link', 'genres', 'year', 'director', 'movie_id'])
    .withHybrid({query: text, alpha: 0.5})
    .withLimit(num_movies)
    .do()
    .then(info => {
    return info
    })
    .catch(err => {
    console.error(err)
    });
    return data;
    }

    Step 3: Get similar movie recommendations

    To get similar movie recommendations, you can do a .withNearObject() search query, as shown in the aesthetic (I’m not going to bore you with frontend stuff), and voila! You’re all set!

    To run the demo locally, clone the Additionally, run the following command in the directory to install all required dependencies in your virtual environment.

    pip install -r requirements.txt

    Next, set your OPENAI_API_KEY in the docker-compose.yml file and run the following command to run Weaviate locally via Docker.

    docker compose up -d

    Once your Weaviate instance is up and running, run the add_data.py file to populate your vector database.

    python add_data.py

    Before you can run your application, install all required node modules.

    npm install

    Finally, run the following command to start up your movie search engine application locally.

    npm run start

    Now, navigate to :

    Demo live at and tweak it if you like. Some suggestions for further improvements could be to play around with vectorizing different properties, to tweak the weighting between keyword search and semantic search or to switch out the embedding model with an open source alternative.

    Enjoyed This Story?

    , !

    Disclaimer

    • At the time of writing, I am a developer advocate at .
    • This project is not an original idea: The project is inspired by

    on Medium, where people are continuing the conversation by highlighting and responding to this story.

    Vollständiger Original-Artikel
    Den kompletten Beitrag mit allen Details direkt auf towardsdatascience.com lesen.
    ↗ Original-Artikel auf towardsdatascience.com lesen
    Wie bewertest du diesen Beitrag?
    1 Klick Feedback
    Teilen mit Netzwerk & Team:

    Community-Analysen & Experten-Meinungen 0

    Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
    Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
    Community Pulse: Relevanz-Einschätzung
    1 Klick Experten-Votum
    🔴 Akute Relevanz 0%
    🟡 In Evaluierung 0%
    🟢 Keine Auswirkung 0%
    Spannende Innovation 0%
    Verwandte Story-Cluster & Quellen (Vektor-KI)
    Port 8095 Engine
    1 Quelle
    Protect Kubernetes Services with OAuth2 Proxy, Gateway API, Traefik, and Pocket ID
    1 Quelle
    Request lifecycle: HandlerMapping HandlerAdapter resolvers
    1 Quelle
    The best n8n fix I found this month was boring: lower your agent concurrency settings before touching the prompt
    Ähnliche Beiträge
    🔍 Verwandte News

    Auch interessante Nachrichten Recreating Andrej Karpathy’s Weekend Project — a Movie Search Engine

    Thematisch verwandte Begriffe: Recreating, Andrej, Karpathys, Weekend · 6 Treffer

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...