PyMongo integration with VoyageAI for multimodal embedding
Project description
PyMongo-VoyageAI
PyMongo integration with VoyageAI for multimodal embedding.
Quickstart
from pymongo_voyageai import PyMongoVoyageAI
# Create our client.
client = PyMongoVoyageAI(
voyageai_api_key=os.environ["VOYAGE_API_KEY"],
mongo_connection_string=os.environ["MONGODB_URI"],
s3_bucket_name="<my-bucket-name>",
collection_name="test",
database_name="tests",
)
# Load data from a pdf url.
url = "https://www.fdrlibrary.org/documents/356632/390886/readingcopy.pdf"
images = client.url_to_images(url)
resp = client.add_documents(images)
# Wait for the vector search index to update.
client.wait_for_indexing()
# Query the embeddings, extracting the images.
query = "The consequences of a dictator's peace"
data = client.similarity_search(query, extract_images=True)
# Display the best image match.
data[0]["inputs"][0].image.show()
# Clean up and close the client.
client.delete_many({})
client.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymongo_voyageai-0.1.0.dev0.tar.gz.
File metadata
- Download URL: pymongo_voyageai-0.1.0.dev0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c328c9f1bfdb7d265b369ce85f54ec4996b8405859524b8b9df70b218dfa337
|
|
| MD5 |
afd58cbb08b9ee75c5e9a9bff610b322
|
|
| BLAKE2b-256 |
44b764f4aee2061960e27646d2576302db18ece078f306cbb76cecc02e8d00fe
|
File details
Details for the file pymongo_voyageai-0.1.0.dev0-py3-none-any.whl.
File metadata
- Download URL: pymongo_voyageai-0.1.0.dev0-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea8c78f8d8d5f1485ecc37c874bb97afe69b8d51ef362ced5a1541c0cf640f20
|
|
| MD5 |
96fc9ee95f55e19514fa1d61af96c801
|
|
| BLAKE2b-256 |
c405294988bff51457949792173b9e81d6742bd56aabe8a0adcce77bd32b4614
|