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
Built Distribution
File details
Details for the file llama_index_readers_couchbase-0.2.0.tar.gz
.
File metadata
- Download URL: llama_index_readers_couchbase-0.2.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02610de47597dcb8f85aa7b31562b2a8aa5f43b0b9c9717b2a39658522540199 |
|
MD5 | a5a1f46b5bf244f5dcf77f41e69ee62f |
|
BLAKE2b-256 | 126bf9c622f5eabbdd7e84abefbf2d1ebfc7ce7a820fd8702a5ce2637a4ac809 |
File details
Details for the file llama_index_readers_couchbase-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_readers_couchbase-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17e9e1592dfe01135fa364384a0b44f2764efec5a795ae1e6207e843e752118d |
|
MD5 | b037c883992bb1f4c68a5c41d5cd8b9f |
|
BLAKE2b-256 | ef3e820f536e2c7eddff2d9499b99a770a68f96433020b0ed2db8b0054caa92f |