llama-index-readers-wordlift


Namellama-index-readers-wordlift JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
Summaryllama-index readers wordlift integration
upload_time2025-07-30 20:52:58
maintainermsftwarelab
docs_urlNone
authorNone
requires_python<4.0,>=3.9
licenseNone
keywords graphql knowledge graph seo structured data wordlift
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # WordLift Reader

```bash
pip install llama-index-readers-wordlift
```

The WordLift GraphQL Reader is a connector to fetch and transform data from a WordLift Knowledge Graph using your the WordLift Key. The connector provides a convenient way to load data from WordLift using a GraphQL query and transform it into a list of documents for further processing.

## Usage

To use the WordLift GraphQL Reader, follow the steps below:

1. Set up the necessary configuration options, such as the API endpoint, headers, query, fields, and configuration options (make sure you have with you the [Wordlift Key](https://docs.wordlift.io/pages/key-concepts/#wordlift-key)).
2. Create an instance of the `WordLiftLoader` class, passing in the configuration options.
3. Use the `load_data` method to fetch and transform the data.
4. Process the loaded documents as needed.

Here's an example of how to use the WordLift GraphQL Reader:

```python
import json
from llama_index.core import VectorStoreIndex
from llama_index.core import Document
from langchain.llms import OpenAI
from llama_index.readers.wordlift import WordLiftLoader

# Set up the necessary configuration options
endpoint = "https://api.wordlift.io/graphql"
headers = {
    "Authorization": "<YOUR_WORDLIFT_KEY>",
    "Content-Type": "application/json",
}

query = """
# Your GraphQL query here
"""
fields = "<YOUR_FIELDS>"
config_options = {
    "text_fields": ["<YOUR_TEXT_FIELDS>"],
    "metadata_fields": ["<YOUR_METADATA_FIELDS>"],
}
# Create an instance of the WordLiftLoader
reader = WordLiftLoader(endpoint, headers, query, fields, config_options)

# Load the data
documents = reader.load_data()

# Convert the documents
converted_doc = []
for doc in documents:
    converted_doc_id = json.dumps(doc.doc_id)
    converted_doc.append(
        Document(
            text=doc.text,
            doc_id=converted_doc_id,
            embedding=doc.embedding,
            doc_hash=doc.doc_hash,
            extra_info=doc.extra_info,
        )
    )

# Create the index and query engine
index = VectorStoreIndex.from_documents(converted_doc)
query_engine = index.as_query_engine()

# Perform a query
result = query_engine.query("<YOUR_QUERY>")

# Process the result as needed
logging.info("Result: %s", result)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-readers-wordlift",
    "maintainer": "msftwarelab",
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "graphql, knowledge graph, seo, structured data, wordlift",
    "author": null,
    "author_email": "Your Name <you@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/2f/f8/5246b5a7391dce1494a102860c74f39b00808db52771eebf9d987d44a852/llama_index_readers_wordlift-0.4.0.tar.gz",
    "platform": null,
    "description": "# WordLift Reader\n\n```bash\npip install llama-index-readers-wordlift\n```\n\nThe WordLift GraphQL Reader is a connector to fetch and transform data from a WordLift Knowledge Graph using your the WordLift Key. The connector provides a convenient way to load data from WordLift using a GraphQL query and transform it into a list of documents for further processing.\n\n## Usage\n\nTo use the WordLift GraphQL Reader, follow the steps below:\n\n1. Set up the necessary configuration options, such as the API endpoint, headers, query, fields, and configuration options (make sure you have with you the [Wordlift Key](https://docs.wordlift.io/pages/key-concepts/#wordlift-key)).\n2. Create an instance of the `WordLiftLoader` class, passing in the configuration options.\n3. Use the `load_data` method to fetch and transform the data.\n4. Process the loaded documents as needed.\n\nHere's an example of how to use the WordLift GraphQL Reader:\n\n```python\nimport json\nfrom llama_index.core import VectorStoreIndex\nfrom llama_index.core import Document\nfrom langchain.llms import OpenAI\nfrom llama_index.readers.wordlift import WordLiftLoader\n\n# Set up the necessary configuration options\nendpoint = \"https://api.wordlift.io/graphql\"\nheaders = {\n    \"Authorization\": \"<YOUR_WORDLIFT_KEY>\",\n    \"Content-Type\": \"application/json\",\n}\n\nquery = \"\"\"\n# Your GraphQL query here\n\"\"\"\nfields = \"<YOUR_FIELDS>\"\nconfig_options = {\n    \"text_fields\": [\"<YOUR_TEXT_FIELDS>\"],\n    \"metadata_fields\": [\"<YOUR_METADATA_FIELDS>\"],\n}\n# Create an instance of the WordLiftLoader\nreader = WordLiftLoader(endpoint, headers, query, fields, config_options)\n\n# Load the data\ndocuments = reader.load_data()\n\n# Convert the documents\nconverted_doc = []\nfor doc in documents:\n    converted_doc_id = json.dumps(doc.doc_id)\n    converted_doc.append(\n        Document(\n            text=doc.text,\n            doc_id=converted_doc_id,\n            embedding=doc.embedding,\n            doc_hash=doc.doc_hash,\n            extra_info=doc.extra_info,\n        )\n    )\n\n# Create the index and query engine\nindex = VectorStoreIndex.from_documents(converted_doc)\nquery_engine = index.as_query_engine()\n\n# Perform a query\nresult = query_engine.query(\"<YOUR_QUERY>\")\n\n# Process the result as needed\nlogging.info(\"Result: %s\", result)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "llama-index readers wordlift integration",
    "version": "0.4.0",
    "project_urls": null,
    "split_keywords": [
        "graphql",
        " knowledge graph",
        " seo",
        " structured data",
        " wordlift"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d5f62252424a29052863be54a699fbe2d36a329292433bf9d509a03195e483bd",
                "md5": "8caa6530ffa81f8c24ff9044b7aff932",
                "sha256": "84441bbc4c660dfa091f31cc4e9407683b8bfb511531ce3c1145dc790041d58a"
            },
            "downloads": -1,
            "filename": "llama_index_readers_wordlift-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8caa6530ffa81f8c24ff9044b7aff932",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 6031,
            "upload_time": "2025-07-30T20:52:57",
            "upload_time_iso_8601": "2025-07-30T20:52:57.956528Z",
            "url": "https://files.pythonhosted.org/packages/d5/f6/2252424a29052863be54a699fbe2d36a329292433bf9d509a03195e483bd/llama_index_readers_wordlift-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2ff85246b5a7391dce1494a102860c74f39b00808db52771eebf9d987d44a852",
                "md5": "6a40483f826fc2357980e7dd4703028c",
                "sha256": "71dba2158fc2c693ea0f779c5e7d42d136f556dfdc4deaacef172bd03c1fbec2"
            },
            "downloads": -1,
            "filename": "llama_index_readers_wordlift-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6a40483f826fc2357980e7dd4703028c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 6390,
            "upload_time": "2025-07-30T20:52:58",
            "upload_time_iso_8601": "2025-07-30T20:52:58.794395Z",
            "url": "https://files.pythonhosted.org/packages/2f/f8/5246b5a7391dce1494a102860c74f39b00808db52771eebf9d987d44a852/llama_index_readers_wordlift-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-30 20:52:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-readers-wordlift"
}
        
Elapsed time: 0.60617s