Name | llama-index-tools-openapi JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | llama-index tools openapi integration |
upload_time | 2024-08-22 03:24:15 |
maintainer | ajhofmann |
docs_url | None |
author | Your Name |
requires_python | <4.0,>=3.8.1 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# OpenAPI Tool
```bash
pip install llama-index-tools-openapi
```
This tool loads an OpenAPI spec and allow the Agent to retrieve endpoints and details about endpoints. The RequestsToolSpec can also be loaded into the agent to allow the agent to hit the necessary endpoints with a REST request.
## Usage
This tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-openapi/examples/openapi_and_requests.ipynb)
Here's an example usage of the OpenAPIToolSpec.
```python
from llama_index.tools.openapi import OpenAPIToolSpec
from llama_index.agent.openai import OpenAIAgent
f = requests.get(
"https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/openai.com/1.2.0/openapi.yaml"
).text
open_api_spec = yaml.safe_load(f)
# OR
open_spec = OpenAPIToolSpec(
url="https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/openai.com/1.2.0/openapi.yaml"
)
tool_spec = OpenAPIToolSpec(open_api_spec)
agent = OpenAIAgent.from_tools(tool_spec.to_tool_list())
agent.chat("What is the base url for the API")
agent.chat("What parameters does the x endpoint need?")
```
`load_openapi_spec`: Returns the parsed OpenAPI spec that the class was initialized with
This loader is designed to be used as a way to load data as a Tool in a Agent.
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-tools-openapi",
"maintainer": "ajhofmann",
"docs_url": null,
"requires_python": "<4.0,>=3.8.1",
"maintainer_email": null,
"keywords": null,
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/ff/14/e11e6e7b9cf063c790c69510d2a687daa539e3aface64808e3efa7640b0e/llama_index_tools_openapi-0.2.0.tar.gz",
"platform": null,
"description": "# OpenAPI Tool\n\n```bash\npip install llama-index-tools-openapi\n```\n\nThis tool loads an OpenAPI spec and allow the Agent to retrieve endpoints and details about endpoints. The RequestsToolSpec can also be loaded into the agent to allow the agent to hit the necessary endpoints with a REST request.\n\n## Usage\n\nThis tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-openapi/examples/openapi_and_requests.ipynb)\n\nHere's an example usage of the OpenAPIToolSpec.\n\n```python\nfrom llama_index.tools.openapi import OpenAPIToolSpec\nfrom llama_index.agent.openai import OpenAIAgent\n\nf = requests.get(\n \"https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/openai.com/1.2.0/openapi.yaml\"\n).text\nopen_api_spec = yaml.safe_load(f)\n# OR\nopen_spec = OpenAPIToolSpec(\n url=\"https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/openai.com/1.2.0/openapi.yaml\"\n)\n\n\ntool_spec = OpenAPIToolSpec(open_api_spec)\n\nagent = OpenAIAgent.from_tools(tool_spec.to_tool_list())\n\nagent.chat(\"What is the base url for the API\")\nagent.chat(\"What parameters does the x endpoint need?\")\n```\n\n`load_openapi_spec`: Returns the parsed OpenAPI spec that the class was initialized with\n\nThis loader is designed to be used as a way to load data as a Tool in a Agent.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index tools openapi integration",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9714ff94375a82d5a537cfa6600e681cf295cea3f638a7dec182e6abc6b011f1",
"md5": "b88a2db72834fa804df494b5068678ff",
"sha256": "f23a6201562d17190a5d39f37018563078cacc2354b4b9bd10514bd84dd6e217"
},
"downloads": -1,
"filename": "llama_index_tools_openapi-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b88a2db72834fa804df494b5068678ff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8.1",
"size": 3582,
"upload_time": "2024-08-22T03:24:14",
"upload_time_iso_8601": "2024-08-22T03:24:14.254606Z",
"url": "https://files.pythonhosted.org/packages/97/14/ff94375a82d5a537cfa6600e681cf295cea3f638a7dec182e6abc6b011f1/llama_index_tools_openapi-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ff14e11e6e7b9cf063c790c69510d2a687daa539e3aface64808e3efa7640b0e",
"md5": "bc31a9e25bc37dfb70a8baeec078850e",
"sha256": "0e47afb44a030b1ff7ffeb1d9e31a7414f0f30c6933e26708a0b97f271a6a30d"
},
"downloads": -1,
"filename": "llama_index_tools_openapi-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "bc31a9e25bc37dfb70a8baeec078850e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8.1",
"size": 3286,
"upload_time": "2024-08-22T03:24:15",
"upload_time_iso_8601": "2024-08-22T03:24:15.904185Z",
"url": "https://files.pythonhosted.org/packages/ff/14/e11e6e7b9cf063c790c69510d2a687daa539e3aface64808e3efa7640b0e/llama_index_tools_openapi-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-22 03:24:15",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-tools-openapi"
}