asksql 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- asksql-2.1.0/LICENSE +21 -0
- asksql-2.1.0/PKG-INFO +517 -0
- asksql-2.1.0/README.md +340 -0
- asksql-2.1.0/pyproject.toml +228 -0
- asksql-2.1.0/src/vanna/__init__.py +172 -0
- asksql-2.1.0/src/vanna/agents/__init__.py +7 -0
- asksql-2.1.0/src/vanna/capabilities/__init__.py +17 -0
- asksql-2.1.0/src/vanna/capabilities/agent_memory/__init__.py +21 -0
- asksql-2.1.0/src/vanna/capabilities/agent_memory/base.py +103 -0
- asksql-2.1.0/src/vanna/capabilities/agent_memory/models.py +53 -0
- asksql-2.1.0/src/vanna/capabilities/file_system/__init__.py +14 -0
- asksql-2.1.0/src/vanna/capabilities/file_system/base.py +71 -0
- asksql-2.1.0/src/vanna/capabilities/file_system/models.py +25 -0
- asksql-2.1.0/src/vanna/capabilities/sql_runner/__init__.py +13 -0
- asksql-2.1.0/src/vanna/capabilities/sql_runner/base.py +37 -0
- asksql-2.1.0/src/vanna/capabilities/sql_runner/models.py +13 -0
- asksql-2.1.0/src/vanna/components/__init__.py +92 -0
- asksql-2.1.0/src/vanna/components/base.py +11 -0
- asksql-2.1.0/src/vanna/components/rich/__init__.py +83 -0
- asksql-2.1.0/src/vanna/components/rich/containers/__init__.py +7 -0
- asksql-2.1.0/src/vanna/components/rich/containers/card.py +20 -0
- asksql-2.1.0/src/vanna/components/rich/data/__init__.py +9 -0
- asksql-2.1.0/src/vanna/components/rich/data/chart.py +17 -0
- asksql-2.1.0/src/vanna/components/rich/data/dataframe.py +93 -0
- asksql-2.1.0/src/vanna/components/rich/feedback/__init__.py +21 -0
- asksql-2.1.0/src/vanna/components/rich/feedback/badge.py +16 -0
- asksql-2.1.0/src/vanna/components/rich/feedback/icon_text.py +14 -0
- asksql-2.1.0/src/vanna/components/rich/feedback/log_viewer.py +41 -0
- asksql-2.1.0/src/vanna/components/rich/feedback/notification.py +19 -0
- asksql-2.1.0/src/vanna/components/rich/feedback/progress.py +37 -0
- asksql-2.1.0/src/vanna/components/rich/feedback/status_card.py +28 -0
- asksql-2.1.0/src/vanna/components/rich/feedback/status_indicator.py +14 -0
- asksql-2.1.0/src/vanna/components/rich/interactive/__init__.py +21 -0
- asksql-2.1.0/src/vanna/components/rich/interactive/button.py +95 -0
- asksql-2.1.0/src/vanna/components/rich/interactive/task_list.py +58 -0
- asksql-2.1.0/src/vanna/components/rich/interactive/ui_state.py +93 -0
- asksql-2.1.0/src/vanna/components/rich/specialized/__init__.py +7 -0
- asksql-2.1.0/src/vanna/components/rich/specialized/artifact.py +20 -0
- asksql-2.1.0/src/vanna/components/rich/text.py +16 -0
- asksql-2.1.0/src/vanna/components/simple/__init__.py +15 -0
- asksql-2.1.0/src/vanna/components/simple/image.py +15 -0
- asksql-2.1.0/src/vanna/components/simple/link.py +15 -0
- asksql-2.1.0/src/vanna/components/simple/text.py +11 -0
- asksql-2.1.0/src/vanna/core/__init__.py +193 -0
- asksql-2.1.0/src/vanna/core/_compat.py +19 -0
- asksql-2.1.0/src/vanna/core/agent/__init__.py +10 -0
- asksql-2.1.0/src/vanna/core/agent/agent.py +1407 -0
- asksql-2.1.0/src/vanna/core/agent/config.py +123 -0
- asksql-2.1.0/src/vanna/core/audit/__init__.py +28 -0
- asksql-2.1.0/src/vanna/core/audit/base.py +299 -0
- asksql-2.1.0/src/vanna/core/audit/models.py +131 -0
- asksql-2.1.0/src/vanna/core/component_manager.py +329 -0
- asksql-2.1.0/src/vanna/core/components.py +53 -0
- asksql-2.1.0/src/vanna/core/enhancer/__init__.py +11 -0
- asksql-2.1.0/src/vanna/core/enhancer/base.py +94 -0
- asksql-2.1.0/src/vanna/core/enhancer/default.py +118 -0
- asksql-2.1.0/src/vanna/core/enricher/__init__.py +10 -0
- asksql-2.1.0/src/vanna/core/enricher/base.py +59 -0
- asksql-2.1.0/src/vanna/core/errors.py +47 -0
- asksql-2.1.0/src/vanna/core/evaluation/__init__.py +81 -0
- asksql-2.1.0/src/vanna/core/evaluation/base.py +186 -0
- asksql-2.1.0/src/vanna/core/evaluation/dataset.py +254 -0
- asksql-2.1.0/src/vanna/core/evaluation/evaluators.py +376 -0
- asksql-2.1.0/src/vanna/core/evaluation/report.py +289 -0
- asksql-2.1.0/src/vanna/core/evaluation/runner.py +313 -0
- asksql-2.1.0/src/vanna/core/filter/__init__.py +10 -0
- asksql-2.1.0/src/vanna/core/filter/base.py +67 -0
- asksql-2.1.0/src/vanna/core/lifecycle/__init__.py +10 -0
- asksql-2.1.0/src/vanna/core/lifecycle/base.py +83 -0
- asksql-2.1.0/src/vanna/core/llm/__init__.py +16 -0
- asksql-2.1.0/src/vanna/core/llm/base.py +40 -0
- asksql-2.1.0/src/vanna/core/llm/models.py +61 -0
- asksql-2.1.0/src/vanna/core/middleware/__init__.py +10 -0
- asksql-2.1.0/src/vanna/core/middleware/base.py +69 -0
- asksql-2.1.0/src/vanna/core/observability/__init__.py +11 -0
- asksql-2.1.0/src/vanna/core/observability/base.py +88 -0
- asksql-2.1.0/src/vanna/core/observability/models.py +47 -0
- asksql-2.1.0/src/vanna/core/recovery/__init__.py +11 -0
- asksql-2.1.0/src/vanna/core/recovery/base.py +84 -0
- asksql-2.1.0/src/vanna/core/recovery/models.py +32 -0
- asksql-2.1.0/src/vanna/core/registry.py +278 -0
- asksql-2.1.0/src/vanna/core/rich_component.py +156 -0
- asksql-2.1.0/src/vanna/core/simple_component.py +27 -0
- asksql-2.1.0/src/vanna/core/storage/__init__.py +14 -0
- asksql-2.1.0/src/vanna/core/storage/base.py +46 -0
- asksql-2.1.0/src/vanna/core/storage/models.py +46 -0
- asksql-2.1.0/src/vanna/core/system_prompt/__init__.py +13 -0
- asksql-2.1.0/src/vanna/core/system_prompt/base.py +36 -0
- asksql-2.1.0/src/vanna/core/system_prompt/default.py +157 -0
- asksql-2.1.0/src/vanna/core/tool/__init__.py +18 -0
- asksql-2.1.0/src/vanna/core/tool/base.py +70 -0
- asksql-2.1.0/src/vanna/core/tool/models.py +84 -0
- asksql-2.1.0/src/vanna/core/user/__init__.py +17 -0
- asksql-2.1.0/src/vanna/core/user/base.py +29 -0
- asksql-2.1.0/src/vanna/core/user/models.py +25 -0
- asksql-2.1.0/src/vanna/core/user/request_context.py +70 -0
- asksql-2.1.0/src/vanna/core/user/resolver.py +42 -0
- asksql-2.1.0/src/vanna/core/validation.py +164 -0
- asksql-2.1.0/src/vanna/core/workflow/__init__.py +12 -0
- asksql-2.1.0/src/vanna/core/workflow/base.py +254 -0
- asksql-2.1.0/src/vanna/core/workflow/default.py +789 -0
- asksql-2.1.0/src/vanna/examples/__init__.py +1 -0
- asksql-2.1.0/src/vanna/examples/__main__.py +44 -0
- asksql-2.1.0/src/vanna/examples/anthropic_quickstart.py +80 -0
- asksql-2.1.0/src/vanna/examples/artifact_example.py +293 -0
- asksql-2.1.0/src/vanna/examples/claude_sqlite_example.py +236 -0
- asksql-2.1.0/src/vanna/examples/coding_agent_example.py +300 -0
- asksql-2.1.0/src/vanna/examples/custom_system_prompt_example.py +174 -0
- asksql-2.1.0/src/vanna/examples/default_workflow_handler_example.py +208 -0
- asksql-2.1.0/src/vanna/examples/email_auth_example.py +340 -0
- asksql-2.1.0/src/vanna/examples/evaluation_example.py +269 -0
- asksql-2.1.0/src/vanna/examples/extensibility_example.py +262 -0
- asksql-2.1.0/src/vanna/examples/minimal_example.py +67 -0
- asksql-2.1.0/src/vanna/examples/mock_auth_example.py +227 -0
- asksql-2.1.0/src/vanna/examples/mock_custom_tool.py +311 -0
- asksql-2.1.0/src/vanna/examples/mock_quickstart.py +79 -0
- asksql-2.1.0/src/vanna/examples/mock_quota_example.py +145 -0
- asksql-2.1.0/src/vanna/examples/mock_rich_components_demo.py +396 -0
- asksql-2.1.0/src/vanna/examples/mock_sqlite_example.py +223 -0
- asksql-2.1.0/src/vanna/examples/openai_quickstart.py +83 -0
- asksql-2.1.0/src/vanna/examples/primitive_components_demo.py +305 -0
- asksql-2.1.0/src/vanna/examples/quota_lifecycle_example.py +139 -0
- asksql-2.1.0/src/vanna/examples/visualization_example.py +251 -0
- asksql-2.1.0/src/vanna/integrations/__init__.py +17 -0
- asksql-2.1.0/src/vanna/integrations/anthropic/__init__.py +9 -0
- asksql-2.1.0/src/vanna/integrations/anthropic/llm.py +270 -0
- asksql-2.1.0/src/vanna/integrations/azureopenai/__init__.py +9 -0
- asksql-2.1.0/src/vanna/integrations/azureopenai/llm.py +329 -0
- asksql-2.1.0/src/vanna/integrations/azuresearch/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/azuresearch/agent_memory.py +413 -0
- asksql-2.1.0/src/vanna/integrations/bigquery/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/bigquery/sql_runner.py +81 -0
- asksql-2.1.0/src/vanna/integrations/chromadb/__init__.py +104 -0
- asksql-2.1.0/src/vanna/integrations/chromadb/agent_memory.py +488 -0
- asksql-2.1.0/src/vanna/integrations/clickhouse/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/clickhouse/sql_runner.py +82 -0
- asksql-2.1.0/src/vanna/integrations/duckdb/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/duckdb/sql_runner.py +65 -0
- asksql-2.1.0/src/vanna/integrations/faiss/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/faiss/agent_memory.py +435 -0
- asksql-2.1.0/src/vanna/integrations/google/__init__.py +9 -0
- asksql-2.1.0/src/vanna/integrations/google/gemini.py +370 -0
- asksql-2.1.0/src/vanna/integrations/hive/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/hive/sql_runner.py +87 -0
- asksql-2.1.0/src/vanna/integrations/local/__init__.py +17 -0
- asksql-2.1.0/src/vanna/integrations/local/agent_memory/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/local/agent_memory/in_memory.py +285 -0
- asksql-2.1.0/src/vanna/integrations/local/audit.py +59 -0
- asksql-2.1.0/src/vanna/integrations/local/file_system.py +242 -0
- asksql-2.1.0/src/vanna/integrations/local/file_system_conversation_store.py +255 -0
- asksql-2.1.0/src/vanna/integrations/local/storage.py +62 -0
- asksql-2.1.0/src/vanna/integrations/marqo/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/marqo/agent_memory.py +354 -0
- asksql-2.1.0/src/vanna/integrations/milvus/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/milvus/agent_memory.py +458 -0
- asksql-2.1.0/src/vanna/integrations/mock/__init__.py +9 -0
- asksql-2.1.0/src/vanna/integrations/mock/llm.py +65 -0
- asksql-2.1.0/src/vanna/integrations/mssql/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/mssql/sql_runner.py +66 -0
- asksql-2.1.0/src/vanna/integrations/mysql/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/mysql/sql_runner.py +92 -0
- asksql-2.1.0/src/vanna/integrations/ollama/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/ollama/llm.py +252 -0
- asksql-2.1.0/src/vanna/integrations/openai/__init__.py +10 -0
- asksql-2.1.0/src/vanna/integrations/openai/llm.py +267 -0
- asksql-2.1.0/src/vanna/integrations/openai/responses.py +163 -0
- asksql-2.1.0/src/vanna/integrations/opensearch/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/opensearch/agent_memory.py +411 -0
- asksql-2.1.0/src/vanna/integrations/oracle/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/oracle/sql_runner.py +75 -0
- asksql-2.1.0/src/vanna/integrations/pinecone/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/pinecone/agent_memory.py +329 -0
- asksql-2.1.0/src/vanna/integrations/plotly/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/plotly/chart_generator.py +313 -0
- asksql-2.1.0/src/vanna/integrations/postgres/__init__.py +9 -0
- asksql-2.1.0/src/vanna/integrations/postgres/sql_runner.py +112 -0
- asksql-2.1.0/src/vanna/integrations/premium/agent_memory/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/premium/agent_memory/premium.py +186 -0
- asksql-2.1.0/src/vanna/integrations/presto/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/presto/sql_runner.py +107 -0
- asksql-2.1.0/src/vanna/integrations/qdrant/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/qdrant/agent_memory.py +466 -0
- asksql-2.1.0/src/vanna/integrations/snowflake/__init__.py +5 -0
- asksql-2.1.0/src/vanna/integrations/snowflake/sql_runner.py +147 -0
- asksql-2.1.0/src/vanna/integrations/sqlite/__init__.py +9 -0
- asksql-2.1.0/src/vanna/integrations/sqlite/sql_runner.py +65 -0
- asksql-2.1.0/src/vanna/integrations/weaviate/__init__.py +7 -0
- asksql-2.1.0/src/vanna/integrations/weaviate/agent_memory.py +428 -0
- asksql-2.1.0/src/vanna/legacy/ZhipuAI/ZhipuAI_Chat.py +233 -0
- asksql-2.1.0/src/vanna/legacy/ZhipuAI/ZhipuAI_embeddings.py +79 -0
- asksql-2.1.0/src/vanna/legacy/ZhipuAI/__init__.py +2 -0
- asksql-2.1.0/src/vanna/legacy/__init__.py +403 -0
- asksql-2.1.0/src/vanna/legacy/adapter.py +468 -0
- asksql-2.1.0/src/vanna/legacy/advanced/__init__.py +28 -0
- asksql-2.1.0/src/vanna/legacy/anthropic/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/anthropic/anthropic_chat.py +80 -0
- asksql-2.1.0/src/vanna/legacy/azuresearch/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/azuresearch/azuresearch_vector.py +274 -0
- asksql-2.1.0/src/vanna/legacy/base/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/base/base.py +2133 -0
- asksql-2.1.0/src/vanna/legacy/base/safe_exec.py +190 -0
- asksql-2.1.0/src/vanna/legacy/bedrock/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/bedrock/bedrock_converse.py +86 -0
- asksql-2.1.0/src/vanna/legacy/chromadb/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/chromadb/chromadb_vector.py +259 -0
- asksql-2.1.0/src/vanna/legacy/cohere/__init__.py +2 -0
- asksql-2.1.0/src/vanna/legacy/cohere/cohere_chat.py +99 -0
- asksql-2.1.0/src/vanna/legacy/cohere/cohere_embeddings.py +77 -0
- asksql-2.1.0/src/vanna/legacy/deepseek/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/deepseek/deepseek_chat.py +59 -0
- asksql-2.1.0/src/vanna/legacy/exceptions/__init__.py +46 -0
- asksql-2.1.0/src/vanna/legacy/faiss/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/faiss/faiss.py +230 -0
- asksql-2.1.0/src/vanna/legacy/flask/__init__.py +1355 -0
- asksql-2.1.0/src/vanna/legacy/flask/assets.py +58 -0
- asksql-2.1.0/src/vanna/legacy/flask/auth.py +56 -0
- asksql-2.1.0/src/vanna/legacy/google/__init__.py +2 -0
- asksql-2.1.0/src/vanna/legacy/google/bigquery_vector.py +293 -0
- asksql-2.1.0/src/vanna/legacy/google/gemini_chat.py +78 -0
- asksql-2.1.0/src/vanna/legacy/hf/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/hf/hf.py +80 -0
- asksql-2.1.0/src/vanna/legacy/local.py +8 -0
- asksql-2.1.0/src/vanna/legacy/marqo/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/marqo/marqo.py +168 -0
- asksql-2.1.0/src/vanna/legacy/milvus/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/milvus/milvus_vector.py +328 -0
- asksql-2.1.0/src/vanna/legacy/mistral/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/mistral/mistral.py +51 -0
- asksql-2.1.0/src/vanna/legacy/mock/__init__.py +3 -0
- asksql-2.1.0/src/vanna/legacy/mock/embedding.py +11 -0
- asksql-2.1.0/src/vanna/legacy/mock/llm.py +18 -0
- asksql-2.1.0/src/vanna/legacy/mock/vectordb.py +67 -0
- asksql-2.1.0/src/vanna/legacy/ollama/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/ollama/ollama.py +110 -0
- asksql-2.1.0/src/vanna/legacy/openai/__init__.py +2 -0
- asksql-2.1.0/src/vanna/legacy/openai/openai_chat.py +124 -0
- asksql-2.1.0/src/vanna/legacy/openai/openai_embeddings.py +46 -0
- asksql-2.1.0/src/vanna/legacy/opensearch/__init__.py +2 -0
- asksql-2.1.0/src/vanna/legacy/opensearch/opensearch_vector.py +369 -0
- asksql-2.1.0/src/vanna/legacy/opensearch/opensearch_vector_semantic.py +200 -0
- asksql-2.1.0/src/vanna/legacy/oracle/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/oracle/oracle_vector.py +584 -0
- asksql-2.1.0/src/vanna/legacy/pgvector/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/pgvector/pgvector.py +282 -0
- asksql-2.1.0/src/vanna/legacy/pinecone/__init__.py +3 -0
- asksql-2.1.0/src/vanna/legacy/pinecone/pinecone_vector.py +275 -0
- asksql-2.1.0/src/vanna/legacy/qdrant/__init__.py +3 -0
- asksql-2.1.0/src/vanna/legacy/qdrant/qdrant.py +329 -0
- asksql-2.1.0/src/vanna/legacy/qianfan/Qianfan_Chat.py +170 -0
- asksql-2.1.0/src/vanna/legacy/qianfan/Qianfan_embeddings.py +36 -0
- asksql-2.1.0/src/vanna/legacy/qianfan/__init__.py +2 -0
- asksql-2.1.0/src/vanna/legacy/qianwen/QianwenAI_chat.py +132 -0
- asksql-2.1.0/src/vanna/legacy/qianwen/QianwenAI_embeddings.py +46 -0
- asksql-2.1.0/src/vanna/legacy/qianwen/__init__.py +2 -0
- asksql-2.1.0/src/vanna/legacy/remote.py +79 -0
- asksql-2.1.0/src/vanna/legacy/types/__init__.py +292 -0
- asksql-2.1.0/src/vanna/legacy/utils.py +72 -0
- asksql-2.1.0/src/vanna/legacy/vannadb/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/vannadb/vannadb_vector.py +468 -0
- asksql-2.1.0/src/vanna/legacy/vllm/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/vllm/vllm.py +97 -0
- asksql-2.1.0/src/vanna/legacy/weaviate/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/weaviate/weaviate_vector.py +194 -0
- asksql-2.1.0/src/vanna/legacy/xinference/__init__.py +1 -0
- asksql-2.1.0/src/vanna/legacy/xinference/xinference.py +53 -0
- asksql-2.1.0/src/vanna/py.typed +0 -0
- asksql-2.1.0/src/vanna/servers/__init__.py +16 -0
- asksql-2.1.0/src/vanna/servers/__main__.py +8 -0
- asksql-2.1.0/src/vanna/servers/base/__init__.py +18 -0
- asksql-2.1.0/src/vanna/servers/base/chat_handler.py +65 -0
- asksql-2.1.0/src/vanna/servers/base/models.py +111 -0
- asksql-2.1.0/src/vanna/servers/base/rich_chat_handler.py +141 -0
- asksql-2.1.0/src/vanna/servers/base/templates.py +331 -0
- asksql-2.1.0/src/vanna/servers/cli/__init__.py +7 -0
- asksql-2.1.0/src/vanna/servers/cli/server_runner.py +204 -0
- asksql-2.1.0/src/vanna/servers/fastapi/__init__.py +7 -0
- asksql-2.1.0/src/vanna/servers/fastapi/app.py +163 -0
- asksql-2.1.0/src/vanna/servers/fastapi/routes.py +183 -0
- asksql-2.1.0/src/vanna/servers/flask/__init__.py +7 -0
- asksql-2.1.0/src/vanna/servers/flask/app.py +132 -0
- asksql-2.1.0/src/vanna/servers/flask/routes.py +137 -0
- asksql-2.1.0/src/vanna/tools/__init__.py +41 -0
- asksql-2.1.0/src/vanna/tools/agent_memory.py +322 -0
- asksql-2.1.0/src/vanna/tools/file_system.py +879 -0
- asksql-2.1.0/src/vanna/tools/python.py +222 -0
- asksql-2.1.0/src/vanna/tools/run_sql.py +173 -0
- asksql-2.1.0/src/vanna/tools/visualize_data.py +195 -0
- asksql-2.1.0/src/vanna/utils/__init__.py +0 -0
- asksql-2.1.0/src/vanna/utils/sql_safety.py +84 -0
- asksql-2.1.0/src/vanna/web_components/__init__.py +44 -0
asksql-2.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Vanna.AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
asksql-2.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: asksql
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: Community-maintained, security-focused fork of Vanna: generate SQL from natural language. Drop-in: keeps `import vanna`.
|
|
5
|
+
Author-email: Zain Hoda <zain@vanna.ai>
|
|
6
|
+
Maintainer: Ayush Srivastava
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: pydantic>=2.0.0
|
|
14
|
+
Requires-Dist: click>=8.0.0
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: httpx>=0.28.0
|
|
17
|
+
Requires-Dist: PyYAML
|
|
18
|
+
Requires-Dist: plotly
|
|
19
|
+
Requires-Dist: tabulate
|
|
20
|
+
Requires-Dist: sqlparse
|
|
21
|
+
Requires-Dist: sqlalchemy
|
|
22
|
+
Requires-Dist: requests
|
|
23
|
+
Requires-Dist: psycopg2-binary ; extra == "all"
|
|
24
|
+
Requires-Dist: db-dtypes ; extra == "all"
|
|
25
|
+
Requires-Dist: PyMySQL ; extra == "all"
|
|
26
|
+
Requires-Dist: google-cloud-bigquery ; extra == "all"
|
|
27
|
+
Requires-Dist: snowflake-connector-python ; extra == "all"
|
|
28
|
+
Requires-Dist: duckdb ; extra == "all"
|
|
29
|
+
Requires-Dist: openai ; extra == "all"
|
|
30
|
+
Requires-Dist: qianfan ; extra == "all"
|
|
31
|
+
Requires-Dist: mistralai>=1.0.0 ; extra == "all"
|
|
32
|
+
Requires-Dist: chromadb>=1.1.0 ; extra == "all"
|
|
33
|
+
Requires-Dist: anthropic ; extra == "all"
|
|
34
|
+
Requires-Dist: zhipuai ; extra == "all"
|
|
35
|
+
Requires-Dist: marqo ; extra == "all"
|
|
36
|
+
Requires-Dist: google-generativeai ; extra == "all"
|
|
37
|
+
Requires-Dist: google-cloud-aiplatform ; extra == "all"
|
|
38
|
+
Requires-Dist: qdrant-client>=1.0.0 ; extra == "all"
|
|
39
|
+
Requires-Dist: fastembed ; extra == "all"
|
|
40
|
+
Requires-Dist: ollama ; extra == "all"
|
|
41
|
+
Requires-Dist: httpx ; extra == "all"
|
|
42
|
+
Requires-Dist: opensearch-py ; extra == "all"
|
|
43
|
+
Requires-Dist: opensearch-dsl ; extra == "all"
|
|
44
|
+
Requires-Dist: transformers ; extra == "all"
|
|
45
|
+
Requires-Dist: pinecone ; extra == "all"
|
|
46
|
+
Requires-Dist: pymilvus[model] ; extra == "all"
|
|
47
|
+
Requires-Dist: weaviate-client ; extra == "all"
|
|
48
|
+
Requires-Dist: azure-search-documents ; extra == "all"
|
|
49
|
+
Requires-Dist: azure-identity ; extra == "all"
|
|
50
|
+
Requires-Dist: azure-common ; extra == "all"
|
|
51
|
+
Requires-Dist: faiss-cpu ; extra == "all"
|
|
52
|
+
Requires-Dist: boto ; extra == "all"
|
|
53
|
+
Requires-Dist: boto3 ; extra == "all"
|
|
54
|
+
Requires-Dist: botocore ; extra == "all"
|
|
55
|
+
Requires-Dist: langchain_core ; extra == "all"
|
|
56
|
+
Requires-Dist: langchain_postgres ; extra == "all"
|
|
57
|
+
Requires-Dist: langchain-community ; extra == "all"
|
|
58
|
+
Requires-Dist: langchain-huggingface ; extra == "all"
|
|
59
|
+
Requires-Dist: xinference-client ; extra == "all"
|
|
60
|
+
Requires-Dist: anthropic ; extra == "anthropic"
|
|
61
|
+
Requires-Dist: openai ; extra == "azureopenai"
|
|
62
|
+
Requires-Dist: azure-identity ; extra == "azureopenai"
|
|
63
|
+
Requires-Dist: azure-search-documents ; extra == "azuresearch"
|
|
64
|
+
Requires-Dist: azure-identity ; extra == "azuresearch"
|
|
65
|
+
Requires-Dist: azure-common ; extra == "azuresearch"
|
|
66
|
+
Requires-Dist: fastembed ; extra == "azuresearch"
|
|
67
|
+
Requires-Dist: boto3 ; extra == "bedrock"
|
|
68
|
+
Requires-Dist: botocore ; extra == "bedrock"
|
|
69
|
+
Requires-Dist: google-cloud-bigquery ; extra == "bigquery"
|
|
70
|
+
Requires-Dist: chromadb>=1.1.0 ; extra == "chromadb"
|
|
71
|
+
Requires-Dist: clickhouse_connect ; extra == "clickhouse"
|
|
72
|
+
Requires-Dist: pytest>=7.0.0 ; extra == "dev"
|
|
73
|
+
Requires-Dist: pytest-asyncio>=0.21.0 ; extra == "dev"
|
|
74
|
+
Requires-Dist: pytest-mock>=3.10.0 ; extra == "dev"
|
|
75
|
+
Requires-Dist: pytest-cov>=4.0.0 ; extra == "dev"
|
|
76
|
+
Requires-Dist: tox>=4.0.0 ; extra == "dev"
|
|
77
|
+
Requires-Dist: mypy ; extra == "dev"
|
|
78
|
+
Requires-Dist: ruff ; extra == "dev"
|
|
79
|
+
Requires-Dist: pandas-stubs ; extra == "dev"
|
|
80
|
+
Requires-Dist: plotly-stubs ; extra == "dev"
|
|
81
|
+
Requires-Dist: types-PyYAML ; extra == "dev"
|
|
82
|
+
Requires-Dist: types-requests ; extra == "dev"
|
|
83
|
+
Requires-Dist: types-tabulate ; extra == "dev"
|
|
84
|
+
Requires-Dist: duckdb ; extra == "duckdb"
|
|
85
|
+
Requires-Dist: faiss-cpu ; extra == "faiss-cpu"
|
|
86
|
+
Requires-Dist: faiss-gpu ; extra == "faiss-gpu"
|
|
87
|
+
Requires-Dist: fastapi>=0.68.0 ; extra == "fastapi"
|
|
88
|
+
Requires-Dist: uvicorn>=0.15.0 ; extra == "fastapi"
|
|
89
|
+
Requires-Dist: flask>=2.0.0 ; extra == "flask"
|
|
90
|
+
Requires-Dist: flask-cors>=4.0.0 ; extra == "flask"
|
|
91
|
+
Requires-Dist: google-genai ; extra == "gemini"
|
|
92
|
+
Requires-Dist: google-generativeai ; extra == "google"
|
|
93
|
+
Requires-Dist: google-cloud-aiplatform ; extra == "google"
|
|
94
|
+
Requires-Dist: transformers ; extra == "hf"
|
|
95
|
+
Requires-Dist: pyhive ; extra == "hive"
|
|
96
|
+
Requires-Dist: thrift ; extra == "hive"
|
|
97
|
+
Requires-Dist: marqo ; extra == "marqo"
|
|
98
|
+
Requires-Dist: pymilvus[model] ; extra == "milvus"
|
|
99
|
+
Requires-Dist: mistralai>=1.0.0 ; extra == "mistralai"
|
|
100
|
+
Requires-Dist: pyodbc ; extra == "mssql"
|
|
101
|
+
Requires-Dist: PyMySQL ; extra == "mysql"
|
|
102
|
+
Requires-Dist: ollama ; extra == "ollama"
|
|
103
|
+
Requires-Dist: httpx ; extra == "ollama"
|
|
104
|
+
Requires-Dist: openai ; extra == "openai"
|
|
105
|
+
Requires-Dist: opensearch-py ; extra == "opensearch"
|
|
106
|
+
Requires-Dist: opensearch-dsl ; extra == "opensearch"
|
|
107
|
+
Requires-Dist: langchain-community ; extra == "opensearch"
|
|
108
|
+
Requires-Dist: langchain-huggingface ; extra == "opensearch"
|
|
109
|
+
Requires-Dist: oracledb ; extra == "oracle"
|
|
110
|
+
Requires-Dist: chromadb<1.0.0 ; extra == "oracle"
|
|
111
|
+
Requires-Dist: langchain-postgres>=0.0.12 ; extra == "pgvector"
|
|
112
|
+
Requires-Dist: pinecone ; extra == "pinecone"
|
|
113
|
+
Requires-Dist: fastembed ; extra == "pinecone"
|
|
114
|
+
Requires-Dist: psycopg2-binary ; extra == "postgres"
|
|
115
|
+
Requires-Dist: db-dtypes ; extra == "postgres"
|
|
116
|
+
Requires-Dist: pyhive ; extra == "presto"
|
|
117
|
+
Requires-Dist: thrift ; extra == "presto"
|
|
118
|
+
Requires-Dist: qdrant-client>=1.0.0 ; extra == "qdrant"
|
|
119
|
+
Requires-Dist: fastembed ; extra == "qdrant"
|
|
120
|
+
Requires-Dist: qianfan ; extra == "qianfan"
|
|
121
|
+
Requires-Dist: asksql[flask, fastapi] ; extra == "servers"
|
|
122
|
+
Requires-Dist: snowflake-connector-python ; extra == "snowflake"
|
|
123
|
+
Requires-Dist: pytest>=7.0.0 ; extra == "test"
|
|
124
|
+
Requires-Dist: pytest-asyncio>=0.21.0 ; extra == "test"
|
|
125
|
+
Requires-Dist: pytest-mock>=3.10.0 ; extra == "test"
|
|
126
|
+
Requires-Dist: pytest-cov>=4.0.0 ; extra == "test"
|
|
127
|
+
Requires-Dist: tox>=4.0.0 ; extra == "test"
|
|
128
|
+
Requires-Dist: vllm ; extra == "vllm"
|
|
129
|
+
Requires-Dist: weaviate-client ; extra == "weaviate"
|
|
130
|
+
Requires-Dist: xinference-client ; extra == "xinference-client"
|
|
131
|
+
Requires-Dist: zhipuai ; extra == "zhipuai"
|
|
132
|
+
Project-URL: Bug Tracker, https://github.com/buhtig47/vanna/issues
|
|
133
|
+
Project-URL: Changelog, https://github.com/buhtig47/vanna/blob/main/CHANGELOG.md
|
|
134
|
+
Project-URL: Homepage, https://github.com/buhtig47/vanna
|
|
135
|
+
Project-URL: Original project, https://github.com/vanna-ai/vanna
|
|
136
|
+
Provides-Extra: all
|
|
137
|
+
Provides-Extra: anthropic
|
|
138
|
+
Provides-Extra: azureopenai
|
|
139
|
+
Provides-Extra: azuresearch
|
|
140
|
+
Provides-Extra: bedrock
|
|
141
|
+
Provides-Extra: bigquery
|
|
142
|
+
Provides-Extra: chromadb
|
|
143
|
+
Provides-Extra: clickhouse
|
|
144
|
+
Provides-Extra: dev
|
|
145
|
+
Provides-Extra: duckdb
|
|
146
|
+
Provides-Extra: faiss-cpu
|
|
147
|
+
Provides-Extra: faiss-gpu
|
|
148
|
+
Provides-Extra: fastapi
|
|
149
|
+
Provides-Extra: flask
|
|
150
|
+
Provides-Extra: gemini
|
|
151
|
+
Provides-Extra: google
|
|
152
|
+
Provides-Extra: hf
|
|
153
|
+
Provides-Extra: hive
|
|
154
|
+
Provides-Extra: marqo
|
|
155
|
+
Provides-Extra: milvus
|
|
156
|
+
Provides-Extra: mistralai
|
|
157
|
+
Provides-Extra: mssql
|
|
158
|
+
Provides-Extra: mysql
|
|
159
|
+
Provides-Extra: ollama
|
|
160
|
+
Provides-Extra: openai
|
|
161
|
+
Provides-Extra: opensearch
|
|
162
|
+
Provides-Extra: oracle
|
|
163
|
+
Provides-Extra: pgvector
|
|
164
|
+
Provides-Extra: pinecone
|
|
165
|
+
Provides-Extra: postgres
|
|
166
|
+
Provides-Extra: presto
|
|
167
|
+
Provides-Extra: qdrant
|
|
168
|
+
Provides-Extra: qianfan
|
|
169
|
+
Provides-Extra: servers
|
|
170
|
+
Provides-Extra: snowflake
|
|
171
|
+
Provides-Extra: test
|
|
172
|
+
Provides-Extra: vllm
|
|
173
|
+
Provides-Extra: weaviate
|
|
174
|
+
Provides-Extra: xinference-client
|
|
175
|
+
Provides-Extra: zhipuai
|
|
176
|
+
|
|
177
|
+
# asksql
|
|
178
|
+
|
|
179
|
+
**The community-maintained, security-focused continuation of [Vanna](https://github.com/vanna-ai/vanna).**
|
|
180
|
+
|
|
181
|
+
> 🚧 **Work in progress.** Vanna was archived on 29 March 2026 with ~227 open issues. asksql picks it up: security fixes first, then bug fixes and dependency updates.
|
|
182
|
+
|
|
183
|
+
### Coming from Vanna? Zero code changes.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
pip uninstall vanna
|
|
187
|
+
pip install asksql
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
asksql keeps the `vanna` import name (like Pillow did for PIL), so `import vanna`, `from vanna import Agent` and the legacy 1.x `VannaBase` API work as before. Don't install both packages in the same environment.
|
|
191
|
+
|
|
192
|
+
### What's fixed so far
|
|
193
|
+
|
|
194
|
+
| Issue | Fix |
|
|
195
|
+
|---|---|
|
|
196
|
+
| CVE-2026-4229 · [#1121](https://github.com/vanna-ai/vanna/issues/1121) | SQL injection in the BigQuery vector store |
|
|
197
|
+
| [#1098](https://github.com/vanna-ai/vanna/issues/1098) | LLM-written Plotly code could run arbitrary Python on the server (`exec` with full access) |
|
|
198
|
+
| [#1078](https://github.com/vanna-ai/vanna/issues/1078) | LLM-generated SQL ran unfiltered (prompt injection → `DROP`, shell commands via the database) |
|
|
199
|
+
|
|
200
|
+
⚠️ **One behaviour change:** SQL generated by the LLM is now **read-only by default**. If you need the LLM to write data, opt in with `config={"allow_write_sql": True}` (legacy API) or `RunSqlTool(..., allow_write_sql=True)` (v2). See [CHANGELOG.md](https://github.com/buhtig47/vanna/blob/main/CHANGELOG.md).
|
|
201
|
+
|
|
202
|
+
Found a bug or a security problem? [Open an issue](https://github.com/buhtig47/vanna/issues).
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
*Everything below is the original Vanna 2.0 README. Upstream docs at vanna.ai still describe the API.*
|
|
207
|
+
|
|
208
|
+
## Vanna 2.0: Turn Questions into Data Insights
|
|
209
|
+
|
|
210
|
+
**Natural language → SQL → Answers.** Now with enterprise security and user-aware permissions.
|
|
211
|
+
|
|
212
|
+
[](https://python.org)
|
|
213
|
+
[](https://github.com/buhtig47/vanna/blob/main/LICENSE)
|
|
214
|
+
[](https://github.com/psf/black)
|
|
215
|
+
|
|
216
|
+
https://github.com/user-attachments/assets/476cd421-d0b0-46af-8b29-0f40c73d6d83
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+

|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## What's New in 2.0
|
|
224
|
+
|
|
225
|
+
🔐 **User-Aware at Every Layer** — Queries automatically filtered per user permissions
|
|
226
|
+
|
|
227
|
+
🎨 **Modern Web Interface** — Beautiful pre-built `<vanna-chat>` component
|
|
228
|
+
|
|
229
|
+
⚡ **Streaming Responses** — Real-time tables, charts, and progress updates
|
|
230
|
+
|
|
231
|
+
🔒 **Enterprise Security** — Row-level security, audit logs, rate limiting
|
|
232
|
+
|
|
233
|
+
🔄 **Production-Ready** — FastAPI integration, observability, lifecycle hooks
|
|
234
|
+
|
|
235
|
+
> **Upgrading from 0.x?** See the [Migration Guide](https://github.com/buhtig47/vanna/blob/main/MIGRATION_GUIDE.md) | [What changed?](#migration-notes)
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Get Started
|
|
240
|
+
|
|
241
|
+
### Try it with Sample Data
|
|
242
|
+
|
|
243
|
+
[Quickstart](https://vanna.ai/docs/quick-start)
|
|
244
|
+
|
|
245
|
+
### Configure
|
|
246
|
+
|
|
247
|
+
[Configure](https://vanna.ai/docs/configure)
|
|
248
|
+
|
|
249
|
+
### Web Component
|
|
250
|
+
|
|
251
|
+
```html
|
|
252
|
+
<!-- Drop into any existing webpage -->
|
|
253
|
+
<script src="https://img.vanna.ai/vanna-components.js"></script>
|
|
254
|
+
<vanna-chat
|
|
255
|
+
sse-endpoint="https://your-api.com/chat"
|
|
256
|
+
theme="dark">
|
|
257
|
+
</vanna-chat>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Uses your existing cookies/JWTs. Works with React, Vue, or plain HTML.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## What You Get
|
|
265
|
+
|
|
266
|
+
Ask a question in natural language and get back:
|
|
267
|
+
|
|
268
|
+
**1. Streaming Progress Updates**
|
|
269
|
+
|
|
270
|
+
**2. SQL Code Block (By default only shown to "admin" users)**
|
|
271
|
+
|
|
272
|
+
**3. Interactive Data Table**
|
|
273
|
+
|
|
274
|
+
**4. Charts** (Plotly visualizations)
|
|
275
|
+
|
|
276
|
+
**5. Natural Language Summary**
|
|
277
|
+
|
|
278
|
+
All streamed in real-time to your web component.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Why Vanna 2.0?
|
|
283
|
+
|
|
284
|
+
### ✅ Get Started Instantly
|
|
285
|
+
* Production chat interface
|
|
286
|
+
* Custom agent with your database
|
|
287
|
+
* Embed in any webpage
|
|
288
|
+
|
|
289
|
+
### ✅ Enterprise-Ready Security
|
|
290
|
+
**User-aware at every layer** — Identity flows through system prompts, tool execution, and SQL filtering
|
|
291
|
+
**Row-level security** — Queries automatically filtered per user permissions
|
|
292
|
+
**Audit logs** — Every query tracked per user for compliance
|
|
293
|
+
**Rate limiting** — Per-user quotas via lifecycle hooks
|
|
294
|
+
|
|
295
|
+
### ✅ Beautiful Web UI Included
|
|
296
|
+
**Pre-built `<vanna-chat>` component** — No need to build your own chat interface
|
|
297
|
+
**Streaming tables & charts** — Rich components, not just text
|
|
298
|
+
**Responsive & customizable** — Works on mobile, desktop, light/dark themes
|
|
299
|
+
**Framework-agnostic** — React, Vue, plain HTML
|
|
300
|
+
|
|
301
|
+
### ✅ Works With Your Stack
|
|
302
|
+
**Any LLM:** OpenAI, Anthropic, Ollama, Azure, Google Gemini, AWS Bedrock, Mistral, Others
|
|
303
|
+
**Any Database:** PostgreSQL, MySQL, Snowflake, BigQuery, Redshift, SQLite, Oracle, SQL Server, DuckDB, ClickHouse, Others
|
|
304
|
+
**Your Auth System:** Bring your own — cookies, JWTs, OAuth tokens
|
|
305
|
+
**Your Framework:** FastAPI, Flask
|
|
306
|
+
|
|
307
|
+
### ✅ Extensible But Opinionated
|
|
308
|
+
**Custom tools** — Extend the `Tool` base class
|
|
309
|
+
**Lifecycle hooks** — Quota checking, logging, content filtering
|
|
310
|
+
**LLM middlewares** — Caching, prompt engineering
|
|
311
|
+
**Observability** — Built-in tracing and metrics
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Architecture
|
|
316
|
+
|
|
317
|
+

|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## How It Works
|
|
322
|
+
|
|
323
|
+
```mermaid
|
|
324
|
+
sequenceDiagram
|
|
325
|
+
participant U as 👤 User
|
|
326
|
+
participant W as 🌐 <vanna-chat>
|
|
327
|
+
participant S as 🐍 Your Server
|
|
328
|
+
participant A as 🤖 Agent
|
|
329
|
+
participant T as 🧰 Tools
|
|
330
|
+
|
|
331
|
+
U->>W: "Show Q4 sales"
|
|
332
|
+
W->>S: POST /api/vanna/v2/chat_sse (with auth)
|
|
333
|
+
S->>A: User(id=alice, groups=[read_sales])
|
|
334
|
+
A->>T: Execute SQL tool (user-aware)
|
|
335
|
+
T->>T: Apply row-level security
|
|
336
|
+
T->>A: Filtered results
|
|
337
|
+
A->>W: Stream: Table → Chart → Summary
|
|
338
|
+
W->>U: Display beautiful UI
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Key Concepts:**
|
|
342
|
+
|
|
343
|
+
1. **User Resolver** — You define how to extract user identity from requests (cookies, JWTs, etc.)
|
|
344
|
+
2. **User-Aware Tools** — Tools automatically check permissions based on user's group memberships
|
|
345
|
+
3. **Streaming Components** — Backend streams structured UI components (tables, charts) to frontend
|
|
346
|
+
4. **Built-in Web UI** — Pre-built `<vanna-chat>` component renders everything beautifully
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Production Setup with Your Auth
|
|
351
|
+
|
|
352
|
+
Here's a complete example integrating Vanna with your existing FastAPI app and authentication:
|
|
353
|
+
|
|
354
|
+
```python
|
|
355
|
+
from fastapi import FastAPI
|
|
356
|
+
from vanna import Agent
|
|
357
|
+
from vanna.servers.fastapi.routes import register_chat_routes
|
|
358
|
+
from vanna.servers.base import ChatHandler
|
|
359
|
+
from vanna.core.user import UserResolver, User, RequestContext
|
|
360
|
+
from vanna.integrations.anthropic import AnthropicLlmService
|
|
361
|
+
from vanna.tools import RunSqlTool
|
|
362
|
+
from vanna.integrations.sqlite import SqliteRunner
|
|
363
|
+
from vanna.core.registry import ToolRegistry
|
|
364
|
+
|
|
365
|
+
# Your existing FastAPI app
|
|
366
|
+
app = FastAPI()
|
|
367
|
+
|
|
368
|
+
# 1. Define your user resolver (using YOUR auth system)
|
|
369
|
+
class MyUserResolver(UserResolver):
|
|
370
|
+
async def resolve_user(self, request_context: RequestContext) -> User:
|
|
371
|
+
# Extract from cookies, JWTs, or session
|
|
372
|
+
token = request_context.get_header('Authorization')
|
|
373
|
+
user_data = self.decode_jwt(token) # Your existing logic
|
|
374
|
+
|
|
375
|
+
return User(
|
|
376
|
+
id=user_data['id'],
|
|
377
|
+
email=user_data['email'],
|
|
378
|
+
group_memberships=user_data['groups'] # Used for permissions
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
# 2. Set up agent with tools
|
|
382
|
+
llm = AnthropicLlmService(model="claude-sonnet-4-5")
|
|
383
|
+
tools = ToolRegistry()
|
|
384
|
+
tools.register(RunSqlTool(sql_runner=SqliteRunner("./data.db")))
|
|
385
|
+
|
|
386
|
+
agent = Agent(
|
|
387
|
+
llm_service=llm,
|
|
388
|
+
tool_registry=tools,
|
|
389
|
+
user_resolver=MyUserResolver()
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
# 3. Add Vanna routes to your app
|
|
393
|
+
chat_handler = ChatHandler(agent)
|
|
394
|
+
register_chat_routes(app, chat_handler)
|
|
395
|
+
|
|
396
|
+
# Now you have:
|
|
397
|
+
# - POST /api/vanna/v2/chat_sse (streaming endpoint)
|
|
398
|
+
# - GET / (optional web UI)
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
**Then in your frontend:**
|
|
402
|
+
```html
|
|
403
|
+
<vanna-chat sse-endpoint="/api/vanna/v2/chat_sse"></vanna-chat>
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
See [Full Documentation](https://vanna.ai/docs) for custom tools, lifecycle hooks, and advanced configuration
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Custom Tools
|
|
411
|
+
|
|
412
|
+
Extend Vanna with custom tools for your specific use case:
|
|
413
|
+
|
|
414
|
+
```python
|
|
415
|
+
from vanna.core.tool import Tool, ToolContext, ToolResult
|
|
416
|
+
from pydantic import BaseModel, Field
|
|
417
|
+
from typing import Type
|
|
418
|
+
|
|
419
|
+
class EmailArgs(BaseModel):
|
|
420
|
+
recipient: str = Field(description="Email recipient")
|
|
421
|
+
subject: str = Field(description="Email subject")
|
|
422
|
+
|
|
423
|
+
class EmailTool(Tool[EmailArgs]):
|
|
424
|
+
@property
|
|
425
|
+
def name(self) -> str:
|
|
426
|
+
return "send_email"
|
|
427
|
+
|
|
428
|
+
@property
|
|
429
|
+
def access_groups(self) -> list[str]:
|
|
430
|
+
return ["send_email"] # Permission check
|
|
431
|
+
|
|
432
|
+
def get_args_schema(self) -> Type[EmailArgs]:
|
|
433
|
+
return EmailArgs
|
|
434
|
+
|
|
435
|
+
async def execute(self, context: ToolContext, args: EmailArgs) -> ToolResult:
|
|
436
|
+
user = context.user # Automatically injected
|
|
437
|
+
|
|
438
|
+
# Your business logic
|
|
439
|
+
await self.email_service.send(
|
|
440
|
+
from_email=user.email,
|
|
441
|
+
to=args.recipient,
|
|
442
|
+
subject=args.subject
|
|
443
|
+
)
|
|
444
|
+
|
|
445
|
+
return ToolResult(success=True, result_for_llm=f"Email sent to {args.recipient}")
|
|
446
|
+
|
|
447
|
+
# Register your tool
|
|
448
|
+
tools.register(EmailTool())
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Advanced Features
|
|
454
|
+
|
|
455
|
+
Vanna 2.0 includes powerful enterprise features for production use:
|
|
456
|
+
|
|
457
|
+
**Lifecycle Hooks** — Add quota checking, custom logging, content filtering at key points in the request lifecycle
|
|
458
|
+
|
|
459
|
+
**LLM Middlewares** — Implement caching, prompt engineering, or cost tracking around LLM calls
|
|
460
|
+
|
|
461
|
+
**Conversation Storage** — Persist and retrieve conversation history per user
|
|
462
|
+
|
|
463
|
+
**Observability** — Built-in tracing and metrics integration
|
|
464
|
+
|
|
465
|
+
**Context Enrichers** — Add RAG, memory, or documentation to enhance agent responses
|
|
466
|
+
|
|
467
|
+
**Agent Configuration** — Control streaming, temperature, max iterations, and more
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## Use Cases
|
|
472
|
+
|
|
473
|
+
**Vanna is ideal for:**
|
|
474
|
+
- 📊 Data analytics applications with natural language interfaces
|
|
475
|
+
- 🔐 Multi-tenant SaaS needing user-aware permissions
|
|
476
|
+
- 🎨 Teams wanting a pre-built web component + backend
|
|
477
|
+
- 🏢 Enterprise environments with security/audit requirements
|
|
478
|
+
- 📈 Applications needing rich streaming responses (tables, charts, SQL)
|
|
479
|
+
- 🔄 Integrating with existing authentication systems
|
|
480
|
+
|
|
481
|
+
---
|
|
482
|
+
|
|
483
|
+
## Community & Support
|
|
484
|
+
|
|
485
|
+
- 🐛 **[asksql Issues](https://github.com/buhtig47/vanna/issues)** — Bug reports and security problems for this fork
|
|
486
|
+
- 📖 **[Upstream Vanna Documentation](https://vanna.ai/docs)** — Guides and API reference (still applies)
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
## Migration Notes
|
|
491
|
+
|
|
492
|
+
**Upgrading from Vanna 0.x?**
|
|
493
|
+
|
|
494
|
+
Vanna 2.0 is a complete rewrite focused on user-aware agents and production deployments. Key changes:
|
|
495
|
+
|
|
496
|
+
- **New API**: Agent-based instead of `VannaBase` class methods
|
|
497
|
+
- **User-aware**: Every component now knows the user identity
|
|
498
|
+
- **Streaming**: Rich UI components instead of text/dataframes
|
|
499
|
+
- **Web-first**: Built-in `<vanna-chat>` component and server
|
|
500
|
+
|
|
501
|
+
**Migration path:**
|
|
502
|
+
|
|
503
|
+
1. **Quick wrap** — Use `LegacyVannaAdapter` to wrap your existing Vanna 0.x instance and get the new web UI immediately
|
|
504
|
+
2. **Gradual migration** — Incrementally move to the new Agent API and tools
|
|
505
|
+
|
|
506
|
+
See the complete [Migration Guide](https://github.com/buhtig47/vanna/blob/main/MIGRATION_GUIDE.md) for step-by-step instructions.
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
## License
|
|
511
|
+
|
|
512
|
+
MIT License — See [LICENSE](https://github.com/buhtig47/vanna/blob/main/LICENSE) for details. Original copyright (c) 2024 Vanna.AI is kept.
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
**Originally built with ❤️ by the [Vanna team](https://github.com/vanna-ai/vanna).** asksql is an independent community fork and is not affiliated with or endorsed by Vanna.AI.
|
|
517
|
+
|