Add embedding guessing game feature#35
Merged
SupraSummus merged 1 commit intomainfrom Apr 12, 2026
Merged
Conversation
9f27eaa to
8be6b21
Compare
New `guessing` app lets users guess phrases whose embeddings are close to a secret randomly-generated 2048-bit target. Key design: - GuessingTarget holds a random BitField embedding (no phrase, no async) - Guess links target + ExplorerQuery + user; unique per (target, query, user) - All views require login; guesses are scoped to the requesting user - Distance computed in DB via pgvector HammingDistance annotation; pending guesses (no embedding yet) use HTMX polling until ready https://claude.ai/code/session_01X71384QMsoYNs2yNUefF3k
162988e to
342bd2c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new embedding guessing game feature that allows players to submit phrases and see how close their embeddings are to secret target embeddings, measured by Hamming distance.
Key Changes
Models (
models.py)GuessingTargetmodel to represent secret embeddings that players try to matchschedule_embedding()method to queue embedding generation via django-goalsGuessmodel to track player submissions_ensure_target_embedding()function to compute embeddings for guessing targets_ensure_embedding()pattern for ExplorerQueryViews (
views.py)guessing_routersub-router under the main routerguessing_list: Shows all active guessing targetsguessing_detail: Displays a specific target with form and guess historyguessing_post: Handles form submission, creates/reuses queries and guessesguess_status: HTMX endpoint for polling pending guess computationsGuessFormfor phrase input with validation_render_guess_row()helper to render individual guesses with either computed distance or HTMX polling state_build_guessing_detail_page()to construct the game interface with sorted computed guesses and pending itemsAdmin (
admin.py)GuessingTargetandGuessmodels in Django adminGuessingTargetwith:Tests (
tests.py)Database
0002_guessingtarget_guess.pywith models and constraintsNotable Implementation Details
ExplorerQuerymodel for phrase embeddings to avoid duplicationhttps://claude.ai/code/session_01X71384QMsoYNs2yNUefF3k