Metadata-Version: 2.1
Name: llama-index-readers-graphql
Version: 0.0.1
Summary: llama-index readers graphql integration
License: MIT
Author: Your Name
Author-email: you@example.com
Requires-Python: >=3.8.1,<3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: gql (>=3.5.0,<4.0.0)
Requires-Dist: llama-index-core (>=0.9.32,<0.10.0)
Requires-Dist: requests-toolbelt (>=1.0.0,<2.0.0)
Description-Content-Type: text/markdown

# GraphQL Loader

This loader loads documents via GraphQL queries from a GraphQL endpoint.
The user specifies a GraphQL endpoint URL with optional credentials to initialize the reader.
By declaring the GraphQL query and optional variables (parameters) the loader can fetch the nested result docs.

## Usage

Here's an example usage of the GraphQLReader.
You can test out queries directly [on the site](https://countries.trevorblades.com/)

```python
from llama_index import download_loader
import os

GraphQLReader = download_loader("GraphQLReader")

uri = "https://countries.trevorblades.com/"
headers = {}
query = """
    query getContinents {
        continents {
            code
            name
        }
    }
"""
reader = GraphQLReader(uri, headers)
documents = reader.query(query, variables={})
```

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/emptycrown/llama-hub/tree/main) for examples.

It uses the [gql GraphQL library](https://pypi.org/project/gql/) for the GraphQL queries.

