Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymongo_voyageai-0.1.0.dev0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymongo_voyageai-0.1.0.dev0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

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

Hashes for pymongo_voyageai-0.1.0.dev0.tar.gz
Algorithm Hash digest
SHA256 7c328c9f1bfdb7d265b369ce85f54ec4996b8405859524b8b9df70b218dfa337
MD5 afd58cbb08b9ee75c5e9a9bff610b322
BLAKE2b-256 44b764f4aee2061960e27646d2576302db18ece078f306cbb76cecc02e8d00fe

See more details on using hashes here.

File details

Details for the file pymongo_voyageai-0.1.0.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for pymongo_voyageai-0.1.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea8c78f8d8d5f1485ecc37c874bb97afe69b8d51ef362ced5a1541c0cf640f20
MD5 96fc9ee95f55e19514fa1d61af96c801
BLAKE2b-256 c405294988bff51457949792173b9e81d6742bd56aabe8a0adcce77bd32b4614

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page