Skip to main content

VectorDB Tool

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

Usage

from llama_index.tools.vector_db import VectorDB
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
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 = FunctionAgent(
    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
                ),
            )
        }
    ),
    llm=OpenAI(model="gpt-4.1"),
)

print(
    await agent.run("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.

Metadata

Release files for llama-index-tools-vector-db 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-tools-vector-db 0.6.0
File Size Uploaded Provenance Actions
llama_index_tools_vector_db-0.6.0.tar.gz 4.2 kB Without provenance Details for llama_index_tools_vector_db-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-vector-db 0.6.0
File Interpreter ABI Platform Actions
llama_index_tools_vector_db-0.6.0-py3-none-any.whl Python 3 none any Details for llama_index_tools_vector_db-0.6.0-py3-none-any.whl

Total release size: 8.0 kB

Release files / llama_index_tools_vector_db-0.6.0.tar.gz

Download URL llama_index_tools_vector_db-0.6.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dc9bea8dbcdb94a43acd807008f9a6c13c1d42bce2bf11c65a050bd24ab17738
BLAKE2b-256 checksum
How to use checksums
b30e43814a52a39255ef3442cf7d11d927fe2652ec20ed3fd0e412861cfe9a4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_tools_vector_db-0.6.0-py3-none-any.whl

Download URL llama_index_tools_vector_db-0.6.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66afae64f5dc35c8b8db3cf32a5345d84a2938199356b90cec5b908c323cd18b
BLAKE2b-256 checksum
How to use checksums
a29fd314077cc218513cf21606e7c6d8efda08b75d9c279e2597cbcbecc7083e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-tools-vector-db 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page