llama-index-readers-couchbase


Namellama-index-readers-couchbase JSON
Version 0.1.3 PyPI version JSON
download
home_page
Summaryllama-index readers couchbase integration
upload_time2024-02-21 19:38:44
maintainernithishr
docs_urlNone
authorYour Name
requires_python>=3.8.1,<4.0
licenseMIT
keywords capella couchbase nosql
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LlamaIndex Readers Integration: 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.

```python
from llama_index.core.readers import download_loader
import os

CouchbaseLoader = download_loader("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](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent. See [here](https://github.com/run-llama/llama-hub/tree/main) for examples.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "llama-index-readers-couchbase",
    "maintainer": "nithishr",
    "docs_url": null,
    "requires_python": ">=3.8.1,<4.0",
    "maintainer_email": "",
    "keywords": "Capella,Couchbase,NoSQL",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/6e/8c/1412f77b5a4eb038759645c0f39822ea712a839eac32f6d488dac660aa90/llama_index_readers_couchbase-0.1.3.tar.gz",
    "platform": null,
    "description": "# LlamaIndex Readers Integration: Couchbase\n\nThis loader loads documents from Couchbase cluster.\nThe user specifies a Couchbase client or credentials to initialize the reader. They can specify the SQL++ query to\nfetch the relevant docs.\n\n## Usage\n\nHere's an example usage of the CouchbaseReader.\n\n```python\nfrom llama_index.core.readers import download_loader\nimport os\n\nCouchbaseLoader = download_loader(\"CouchbaseReader\")\n\nconnection_string = (\n    \"couchbase://localhost\"  # valid Couchbase connection string\n)\ndb_username = \"<valid_database_user_with_read_access_to_bucket_with_data>\"\ndb_password = \"<password_for_database_user>\"\n\n# query is a valid SQL++ query that is passed to client.query()\nquery = \"\"\"\n    SELECT h.* FROM `travel-sample`.inventory.hotel h\n        WHERE h.country = 'United States'\n        LIMIT 5\n        \"\"\"\n\nreader = CouchbaseLoader(\n    connection_string=connection_string,\n    db_username=db_username,\n    db_password=db_password,\n)\n\n# It is also possible to pass an initialized Couchbase client to the document loader\n# from couchbase.auth import PasswordAuthenticator  # noqa: E402\n# from couchbase.cluster import Cluster # noqa: E402\n# from couchbase.options import ClusterOptions # noqa: E402\n\n# auth = PasswordAuthenticator(\n#    db_username,\n#    db_password,\n# )\n\n# couchbase_client = Cluster(connection_string, ClusterOptions(auth))\n# reader = CouchbaseLoader(client=couchbase_client)\n\n# fields to be written to the document\ntext_fields = [\"name\", \"title\", \"address\", \"reviews\"]\n\n# metadata fields to be written to the document's metadata\nmetadata_fields = ([\"country\", \"city\"],)\n\ndocuments = reader.load_data(\n    query=query, text_fields=text_fields, metadata_fields=metadata_fields\n)\n```\n\nThis loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent. See [here](https://github.com/run-llama/llama-hub/tree/main) for examples.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index readers couchbase integration",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [
        "capella",
        "couchbase",
        "nosql"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f495465db518b4f691813ef11abacddc25b7fcbdef4399d68b4fb1ec20faf8eb",
                "md5": "f02eb0bfda22e6fe45bf7840c3fdd60f",
                "sha256": "c113c5682ab235d9167d5ebb8c0488d62f3ed5ad248bc5ac32023608ab8926db"
            },
            "downloads": -1,
            "filename": "llama_index_readers_couchbase-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f02eb0bfda22e6fe45bf7840c3fdd60f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<4.0",
            "size": 3582,
            "upload_time": "2024-02-21T19:38:42",
            "upload_time_iso_8601": "2024-02-21T19:38:42.650518Z",
            "url": "https://files.pythonhosted.org/packages/f4/95/465db518b4f691813ef11abacddc25b7fcbdef4399d68b4fb1ec20faf8eb/llama_index_readers_couchbase-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6e8c1412f77b5a4eb038759645c0f39822ea712a839eac32f6d488dac660aa90",
                "md5": "4737010cfc297fcfa11382fabc177715",
                "sha256": "20e7b483f836e9b3465b84f0ef4b492eb18e66f10a43bd5d61c3f11eb4d01d0f"
            },
            "downloads": -1,
            "filename": "llama_index_readers_couchbase-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4737010cfc297fcfa11382fabc177715",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<4.0",
            "size": 3268,
            "upload_time": "2024-02-21T19:38:44",
            "upload_time_iso_8601": "2024-02-21T19:38:44.229548Z",
            "url": "https://files.pythonhosted.org/packages/6e/8c/1412f77b5a4eb038759645c0f39822ea712a839eac32f6d488dac660aa90/llama_index_readers_couchbase-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-21 19:38:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-readers-couchbase"
}
        
Elapsed time: 0.25497s