Skip to main content

llama-index tools requests integration

Project description

Requests Tool

This tool provides the agent the ability to make HTTP requests. It can be combined with the OpenAPIToolSpec to interface with an OpenAPI server.

For security reasons, you must specify the hostname for the headers that you wish to provide. See here for an example

Usage

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

Here's an example usage of the RequestsToolSpec.

from llama_index.tools.requests import RequestsToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

domain_headers = {
    "api.openai.com": {
        "Authorization": "Bearer sk-your-key",
        "Content-Type": "application/json",
    }
}

tool_spec = RequestsToolSpec(domain_headers=domain_headers)

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

print(await agent.run("<query>"))

get_request: Performs a get request against the URL post_request: Performs a post request against the URL patch_request: Performs a patch request against the URL

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_requests-0.6.0.tar.gz (4.6 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_requests-0.6.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_requests-0.6.0.tar.gz.

File metadata

  • Download URL: llama_index_tools_requests-0.6.0.tar.gz
  • Upload date:
  • Size: 4.6 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_requests-0.6.0.tar.gz
Algorithm Hash digest
SHA256 7dfa301fa867c6c0263320bec6ddd2a3a46e1d48664b910bc6d94db9a60b9e14
MD5 35241421055fb3fb77ad9aa90e83d2c4
BLAKE2b-256 b88dc43f535a1cd20e5b1f940c6ca0da2a4eb4852d1b77eb088efda105166e91

See more details on using hashes here.

File details

Details for the file llama_index_tools_requests-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_tools_requests-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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_requests-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb364da0cead2a6086e707b68d6cf41c839e88daf97a391b35c1026f3e3c430e
MD5 c47c56f94e97313afc31d19d4102c8be
BLAKE2b-256 1a47cb76b71090052ad4717029bc0b961beacec794cd7b7494b2a00338345195

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