Created
March 11, 2024 01:29
-
-
Save davidmezzetti/28b4e08002259ac7b7a66b8f6d1bbfdc to your computer and use it in GitHub Desktop.
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
from txtai import Embeddings | |
data = [ | |
"US tops 5 million confirmed virus cases", | |
"Canada's last fully intact ice shelf has suddenly collapsed, forming a Manhattan-sized iceberg", | |
"Beijing mobilises invasion craft along coast as Taiwan tensions escalate", | |
"The National Park Service warns against sacrificing slower friends in a bear attack", | |
"Maine man wins $1M from $25 lottery ticket", | |
"Make huge profits without work, earn up to $100,000 a day" | |
] | |
# Create an embeddings | |
embeddings = Embeddings( | |
path="mixedbread-ai/mxbai-embed-2d-large-v1", | |
dimensionality=384, | |
content=True | |
) | |
embeddings.index(data) | |
# Run an embeddings search | |
embeddings.search("feel good story") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment