Skip to main content

PyMongo integration with VoyageAI for multimodal embedding

Project description

PyMongo-VoyageAI-Multimodal

PyMongo integration with VoyageAI for multimodal embedding.

Installation

Requires Python 3.10+.

pip install --pre pymongo-voyageai-multimodal

Quickstart

Obtain an API key for VoyageAI.

from pymongo_voyageai_multimodal 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_multimodal-0.1.1.tar.gz (15.6 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_multimodal-0.1.1-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file pymongo_voyageai_multimodal-0.1.1.tar.gz.

File metadata

File hashes

Hashes for pymongo_voyageai_multimodal-0.1.1.tar.gz
Algorithm Hash digest
SHA256 79a227bea8571c4d63766159d4a6890e825754af61deada4b38c7743423188b1
MD5 b5065d078ec207aad30e64180b57e21a
BLAKE2b-256 48f2d09bffd52b5ced84bc22a83d15477f4a839de3b2144b198ed1f5d3d190c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymongo_voyageai_multimodal-0.1.1.tar.gz:

Publisher: release-python.yml on mongodb-labs/pymongo-voyageai-multimodal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymongo_voyageai_multimodal-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pymongo_voyageai_multimodal-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee54bdf231dd725fdb50c091d4a4ac88c2b7e8b837e75d34922ccd358839724f
MD5 80fbf76a257215146e9e1b42eb3e47d5
BLAKE2b-256 22705ea2cdb9f529f83a54635524b08b74736a22868cd2728d2aee0a9f33c58f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymongo_voyageai_multimodal-0.1.1-py3-none-any.whl:

Publisher: release-python.yml on mongodb-labs/pymongo-voyageai-multimodal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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