llama-index-tools-python-file


Namellama-index-tools-python-file JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
Summaryllama-index tools python_file integration
upload_time2024-08-22 07:38:13
maintainerajhofmann
docs_urlNone
authorYour Name
requires_python<4.0,>=3.8.1
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python File Tool

This tool loads a python file and extracts function names, arguments and descriptions automatically. This tool is particular useful for automatically creating custom Tool Specs when you already have well documented python functions.

## Usage

This tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/emptycrown/llama-hub/tree/main/llama_hub/tools/notebooks/create_a_tool.ipynb)

Here's an example usage of the PythonFileToolSpec.

```python
from llama_index.tools.python_file import PythonFileToolSpec
from llama_index.agent.openai import OpenAIAgent

pyfile = PythonFileToolSpec("./numpy_linalg.py")

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

agent.chat(
    """Load the eig, transpose and solve functions from the python file,
and then write a function definition using only builtin python types (List, float, Tuple)
with a short 5-10 line doc string tool prompts for the functions that only has a small description and arguments
"""
)
```

`function_definitions`: Get all of the function definitions from the Python file
`get_function`: Get a specific function definition from the Python file
`get_functions`: Get a list of functions from the python file

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-python-file",
    "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/36/93/808d400f885e0537b9562745b87e31a72707d1ae4c8202c3441ddb747fd3/llama_index_tools_python_file-0.2.0.tar.gz",
    "platform": null,
    "description": "# Python File Tool\n\nThis tool loads a python file and extracts function names, arguments and descriptions automatically. This tool is particular useful for automatically creating custom Tool Specs when you already have well documented python functions.\n\n## Usage\n\nThis tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/emptycrown/llama-hub/tree/main/llama_hub/tools/notebooks/create_a_tool.ipynb)\n\nHere's an example usage of the PythonFileToolSpec.\n\n```python\nfrom llama_index.tools.python_file import PythonFileToolSpec\nfrom llama_index.agent.openai import OpenAIAgent\n\npyfile = PythonFileToolSpec(\"./numpy_linalg.py\")\n\nagent = OpenAIAgent.from_tools(tool_spec.to_tool_list())\n\nagent.chat(\n    \"\"\"Load the eig, transpose and solve functions from the python file,\nand then write a function definition using only builtin python types (List, float, Tuple)\nwith a short 5-10 line doc string tool prompts for the functions that only has a small description and arguments\n\"\"\"\n)\n```\n\n`function_definitions`: Get all of the function definitions from the Python file\n`get_function`: Get a specific function definition from the Python file\n`get_functions`: Get a list of functions from the python file\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 python_file integration",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "30e7886f5a7f93b1fc8d12c5dbbf66f79988ac67db006cb36555950fbe750b21",
                "md5": "d6ec3bf146e3e2e1827dc397a64e5250",
                "sha256": "b2326234cdca653c449bc4ebcd86e46465004f0832436df681f631cf1a3710a4"
            },
            "downloads": -1,
            "filename": "llama_index_tools_python_file-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6ec3bf146e3e2e1827dc397a64e5250",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 2835,
            "upload_time": "2024-08-22T07:38:12",
            "upload_time_iso_8601": "2024-08-22T07:38:12.652881Z",
            "url": "https://files.pythonhosted.org/packages/30/e7/886f5a7f93b1fc8d12c5dbbf66f79988ac67db006cb36555950fbe750b21/llama_index_tools_python_file-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3693808d400f885e0537b9562745b87e31a72707d1ae4c8202c3441ddb747fd3",
                "md5": "e9b784659febc47b15218247ecfb936b",
                "sha256": "9ad4f65dd256bb35f599b8f5b849bf5d7cf30fc0d1a905f754165dac8ab3fa8e"
            },
            "downloads": -1,
            "filename": "llama_index_tools_python_file-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e9b784659febc47b15218247ecfb936b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 2575,
            "upload_time": "2024-08-22T07:38:13",
            "upload_time_iso_8601": "2024-08-22T07:38:13.839141Z",
            "url": "https://files.pythonhosted.org/packages/36/93/808d400f885e0537b9562745b87e31a72707d1ae4c8202c3441ddb747fd3/llama_index_tools_python_file-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 07:38:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-tools-python-file"
}
        
Elapsed time: 0.61361s