Skip to main content

PyMongo integration with VoyageAI for multimodal embedding

Project description

PyMongo-VoyageAI

PyMongo integration with VoyageAI for multimodal embedding.

Installation

pip install --pre pymongo-voyageai

Quickstart

Obtain an API key for VoyageAI.

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.0a0.tar.gz (15.5 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.0a0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file pymongo_voyageai-0.1.0a0.tar.gz.

File metadata

  • Download URL: pymongo_voyageai-0.1.0a0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pymongo_voyageai-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 f364b620987c943af3b6075529a7f5eb7472e0d6da276fb68f42c1ade192b287
MD5 ce450ecc91eab6bb054548dde5b27879
BLAKE2b-256 6ff7e5062066bf1b860ceb399ba1e4bb904f01a3a04886c0288908d78f39721d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymongo_voyageai-0.1.0a0.tar.gz:

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

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-0.1.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for pymongo_voyageai-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ddbf32b7e2c24d875bfec8923e787c2a999a820f7d6f44c91b46b01422b0f39
MD5 6c0f72d124cfaab362b52d09a2c774b3
BLAKE2b-256 035cc0005910083ba0df97fb93cf857390e0f80dac60faefdd1058c0cee92d5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymongo_voyageai-0.1.0a0-py3-none-any.whl:

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

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