Skip to main content

llama-index tools graphql integration

Project description

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.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

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

agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

await agent.run(
    "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.

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

llama_index_tools_graphql-0.5.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_graphql-0.5.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_graphql-0.5.0.tar.gz.

File metadata

  • Download URL: llama_index_tools_graphql-0.5.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_graphql-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5a2fb09ab2b62b1da1fd0d9c4ba512ff5afcd2836e02290aa1ebab35ada5d887
MD5 15e1e5594bf383625ec5bbd8c13c8082
BLAKE2b-256 c3ae820d093a851cdad5f89d0542c5242ccf9745ad1213aced21bb6f9945fc2e

See more details on using hashes here.

File details

Details for the file llama_index_tools_graphql-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_tools_graphql-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_graphql-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67c9465f0d624fdd79f96e2e2492a098761434758f2b6210a6a1fcf51018e0eb
MD5 5c68a44279832e6d0784bab983e7bbf2
BLAKE2b-256 efe7f6470222203ed45f594149810da6c6c7c7532d1fe9e6f3d9a0a42e63705b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page