-
Notifications
You must be signed in to change notification settings - Fork 3
Vector based topics tagging for videos #2649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9df62af
some refactoring and de-duping
shanbady 3af6f6f
adding topics collection name
shanbady dbc10a3
adding topic collection indexes
shanbady a81e8d8
adding method to embed topics
shanbady 67ec1b8
Merge branch 'main' into shanbady/video-topics
shanbady 37ee818
keeping old topic generation method
shanbady bfe4f0c
adding qdrant based topic generator
shanbady 2d43efa
fix test
shanbady d512d36
fix tests
shanbady 9f47dfc
adding score thresholding
shanbady 57d48f7
adding management command to sync topics and adding a cache mecahnism…
shanbady dd7af3c
fix test
shanbady 984d917
docstring update
shanbady f66ce0c
update docstrings
shanbady bb086bb
update topic query
shanbady 7c7e18f
adding topic sync tests
shanbady 1688c5c
switch default number of topics to 2
shanbady 88a8333
Merge branch 'main' into shanbady/video-topics
shanbady a0e34f9
test for cached embedding
shanbady aca1034
relocating import and making test topics a fixture
shanbady fe3b12e
fixing mock
shanbady File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
27 changes: 27 additions & 0 deletions
27
vector_search/management/commands/sync_topic_embeddings.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| """Management command to update or create the topics collection in Qdrant""" | ||
|
|
||
| from django.core.management.base import BaseCommand, CommandError | ||
|
|
||
| from main.utils import clear_search_cache, now_in_utc | ||
| from vector_search.tasks import sync_topics | ||
|
|
||
|
|
||
| class Command(BaseCommand): | ||
| """Syncs embeddings for topics in Qdrant""" | ||
|
|
||
| help = "update or create the topics collection in Qdrant" | ||
|
|
||
| def handle(self, *args, **options): # noqa: ARG002 | ||
| """Sync the topics collection""" | ||
| task = sync_topics.apply() | ||
| self.stdout.write("Waiting on task...") | ||
| start = now_in_utc() | ||
| error = task.get() | ||
| if error: | ||
| msg = f"Geenerate embeddings errored: {error}" | ||
| raise CommandError(msg) | ||
| clear_search_cache() | ||
| total_seconds = (now_in_utc() - start).total_seconds() | ||
| self.stdout.write( | ||
| f"Embeddings generated and stored, took {total_seconds} seconds" | ||
| ) |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to the top of the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment about circular import above