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

Upgrade MongoDB Atlas vector search integration to use vectorSearch type #218

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Dec 5, 2024

Change log

  • upgrades the MongoDB Atlas vector search integration to use the generally available vectorSearch type rather than the beta knnVector type
  • fix bug with similarity queries on grouped datasets

Example usage

export FIFTYONE_DATABASE_NAME=fiftyone
export FIFTYONE_DATABASE_URI='mongodb+srv://$USERNAME:$PASSWORD@$NAME.mongodb.net/?retryWrites=true&w=majority'
import fiftyone as fo
import fiftyone.zoo as foz
import fiftyone.brain as fob

dataset = foz.load_zoo_dataset("quickstart-groups")

view = dataset.select_group_slices("left")
index = fob.compute_similarity(
    view,
    model="clip-vit-base32-torch",
    brain_key="img_sim",
    backend="mongodb",
    embeddings="embeddings",
)

assert index.ready

print(index.total_index_size)  # 200

view = dataset.sort_by_similarity(dataset.first().id, k=5)

view = dataset.sort_by_similarity("kites high in the sky", k=5)

@brimoor brimoor added the bug Bug fixes label Dec 5, 2024
@brimoor brimoor requested a review from allenleetc December 5, 2024 06:09
Copy link
Contributor

@allenleetc allenleetc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

Tested with grouped image dataset. Search is fixed when searching the original grouped dataset, both in-App or via SDK. Searching a flattened view (eg generated via dataset.select_group_slices() ) fails with a different, probably unrelated, error.

@brimoor brimoor merged commit 858d00d into develop Dec 13, 2024
5 checks passed
@brimoor brimoor deleted the bug/atlas-vector-search branch December 13, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants