llama-index-tools-vector-db


Namellama-index-tools-vector-db JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
Summaryllama-index tools vector_db integration
upload_time2024-08-22 07:42:11
maintainerjerryjliu
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.
            # VectorDB Tool

This tool wraps a VectorStoreIndex and enables a agent to call it with queries and filters to retrieve data.

## Usage

```python
from llama_index.tools.vector_db import VectorDB
from llama_index.agent.openai import OpenAIAgent
from llama_index.core.vector_stores import VectorStoreInfo
from llama_index.core import VectorStoreIndex

index = VectorStoreIndex(nodes=nodes)
tool_spec = VectorDB(index=index)
vector_store_info = VectorStoreInfo(
    content_info="brief biography of celebrities",
    metadata_info=[
        MetadataInfo(
            name="category",
            type="str",
            description="Category of the celebrity, one of [Sports, Entertainment, Business, Music]",
        ),
        MetadataInfo(
            name="country",
            type="str",
            description="Country of the celebrity, one of [United States, Barbados, Portugal]",
        ),
    ],
)

agent = OpenAIAgent.from_tools(
    tool_spec.to_tool_list(
        func_to_metadata_mapping={
            "auto_retrieve_fn": ToolMetadata(
                name="celebrity_bios",
                description=f"""\
            Use this tool to look up biographical information about celebrities.
            The vector database schema is given below:

            {vector_store_info.json()}

            {tool_spec.auto_retrieve_fn.__doc__}
        """,
                fn_schema=create_schema_from_function(
                    "celebrity_bios", tool_spec.auto_retrieve_fn
                ),
            )
        }
    ),
    verbose=True,
)

agent.chat("Tell me about two celebrities from the United States. ")
```

`auto_retrieve_fn`: Retrieves data from the index

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-vector-db",
    "maintainer": "jerryjliu",
    "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/08/52/c3daf39f041eda6e9236b6591fa74736f1df0e12888a3bab705cde30bd9a/llama_index_tools_vector_db-0.2.0.tar.gz",
    "platform": null,
    "description": "# VectorDB Tool\n\nThis tool wraps a VectorStoreIndex and enables a agent to call it with queries and filters to retrieve data.\n\n## Usage\n\n```python\nfrom llama_index.tools.vector_db import VectorDB\nfrom llama_index.agent.openai import OpenAIAgent\nfrom llama_index.core.vector_stores import VectorStoreInfo\nfrom llama_index.core import VectorStoreIndex\n\nindex = VectorStoreIndex(nodes=nodes)\ntool_spec = VectorDB(index=index)\nvector_store_info = VectorStoreInfo(\n    content_info=\"brief biography of celebrities\",\n    metadata_info=[\n        MetadataInfo(\n            name=\"category\",\n            type=\"str\",\n            description=\"Category of the celebrity, one of [Sports, Entertainment, Business, Music]\",\n        ),\n        MetadataInfo(\n            name=\"country\",\n            type=\"str\",\n            description=\"Country of the celebrity, one of [United States, Barbados, Portugal]\",\n        ),\n    ],\n)\n\nagent = OpenAIAgent.from_tools(\n    tool_spec.to_tool_list(\n        func_to_metadata_mapping={\n            \"auto_retrieve_fn\": ToolMetadata(\n                name=\"celebrity_bios\",\n                description=f\"\"\"\\\n            Use this tool to look up biographical information about celebrities.\n            The vector database schema is given below:\n\n            {vector_store_info.json()}\n\n            {tool_spec.auto_retrieve_fn.__doc__}\n        \"\"\",\n                fn_schema=create_schema_from_function(\n                    \"celebrity_bios\", tool_spec.auto_retrieve_fn\n                ),\n            )\n        }\n    ),\n    verbose=True,\n)\n\nagent.chat(\"Tell me about two celebrities from the United States. \")\n```\n\n`auto_retrieve_fn`: Retrieves data from the index\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 vector_db integration",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a8bd5e15356f7e8493f1bd4a7d06b9e755887ab6a80b6c95f35fee31cf894ae",
                "md5": "e5b93456d03cefa53cb0ea27e8e9e6af",
                "sha256": "737f683bda7e6f9154655e0f9b2979125ae4cd0a4cd719277e81f0b8c19e4d94"
            },
            "downloads": -1,
            "filename": "llama_index_tools_vector_db-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e5b93456d03cefa53cb0ea27e8e9e6af",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 2921,
            "upload_time": "2024-08-22T07:42:10",
            "upload_time_iso_8601": "2024-08-22T07:42:10.568615Z",
            "url": "https://files.pythonhosted.org/packages/3a/8b/d5e15356f7e8493f1bd4a7d06b9e755887ab6a80b6c95f35fee31cf894ae/llama_index_tools_vector_db-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0852c3daf39f041eda6e9236b6591fa74736f1df0e12888a3bab705cde30bd9a",
                "md5": "36afbb66916f8e16877207e10dacc632",
                "sha256": "30364d4961d21c88930462c29d666623f4216ab5a9f994eb44b0f23c8ff60ce2"
            },
            "downloads": -1,
            "filename": "llama_index_tools_vector_db-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "36afbb66916f8e16877207e10dacc632",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 2670,
            "upload_time": "2024-08-22T07:42:11",
            "upload_time_iso_8601": "2024-08-22T07:42:11.949567Z",
            "url": "https://files.pythonhosted.org/packages/08/52/c3daf39f041eda6e9236b6591fa74736f1df0e12888a3bab705cde30bd9a/llama_index_tools_vector_db-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 07:42:11",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-tools-vector-db"
}
        
Elapsed time: 0.31196s