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.5.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.5.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for llama_index_tools_requests-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a15b0bfd928f4a37e02bea0d5c5595cb5a49085f3e112be43a653035dfc35ca3
MD5 6c9b155e25801a4173a4bbfb39f6aae6
BLAKE2b-256 6c330afbaa9bee75dc726c9d17d3d87a615e637d64137d1a94bb6e4f4c35c201

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_tools_requests-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7b75c18b247a6908d6e49f45d74274cc7b9c8c8d66829974859aca8cf0da173
MD5 74e8ecc8d79583580205c0c83d867823
BLAKE2b-256 da6cffbe5f872836190ceaf159c7bcaa63bc4dd89e07a35ce32cda13a9e12a05

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