llama-index-tools-python-file


Namellama-index-tools-python-file JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
Summaryllama-index tools python_file integration
upload_time2024-11-17 23:02:29
maintainerajhofmann
docs_urlNone
authorYour Name
requires_python<4.0,>=3.9
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.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/f9/9a/bd0aca52a677f69ecdc99f5427641a9087838aff7eb73bae320971c9c695/llama_index_tools_python_file-0.3.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.3.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb3d00c5f4680d53590997299a4db8283a05ebfcb02c1a3ab5b89837ea23f7c3",
                "md5": "b8c0a2d57d36b783c170eac4021b4fd5",
                "sha256": "2fb6db7d842172ef27116d161991926d75306a17be806efed0814f8e67eb892d"
            },
            "downloads": -1,
            "filename": "llama_index_tools_python_file-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b8c0a2d57d36b783c170eac4021b4fd5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 2830,
            "upload_time": "2024-11-17T23:02:28",
            "upload_time_iso_8601": "2024-11-17T23:02:28.922328Z",
            "url": "https://files.pythonhosted.org/packages/fb/3d/00c5f4680d53590997299a4db8283a05ebfcb02c1a3ab5b89837ea23f7c3/llama_index_tools_python_file-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f99abd0aca52a677f69ecdc99f5427641a9087838aff7eb73bae320971c9c695",
                "md5": "0a92ece9f24e47dcf4dacdfff4707da3",
                "sha256": "0371a908b25671d634abc47853fd10d752ad3532cf1a500d4b089bbfcbc7ffbc"
            },
            "downloads": -1,
            "filename": "llama_index_tools_python_file-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0a92ece9f24e47dcf4dacdfff4707da3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 2540,
            "upload_time": "2024-11-17T23:02:29",
            "upload_time_iso_8601": "2024-11-17T23:02:29.708503Z",
            "url": "https://files.pythonhosted.org/packages/f9/9a/bd0aca52a677f69ecdc99f5427641a9087838aff7eb73bae320971c9c695/llama_index_tools_python_file-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-17 23:02:29",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-tools-python-file"
}
        
Elapsed time: 1.26595s