Skip to content
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

Metadata filtering #124

Merged
merged 83 commits into from
Nov 20, 2024
Merged

Metadata filtering #124

merged 83 commits into from
Nov 20, 2024

Conversation

asg017
Copy link
Owner

@asg017 asg017 commented Oct 15, 2024

References #26 , requires #123 and #122

Work-in-progress, needs more feature work, bug fixing, docs, and tests.

create virtual table vec_movies using vec0(
  movie_id integer primary key,
  synopsis_embedding float[1024],
  genre text,
  num_reviews int,
  mean_rating float
);

select
  movie_id,
  title,
  genre,
  num_reviews,
  mean_rating,
  distance
from vec_movies
where synopsis_embedding match '[...]'
  and genre = 'scifi'
  and num_reviews between 100 and 500
  and mean_rating > 3.5
  and k = 5;
/*
┌──────────┬─────────────────────┬─────────┬─────────────┬──────────────────┬──────────┐
│ movie_id │        title        │  genre  │ num_reviews │   mean_rating    │ distance │
├──────────┼─────────────────────┼─────────┼─────────────┼──────────────────┼──────────┤
│ 13       │ 'The Matrix'        │ 'scifi' │ 423         │ 4.5              │ 2.5      │
│ 18       │ 'Inception'         │ 'scifi' │ 201         │ 5.0              │ 2.5      │
│ 21       │ 'Gravity'           │ 'scifi' │ 342         │ 4.0              │ 5.5      │
│ 22       │ 'Dune'              │ 'scifi' │ 451         │ 4.40000009536743 │ 6.5      │
│ 8        │ 'Blade Runner 2049' │ 'scifi' │ 301         │ 5.0              │ 7.5      │
└──────────┴─────────────────────┴─────────┴─────────────┴──────────────────┴──────────┘

@asg017 asg017 marked this pull request as ready for review November 20, 2024 05:47
@asg017 asg017 changed the title DRAFT: Metadata filtering Metadata filtering Nov 20, 2024
@asg017 asg017 changed the base branch from auxiliary to main November 20, 2024 08:30
@asg017 asg017 merged commit 352f953 into main Nov 20, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant