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.agent.openai 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.
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
Built Distribution
File details
Details for the file llama_index_tools_graphql-0.3.0.tar.gz
.
File metadata
- Download URL: llama_index_tools_graphql-0.3.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bd5e8ea5ba1dfecf426fb759ea5699a767c83262aa12446d0f6393241ff2289 |
|
MD5 | bb0f06d757919fe751974a73a7f6980d |
|
BLAKE2b-256 | 3592f8936efd33dcf9e438abc270b3dd47b61a2de895d6fedeba1a57b8335cd8 |
File details
Details for the file llama_index_tools_graphql-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_tools_graphql-0.3.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09df6b4c9eb702e2311327aae3233137f0c915e83f78e8bfa801415d006fbb97 |
|
MD5 | f81e7f00f735a3718a34ba490be4bc82 |
|
BLAKE2b-256 | ef9a5aee14f33272a8073160f695ab1bca889be6717d4f8a0783e82727ea0976 |