Skip to main content

An integration package connecting MongoDB and GigaChain

Project description

langchain-mongodb

Installation

pip install -U langchain-mongodb

Usage

Using MongoDBAtlasVectorSearch

from langchain_mongodb import MongoDBAtlasVectorSearch

# Pull MongoDB Atlas URI from environment variables
MONGODB_ATLAS_CLUSTER_URI = os.environ.get("MONGODB_ATLAS_CLUSTER_URI")

DB_NAME = "langchain_db"
COLLECTION_NAME = "test"
ATLAS_VECTOR_SEARCH_INDEX_NAME = "index_name"
MONGODB_COLLECTION = client[DB_NAME][COLLECTION_NAME]

# Create the vector search via `from_connection_string`
vector_search = MongoDBAtlasVectorSearch.from_connection_string(
    MONGODB_ATLAS_CLUSTER_URI,
    DB_NAME + "." + COLLECTION_NAME,
    OpenAIEmbeddings(disallowed_special=()),
    index_name=ATLAS_VECTOR_SEARCH_INDEX_NAME,
)

# Initialize MongoDB python client
client = MongoClient(MONGODB_ATLAS_CLUSTER_URI)
# Create the vector search via instantiation
vector_search_2 = MongoDBAtlasVectorSearch(
    collection=MONGODB_COLLECTION,
    embeddings=OpenAIEmbeddings(disallowed_special=()),
    index_name=ATLAS_VECTOR_SEARCH_INDEX_NAME,
)

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

gigachain_mongodb-0.1.8.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

gigachain_mongodb-0.1.8-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file gigachain_mongodb-0.1.8.tar.gz.

File metadata

  • Download URL: gigachain_mongodb-0.1.8.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/23.5.0

File hashes

Hashes for gigachain_mongodb-0.1.8.tar.gz
Algorithm Hash digest
SHA256 0b66146137bf84ddc909b409833a30a44a1311aaabc67e7f55bc007819cdf171
MD5 6ce600bc19ad04964a8110a779811536
BLAKE2b-256 a2768d89b95c3d4b00e0426610cc6e7815db9525665698b783389d8fe8d227fa

See more details on using hashes here.

File details

Details for the file gigachain_mongodb-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for gigachain_mongodb-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a3b41b15edc5c7aec147c08e5ec7d5c629a8d710b64240df6b0287c6b7cd6632
MD5 b6830732a4adc1622d7c9c99e98bfd43
BLAKE2b-256 b4ef9ff309b01fb94e6368c124968c2d53da3f7b6606638061c25424a54814b6

See more details on using hashes here.

Supported by

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