Skip to main content

GraphQL Tool

This tool provides agents the ability to easily execute GraphQL queries against a server. The tool can be initialized with the server url and any required headers and thereafter perform queries against the server

Usage

This tool has a more extensive example usage documented in a Jupyter notebook here

Here's an example usage of the GraphQLToolSpec.

This tool works best when the Agent has access to the GraphQL schema for the server. See here for an example of using a tool with a file loader to create even more powerful Agents.

from llama_index.tools.graphql import GraphQLToolSpec
from llama_index.agent import OpenAIAgent

tool_spec = GraphQLToolSpec(
    url="https://spacex-production.up.railway.app/",
    headers={
        "content-type": "application/json",
    },
)

agent = OpenAIAgent.from_tools(tool_spec.to_tool_list())

agent.chat(
    "get the id, model, name and type of the Ships from the graphql endpoint"
)

graphql_request: Runs a GraphQL query against the configured server

This loader is designed to be used as a way to load data as a Tool in a Agent. See here for examples.

Metadata

Release files for flying-delta-tools-graphql 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flying-delta-tools-graphql 0.1.0
File Size Uploaded
flying_delta_tools_graphql-0.1.0.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flying-delta-tools-graphql 0.1.0
File Interpreter ABI Platform
flying_delta_tools_graphql-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.1 kB

Release files / flying_delta_tools_graphql-0.1.0.tar.gz

Download URL flying_delta_tools_graphql-0.1.0.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2e7f2426db4c3e25a9ec30282bd1f38332403a96236746f576812c610bcd4d71
BLAKE2b-256 checksum
How to use checksums
5f583a730872635c2d2b1a3b688a9902bbbcd880482576a2303cba7a3d602fcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Darwin/23.0.0

Release files / flying_delta_tools_graphql-0.1.0-py3-none-any.whl

Download URL flying_delta_tools_graphql-0.1.0-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
087295abff6c650f105dcc076597544e6194eb621e03e23e8dcd9b0a940446fe
BLAKE2b-256 checksum
How to use checksums
e3be23fca25af43365ecc06956e9772fbe4d1f03238adcc271992d665cbcbbae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Darwin/23.0.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page