Last active
October 23, 2024 20:45
-
-
Save hweller1/414561436db076beaeaef37f740caf4a 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
| import os | |
| import openai | |
| embedding = openai.Embedding.create(input="test query", model="text-embedding-ada-002").data[0].embedding | |
| pipeline = [ | |
| { | |
| "$vectorSearch": { | |
| "index":'bson_vector_index', | |
| "path": "plot_embedding", | |
| "queryVector": embedding, | |
| "limit": 10, | |
| "numCandidates": 100, | |
| }, | |
| }, | |
| { | |
| "$project": {"plot_embedding": 0} | |
| } | |
| ] | |
| docs = list(coll.aggregate(pipeline)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment