Skip to main content

llama-index readers couchbase integration

Project description

LlamaIndex Readers Integration: Couchbase

pip install llama-index-readers-couchbase

This loader loads documents from Couchbase cluster. The user specifies a Couchbase client or credentials to initialize the reader. They can specify the SQL++ query to fetch the relevant docs.

Usage

Here's an example usage of the CouchbaseReader.

import os

from llama_index.readers.couchbase import CouchbaseReader

connection_string = (
    "couchbase://localhost"  # valid Couchbase connection string
)
db_username = "<valid_database_user_with_read_access_to_bucket_with_data>"
db_password = "<password_for_database_user>"

# query is a valid SQL++ query that is passed to client.query()
query = """
    SELECT h.* FROM `travel-sample`.inventory.hotel h
        WHERE h.country = 'United States'
        LIMIT 5
        """

reader = CouchbaseLoader(
    connection_string=connection_string,
    db_username=db_username,
    db_password=db_password,
)

# It is also possible to pass an initialized Couchbase client to the document loader
# from couchbase.auth import PasswordAuthenticator  # noqa: E402
# from couchbase.cluster import Cluster # noqa: E402
# from couchbase.options import ClusterOptions # noqa: E402

# auth = PasswordAuthenticator(
#    db_username,
#    db_password,
# )

# couchbase_client = Cluster(connection_string, ClusterOptions(auth))
# reader = CouchbaseLoader(client=couchbase_client)

# fields to be written to the document
text_fields = ["name", "title", "address", "reviews"]

# metadata fields to be written to the document's metadata
metadata_fields = (["country", "city"],)

documents = reader.load_data(
    query=query, text_fields=text_fields, metadata_fields=metadata_fields
)

This loader is designed to be used as a way to load data into LlamaIndex. See here for examples.

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

llama_index_readers_couchbase-0.4.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file llama_index_readers_couchbase-0.4.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_couchbase-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0ef9a63ed81003c634b8eb8a2e9aa29edccb918d0a0cf2606c96857b8bf0681d
MD5 09f368954c1e593f8e94af1d0911795d
BLAKE2b-256 b9ea9087fc6814cab5356e2bf0562486b7a1e28a7ee4fc04ef4081dbf5049149

See more details on using hashes here.

File details

Details for the file llama_index_readers_couchbase-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_couchbase-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c1608ae619413d52cc67ccf7b02385bb4d5e8cd2f5da17dc721dc8960c253a9
MD5 eec457629b537abbe783af7406d3c686
BLAKE2b-256 7dbb88137023f240355d0bc15245846f04ffeeb631f28695ea11d78a50e264d5

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