Skip to content

Vanna

VannaPack #

Bases: BaseLlamaPack

Vanna AI pack.

Uses OpenAI and ChromaDB. Of course Vanna.AI allows you to connect to many more dbs and use more models - feel free to refer to their page for more details: https://vanna.ai/docs/snowflake-openai-vanna-vannadb.html

Source code in llama-index-packs/llama-index-packs-vanna/llama_index/packs/vanna/base.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
class VannaPack(BaseLlamaPack):
    """Vanna AI pack.

    Uses OpenAI and ChromaDB. Of course Vanna.AI allows you to connect to many more dbs
    and use more models - feel free to refer to their page for more details:
    https://vanna.ai/docs/snowflake-openai-vanna-vannadb.html

    """

    def __init__(
        self,
        openai_api_key: str,
        sql_db_url: str,
        **kwargs: Any,
    ) -> None:
        """Init params."""
        self.vanna_query_engine = VannaQueryEngine(
            openai_api_key=openai_api_key, sql_db_url=sql_db_url, **kwargs
        )

    def get_modules(self) -> Dict[str, Any]:
        """Get modules."""
        return {
            "vanna_query_engine": self.vanna_query_engine,
        }

    def run(self, *args: Any, **kwargs: Any) -> Any:
        """Run the pipeline."""
        return self.vanna_query_engine.query(*args, **kwargs)

get_modules #

get_modules() -> Dict[str, Any]

Get modules.

Source code in llama-index-packs/llama-index-packs-vanna/llama_index/packs/vanna/base.py
109
110
111
112
113
def get_modules(self) -> Dict[str, Any]:
    """Get modules."""
    return {
        "vanna_query_engine": self.vanna_query_engine,
    }

run #

run(*args: Any, **kwargs: Any) -> Any

Run the pipeline.

Source code in llama-index-packs/llama-index-packs-vanna/llama_index/packs/vanna/base.py
115
116
117
def run(self, *args: Any, **kwargs: Any) -> Any:
    """Run the pipeline."""
    return self.vanna_query_engine.query(*args, **kwargs)