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.agent.openai import OpenAIAgent

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

tool_spec = RequestsToolSpec(domain_headers=domain_headers)

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

agent.chat("")

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.3.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for llama_index_tools_requests-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a2ba476c4cb6fea7add4030cfacdcf05f82e4fb4cfc28759837887d4b0cafefb
MD5 6ce101c68d6b056c8790101b8c7151bc
BLAKE2b-256 59a7ccb01f4994e57f02b4e5c58639e83421a9427e8e488225c5cb25d5b26af4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_tools_requests-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 151c682669c416f011b09e437037170d016208263fc7719da3b4e2557de4d683
MD5 53c5bd536a3ebbd5e36e3d35822cde52
BLAKE2b-256 c01ddca32e26c5252cace861732018f380a917369289be47b7757f9ff5ce51d1

See more details on using hashes here.

Supported by

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