vanna 0.7.8__py3-none-any.whl → 2.0.0__py3-none-any.whl
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.
- vanna/__init__.py +167 -395
- vanna/agents/__init__.py +7 -0
- vanna/capabilities/__init__.py +17 -0
- vanna/capabilities/agent_memory/__init__.py +21 -0
- vanna/capabilities/agent_memory/base.py +103 -0
- vanna/capabilities/agent_memory/models.py +53 -0
- vanna/capabilities/file_system/__init__.py +14 -0
- vanna/capabilities/file_system/base.py +71 -0
- vanna/capabilities/file_system/models.py +25 -0
- vanna/capabilities/sql_runner/__init__.py +13 -0
- vanna/capabilities/sql_runner/base.py +37 -0
- vanna/capabilities/sql_runner/models.py +13 -0
- vanna/components/__init__.py +92 -0
- vanna/components/base.py +11 -0
- vanna/components/rich/__init__.py +83 -0
- vanna/components/rich/containers/__init__.py +7 -0
- vanna/components/rich/containers/card.py +20 -0
- vanna/components/rich/data/__init__.py +9 -0
- vanna/components/rich/data/chart.py +17 -0
- vanna/components/rich/data/dataframe.py +93 -0
- vanna/components/rich/feedback/__init__.py +21 -0
- vanna/components/rich/feedback/badge.py +16 -0
- vanna/components/rich/feedback/icon_text.py +14 -0
- vanna/components/rich/feedback/log_viewer.py +41 -0
- vanna/components/rich/feedback/notification.py +19 -0
- vanna/components/rich/feedback/progress.py +37 -0
- vanna/components/rich/feedback/status_card.py +28 -0
- vanna/components/rich/feedback/status_indicator.py +14 -0
- vanna/components/rich/interactive/__init__.py +21 -0
- vanna/components/rich/interactive/button.py +95 -0
- vanna/components/rich/interactive/task_list.py +58 -0
- vanna/components/rich/interactive/ui_state.py +93 -0
- vanna/components/rich/specialized/__init__.py +7 -0
- vanna/components/rich/specialized/artifact.py +20 -0
- vanna/components/rich/text.py +16 -0
- vanna/components/simple/__init__.py +15 -0
- vanna/components/simple/image.py +15 -0
- vanna/components/simple/link.py +15 -0
- vanna/components/simple/text.py +11 -0
- vanna/core/__init__.py +193 -0
- vanna/core/_compat.py +19 -0
- vanna/core/agent/__init__.py +10 -0
- vanna/core/agent/agent.py +1407 -0
- vanna/core/agent/config.py +123 -0
- vanna/core/audit/__init__.py +28 -0
- vanna/core/audit/base.py +299 -0
- vanna/core/audit/models.py +131 -0
- vanna/core/component_manager.py +329 -0
- vanna/core/components.py +53 -0
- vanna/core/enhancer/__init__.py +11 -0
- vanna/core/enhancer/base.py +94 -0
- vanna/core/enhancer/default.py +118 -0
- vanna/core/enricher/__init__.py +10 -0
- vanna/core/enricher/base.py +59 -0
- vanna/core/errors.py +47 -0
- vanna/core/evaluation/__init__.py +81 -0
- vanna/core/evaluation/base.py +186 -0
- vanna/core/evaluation/dataset.py +254 -0
- vanna/core/evaluation/evaluators.py +376 -0
- vanna/core/evaluation/report.py +289 -0
- vanna/core/evaluation/runner.py +313 -0
- vanna/core/filter/__init__.py +10 -0
- vanna/core/filter/base.py +67 -0
- vanna/core/lifecycle/__init__.py +10 -0
- vanna/core/lifecycle/base.py +83 -0
- vanna/core/llm/__init__.py +16 -0
- vanna/core/llm/base.py +40 -0
- vanna/core/llm/models.py +61 -0
- vanna/core/middleware/__init__.py +10 -0
- vanna/core/middleware/base.py +69 -0
- vanna/core/observability/__init__.py +11 -0
- vanna/core/observability/base.py +88 -0
- vanna/core/observability/models.py +47 -0
- vanna/core/recovery/__init__.py +11 -0
- vanna/core/recovery/base.py +84 -0
- vanna/core/recovery/models.py +32 -0
- vanna/core/registry.py +278 -0
- vanna/core/rich_component.py +156 -0
- vanna/core/simple_component.py +27 -0
- vanna/core/storage/__init__.py +14 -0
- vanna/core/storage/base.py +46 -0
- vanna/core/storage/models.py +46 -0
- vanna/core/system_prompt/__init__.py +13 -0
- vanna/core/system_prompt/base.py +36 -0
- vanna/core/system_prompt/default.py +157 -0
- vanna/core/tool/__init__.py +18 -0
- vanna/core/tool/base.py +70 -0
- vanna/core/tool/models.py +84 -0
- vanna/core/user/__init__.py +17 -0
- vanna/core/user/base.py +29 -0
- vanna/core/user/models.py +25 -0
- vanna/core/user/request_context.py +70 -0
- vanna/core/user/resolver.py +42 -0
- vanna/core/validation.py +164 -0
- vanna/core/workflow/__init__.py +12 -0
- vanna/core/workflow/base.py +254 -0
- vanna/core/workflow/default.py +789 -0
- vanna/examples/__init__.py +1 -0
- vanna/examples/__main__.py +44 -0
- vanna/examples/anthropic_quickstart.py +80 -0
- vanna/examples/artifact_example.py +293 -0
- vanna/examples/claude_sqlite_example.py +236 -0
- vanna/examples/coding_agent_example.py +300 -0
- vanna/examples/custom_system_prompt_example.py +174 -0
- vanna/examples/default_workflow_handler_example.py +208 -0
- vanna/examples/email_auth_example.py +340 -0
- vanna/examples/evaluation_example.py +269 -0
- vanna/examples/extensibility_example.py +262 -0
- vanna/examples/minimal_example.py +67 -0
- vanna/examples/mock_auth_example.py +227 -0
- vanna/examples/mock_custom_tool.py +311 -0
- vanna/examples/mock_quickstart.py +79 -0
- vanna/examples/mock_quota_example.py +145 -0
- vanna/examples/mock_rich_components_demo.py +396 -0
- vanna/examples/mock_sqlite_example.py +223 -0
- vanna/examples/openai_quickstart.py +83 -0
- vanna/examples/primitive_components_demo.py +305 -0
- vanna/examples/quota_lifecycle_example.py +139 -0
- vanna/examples/visualization_example.py +251 -0
- vanna/integrations/__init__.py +17 -0
- vanna/integrations/anthropic/__init__.py +9 -0
- vanna/integrations/anthropic/llm.py +270 -0
- vanna/integrations/azureopenai/__init__.py +9 -0
- vanna/integrations/azureopenai/llm.py +329 -0
- vanna/integrations/azuresearch/__init__.py +7 -0
- vanna/integrations/azuresearch/agent_memory.py +413 -0
- vanna/integrations/bigquery/__init__.py +5 -0
- vanna/integrations/bigquery/sql_runner.py +81 -0
- vanna/integrations/chromadb/__init__.py +104 -0
- vanna/integrations/chromadb/agent_memory.py +416 -0
- vanna/integrations/clickhouse/__init__.py +5 -0
- vanna/integrations/clickhouse/sql_runner.py +82 -0
- vanna/integrations/duckdb/__init__.py +5 -0
- vanna/integrations/duckdb/sql_runner.py +65 -0
- vanna/integrations/faiss/__init__.py +7 -0
- vanna/integrations/faiss/agent_memory.py +431 -0
- vanna/integrations/google/__init__.py +9 -0
- vanna/integrations/google/gemini.py +370 -0
- vanna/integrations/hive/__init__.py +5 -0
- vanna/integrations/hive/sql_runner.py +87 -0
- vanna/integrations/local/__init__.py +17 -0
- vanna/integrations/local/agent_memory/__init__.py +7 -0
- vanna/integrations/local/agent_memory/in_memory.py +285 -0
- vanna/integrations/local/audit.py +59 -0
- vanna/integrations/local/file_system.py +242 -0
- vanna/integrations/local/file_system_conversation_store.py +255 -0
- vanna/integrations/local/storage.py +62 -0
- vanna/integrations/marqo/__init__.py +7 -0
- vanna/integrations/marqo/agent_memory.py +354 -0
- vanna/integrations/milvus/__init__.py +7 -0
- vanna/integrations/milvus/agent_memory.py +458 -0
- vanna/integrations/mock/__init__.py +9 -0
- vanna/integrations/mock/llm.py +65 -0
- vanna/integrations/mssql/__init__.py +5 -0
- vanna/integrations/mssql/sql_runner.py +66 -0
- vanna/integrations/mysql/__init__.py +5 -0
- vanna/integrations/mysql/sql_runner.py +92 -0
- vanna/integrations/ollama/__init__.py +7 -0
- vanna/integrations/ollama/llm.py +252 -0
- vanna/integrations/openai/__init__.py +10 -0
- vanna/integrations/openai/llm.py +267 -0
- vanna/integrations/openai/responses.py +163 -0
- vanna/integrations/opensearch/__init__.py +7 -0
- vanna/integrations/opensearch/agent_memory.py +411 -0
- vanna/integrations/oracle/__init__.py +5 -0
- vanna/integrations/oracle/sql_runner.py +75 -0
- vanna/integrations/pinecone/__init__.py +7 -0
- vanna/integrations/pinecone/agent_memory.py +329 -0
- vanna/integrations/plotly/__init__.py +5 -0
- vanna/integrations/plotly/chart_generator.py +313 -0
- vanna/integrations/postgres/__init__.py +9 -0
- vanna/integrations/postgres/sql_runner.py +112 -0
- vanna/integrations/premium/agent_memory/__init__.py +7 -0
- vanna/integrations/premium/agent_memory/premium.py +186 -0
- vanna/integrations/presto/__init__.py +5 -0
- vanna/integrations/presto/sql_runner.py +107 -0
- vanna/integrations/qdrant/__init__.py +7 -0
- vanna/integrations/qdrant/agent_memory.py +461 -0
- vanna/integrations/snowflake/__init__.py +5 -0
- vanna/integrations/snowflake/sql_runner.py +147 -0
- vanna/integrations/sqlite/__init__.py +9 -0
- vanna/integrations/sqlite/sql_runner.py +65 -0
- vanna/integrations/weaviate/__init__.py +7 -0
- vanna/integrations/weaviate/agent_memory.py +428 -0
- vanna/{ZhipuAI → legacy/ZhipuAI}/ZhipuAI_embeddings.py +11 -11
- vanna/legacy/__init__.py +403 -0
- vanna/legacy/adapter.py +463 -0
- vanna/{advanced → legacy/advanced}/__init__.py +3 -1
- vanna/{anthropic → legacy/anthropic}/anthropic_chat.py +9 -7
- vanna/{azuresearch → legacy/azuresearch}/azuresearch_vector.py +79 -41
- vanna/{base → legacy/base}/base.py +247 -223
- vanna/legacy/bedrock/__init__.py +1 -0
- vanna/{bedrock → legacy/bedrock}/bedrock_converse.py +13 -12
- vanna/{chromadb → legacy/chromadb}/chromadb_vector.py +3 -1
- vanna/legacy/cohere/__init__.py +2 -0
- vanna/{cohere → legacy/cohere}/cohere_chat.py +19 -14
- vanna/{cohere → legacy/cohere}/cohere_embeddings.py +25 -19
- vanna/{deepseek → legacy/deepseek}/deepseek_chat.py +5 -6
- vanna/legacy/faiss/__init__.py +1 -0
- vanna/{faiss → legacy/faiss}/faiss.py +113 -59
- vanna/{flask → legacy/flask}/__init__.py +84 -43
- vanna/{flask → legacy/flask}/assets.py +5 -5
- vanna/{flask → legacy/flask}/auth.py +5 -4
- vanna/{google → legacy/google}/bigquery_vector.py +75 -42
- vanna/{google → legacy/google}/gemini_chat.py +7 -3
- vanna/{hf → legacy/hf}/hf.py +0 -1
- vanna/{milvus → legacy/milvus}/milvus_vector.py +58 -35
- vanna/{mock → legacy/mock}/llm.py +0 -1
- vanna/legacy/mock/vectordb.py +67 -0
- vanna/legacy/ollama/ollama.py +110 -0
- vanna/{openai → legacy/openai}/openai_chat.py +2 -6
- vanna/legacy/opensearch/opensearch_vector.py +369 -0
- vanna/legacy/opensearch/opensearch_vector_semantic.py +200 -0
- vanna/legacy/oracle/oracle_vector.py +584 -0
- vanna/{pgvector → legacy/pgvector}/pgvector.py +42 -13
- vanna/{qdrant → legacy/qdrant}/qdrant.py +2 -6
- vanna/legacy/qianfan/Qianfan_Chat.py +170 -0
- vanna/legacy/qianfan/Qianfan_embeddings.py +36 -0
- vanna/legacy/qianwen/QianwenAI_chat.py +132 -0
- vanna/{remote.py → legacy/remote.py} +28 -26
- vanna/{utils.py → legacy/utils.py} +6 -11
- vanna/{vannadb → legacy/vannadb}/vannadb_vector.py +115 -46
- vanna/{vllm → legacy/vllm}/vllm.py +5 -6
- vanna/{weaviate → legacy/weaviate}/weaviate_vector.py +59 -40
- vanna/{xinference → legacy/xinference}/xinference.py +6 -6
- vanna/py.typed +0 -0
- vanna/servers/__init__.py +16 -0
- vanna/servers/__main__.py +8 -0
- vanna/servers/base/__init__.py +18 -0
- vanna/servers/base/chat_handler.py +65 -0
- vanna/servers/base/models.py +111 -0
- vanna/servers/base/rich_chat_handler.py +141 -0
- vanna/servers/base/templates.py +331 -0
- vanna/servers/cli/__init__.py +7 -0
- vanna/servers/cli/server_runner.py +204 -0
- vanna/servers/fastapi/__init__.py +7 -0
- vanna/servers/fastapi/app.py +163 -0
- vanna/servers/fastapi/routes.py +183 -0
- vanna/servers/flask/__init__.py +7 -0
- vanna/servers/flask/app.py +132 -0
- vanna/servers/flask/routes.py +137 -0
- vanna/tools/__init__.py +41 -0
- vanna/tools/agent_memory.py +322 -0
- vanna/tools/file_system.py +879 -0
- vanna/tools/python.py +222 -0
- vanna/tools/run_sql.py +165 -0
- vanna/tools/visualize_data.py +195 -0
- vanna/utils/__init__.py +0 -0
- vanna/web_components/__init__.py +44 -0
- vanna-2.0.0.dist-info/METADATA +485 -0
- vanna-2.0.0.dist-info/RECORD +289 -0
- vanna-2.0.0.dist-info/entry_points.txt +3 -0
- vanna/bedrock/__init__.py +0 -1
- vanna/cohere/__init__.py +0 -2
- vanna/faiss/__init__.py +0 -1
- vanna/mock/vectordb.py +0 -55
- vanna/ollama/ollama.py +0 -103
- vanna/opensearch/opensearch_vector.py +0 -392
- vanna/opensearch/opensearch_vector_semantic.py +0 -175
- vanna/oracle/oracle_vector.py +0 -585
- vanna/qianfan/Qianfan_Chat.py +0 -165
- vanna/qianfan/Qianfan_embeddings.py +0 -36
- vanna/qianwen/QianwenAI_chat.py +0 -133
- vanna-0.7.8.dist-info/METADATA +0 -408
- vanna-0.7.8.dist-info/RECORD +0 -79
- /vanna/{ZhipuAI → legacy/ZhipuAI}/ZhipuAI_Chat.py +0 -0
- /vanna/{ZhipuAI → legacy/ZhipuAI}/__init__.py +0 -0
- /vanna/{anthropic → legacy/anthropic}/__init__.py +0 -0
- /vanna/{azuresearch → legacy/azuresearch}/__init__.py +0 -0
- /vanna/{base → legacy/base}/__init__.py +0 -0
- /vanna/{chromadb → legacy/chromadb}/__init__.py +0 -0
- /vanna/{deepseek → legacy/deepseek}/__init__.py +0 -0
- /vanna/{exceptions → legacy/exceptions}/__init__.py +0 -0
- /vanna/{google → legacy/google}/__init__.py +0 -0
- /vanna/{hf → legacy/hf}/__init__.py +0 -0
- /vanna/{local.py → legacy/local.py} +0 -0
- /vanna/{marqo → legacy/marqo}/__init__.py +0 -0
- /vanna/{marqo → legacy/marqo}/marqo.py +0 -0
- /vanna/{milvus → legacy/milvus}/__init__.py +0 -0
- /vanna/{mistral → legacy/mistral}/__init__.py +0 -0
- /vanna/{mistral → legacy/mistral}/mistral.py +0 -0
- /vanna/{mock → legacy/mock}/__init__.py +0 -0
- /vanna/{mock → legacy/mock}/embedding.py +0 -0
- /vanna/{ollama → legacy/ollama}/__init__.py +0 -0
- /vanna/{openai → legacy/openai}/__init__.py +0 -0
- /vanna/{openai → legacy/openai}/openai_embeddings.py +0 -0
- /vanna/{opensearch → legacy/opensearch}/__init__.py +0 -0
- /vanna/{oracle → legacy/oracle}/__init__.py +0 -0
- /vanna/{pgvector → legacy/pgvector}/__init__.py +0 -0
- /vanna/{pinecone → legacy/pinecone}/__init__.py +0 -0
- /vanna/{pinecone → legacy/pinecone}/pinecone_vector.py +0 -0
- /vanna/{qdrant → legacy/qdrant}/__init__.py +0 -0
- /vanna/{qianfan → legacy/qianfan}/__init__.py +0 -0
- /vanna/{qianwen → legacy/qianwen}/QianwenAI_embeddings.py +0 -0
- /vanna/{qianwen → legacy/qianwen}/__init__.py +0 -0
- /vanna/{types → legacy/types}/__init__.py +0 -0
- /vanna/{vannadb → legacy/vannadb}/__init__.py +0 -0
- /vanna/{vllm → legacy/vllm}/__init__.py +0 -0
- /vanna/{weaviate → legacy/weaviate}/__init__.py +0 -0
- /vanna/{xinference → legacy/xinference}/__init__.py +0 -0
- {vanna-0.7.8.dist-info → vanna-2.0.0.dist-info}/WHEEL +0 -0
- {vanna-0.7.8.dist-info → vanna-2.0.0.dist-info}/licenses/LICENSE +0 -0
vanna/__init__.py
CHANGED
|
@@ -1,400 +1,172 @@
|
|
|
1
|
-
import dataclasses
|
|
2
|
-
import json
|
|
3
|
-
import os
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
from typing import Callable, List, Tuple, Union
|
|
6
|
-
|
|
7
|
-
import pandas as pd
|
|
8
|
-
import requests
|
|
9
|
-
import plotly.graph_objs
|
|
10
|
-
|
|
11
|
-
from .exceptions import (
|
|
12
|
-
OTPCodeError,
|
|
13
|
-
ValidationError,
|
|
14
|
-
)
|
|
15
|
-
from .types import (
|
|
16
|
-
ApiKey,
|
|
17
|
-
Status,
|
|
18
|
-
TrainingData,
|
|
19
|
-
UserEmail,
|
|
20
|
-
UserOTP,
|
|
21
|
-
)
|
|
22
|
-
from .utils import sanitize_model_name, validate_config_path
|
|
23
|
-
|
|
24
|
-
api_key: Union[str, None] = None # API key for Vanna.AI
|
|
25
|
-
|
|
26
|
-
fig_as_img: bool = False # Whether or not to return Plotly figures as images
|
|
27
|
-
|
|
28
|
-
run_sql: Union[
|
|
29
|
-
Callable[[str], pd.DataFrame], None
|
|
30
|
-
] = None # Function to convert SQL to a Pandas DataFrame
|
|
31
1
|
"""
|
|
32
|
-
|
|
33
|
-
```python
|
|
34
|
-
vn.run_sql = lambda sql: pd.read_sql(sql, engine)
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Set the SQL to DataFrame function for Vanna.AI. This is used in the [`vn.ask(...)`][vanna.ask] function.
|
|
38
|
-
Instead of setting this directly you can also use [`vn.connect_to_snowflake(...)`][vanna.connect_to_snowflake] to set this.
|
|
2
|
+
Vanna Agents - A modular framework for building LLM agents.
|
|
39
3
|
|
|
4
|
+
This package provides a flexible framework for creating conversational AI agents
|
|
5
|
+
with tool execution, conversation management, and user scoping.
|
|
40
6
|
"""
|
|
41
7
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
118
|
-
d = __unauthenticated_rpc_call(method="verify_otp", params=params)
|
|
119
|
-
|
|
120
|
-
if "result" not in d:
|
|
121
|
-
raise OTPCodeError("Error verifying OTP code.")
|
|
122
|
-
|
|
123
|
-
key = ApiKey(**d["result"])
|
|
124
|
-
|
|
125
|
-
if key is None:
|
|
126
|
-
raise OTPCodeError("Error verifying OTP code.")
|
|
127
|
-
|
|
128
|
-
api_key = key.key
|
|
129
|
-
|
|
130
|
-
return api_key
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
def set_api_key(key: str) -> None:
|
|
134
|
-
error_deprecation()
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
def get_models() -> List[str]:
|
|
138
|
-
error_deprecation()
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def create_model(model: str, db_type: str) -> bool:
|
|
142
|
-
error_deprecation()
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
def add_user_to_model(model: str, email: str, is_admin: bool) -> bool:
|
|
146
|
-
error_deprecation()
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
def update_model_visibility(public: bool) -> bool:
|
|
150
|
-
error_deprecation()
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
def set_model(model: str):
|
|
154
|
-
error_deprecation()
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
def add_sql(
|
|
158
|
-
question: str, sql: str, tag: Union[str, None] = "Manually Trained"
|
|
159
|
-
) -> bool:
|
|
160
|
-
error_deprecation()
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
def add_ddl(ddl: str) -> bool:
|
|
164
|
-
error_deprecation()
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
def add_documentation(documentation: str) -> bool:
|
|
168
|
-
error_deprecation()
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
@dataclass
|
|
172
|
-
class TrainingPlanItem:
|
|
173
|
-
item_type: str
|
|
174
|
-
item_group: str
|
|
175
|
-
item_name: str
|
|
176
|
-
item_value: str
|
|
177
|
-
|
|
178
|
-
def __str__(self):
|
|
179
|
-
if self.item_type == self.ITEM_TYPE_SQL:
|
|
180
|
-
return f"Train on SQL: {self.item_group} {self.item_name}"
|
|
181
|
-
elif self.item_type == self.ITEM_TYPE_DDL:
|
|
182
|
-
return f"Train on DDL: {self.item_group} {self.item_name}"
|
|
183
|
-
elif self.item_type == self.ITEM_TYPE_IS:
|
|
184
|
-
return f"Train on Information Schema: {self.item_group} {self.item_name}"
|
|
185
|
-
|
|
186
|
-
ITEM_TYPE_SQL = "sql"
|
|
187
|
-
ITEM_TYPE_DDL = "ddl"
|
|
188
|
-
ITEM_TYPE_IS = "is"
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
class TrainingPlan:
|
|
192
|
-
"""
|
|
193
|
-
A class representing a training plan. You can see what's in it, and remove items from it that you don't want trained.
|
|
194
|
-
|
|
195
|
-
**Example:**
|
|
196
|
-
```python
|
|
197
|
-
plan = vn.get_training_plan()
|
|
198
|
-
|
|
199
|
-
plan.get_summary()
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
"""
|
|
203
|
-
|
|
204
|
-
_plan: List[TrainingPlanItem]
|
|
205
|
-
|
|
206
|
-
def __init__(self, plan: List[TrainingPlanItem]):
|
|
207
|
-
self._plan = plan
|
|
208
|
-
|
|
209
|
-
def __str__(self):
|
|
210
|
-
return "\n".join(self.get_summary())
|
|
211
|
-
|
|
212
|
-
def __repr__(self):
|
|
213
|
-
return self.__str__()
|
|
214
|
-
|
|
215
|
-
def get_summary(self) -> List[str]:
|
|
216
|
-
"""
|
|
217
|
-
**Example:**
|
|
218
|
-
```python
|
|
219
|
-
plan = vn.get_training_plan()
|
|
220
|
-
|
|
221
|
-
plan.get_summary()
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
Get a summary of the training plan.
|
|
225
|
-
|
|
226
|
-
Returns:
|
|
227
|
-
List[str]: A list of strings describing the training plan.
|
|
228
|
-
"""
|
|
229
|
-
|
|
230
|
-
return [f"{item}" for item in self._plan]
|
|
231
|
-
|
|
232
|
-
def remove_item(self, item: str):
|
|
233
|
-
"""
|
|
234
|
-
**Example:**
|
|
235
|
-
```python
|
|
236
|
-
plan = vn.get_training_plan()
|
|
237
|
-
|
|
238
|
-
plan.remove_item("Train on SQL: What is the average salary of employees?")
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
Remove an item from the training plan.
|
|
242
|
-
|
|
243
|
-
Args:
|
|
244
|
-
item (str): The item to remove.
|
|
245
|
-
"""
|
|
246
|
-
for plan_item in self._plan:
|
|
247
|
-
if str(plan_item) == item:
|
|
248
|
-
self._plan.remove(plan_item)
|
|
249
|
-
break
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
def get_training_plan_postgres(
|
|
253
|
-
filter_databases: Union[List[str], None] = None,
|
|
254
|
-
filter_schemas: Union[List[str], None] = None,
|
|
255
|
-
include_information_schema: bool = False,
|
|
256
|
-
use_historical_queries: bool = True,
|
|
257
|
-
) -> TrainingPlan:
|
|
258
|
-
error_deprecation()
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
def get_training_plan_generic(df) -> TrainingPlan:
|
|
262
|
-
error_deprecation()
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
def get_training_plan_experimental(
|
|
266
|
-
filter_databases: Union[List[str], None] = None,
|
|
267
|
-
filter_schemas: Union[List[str], None] = None,
|
|
268
|
-
include_information_schema: bool = False,
|
|
269
|
-
use_historical_queries: bool = True,
|
|
270
|
-
) -> TrainingPlan:
|
|
271
|
-
error_deprecation()
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
def train(
|
|
275
|
-
question: str = None,
|
|
276
|
-
sql: str = None,
|
|
277
|
-
ddl: str = None,
|
|
278
|
-
documentation: str = None,
|
|
279
|
-
json_file: str = None,
|
|
280
|
-
sql_file: str = None,
|
|
281
|
-
plan: TrainingPlan = None,
|
|
282
|
-
) -> bool:
|
|
283
|
-
error_deprecation()
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
def flag_sql_for_review(
|
|
287
|
-
question: str, sql: Union[str, None] = None, error_msg: Union[str, None] = None
|
|
288
|
-
) -> bool:
|
|
289
|
-
error_deprecation()
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
def remove_sql(question: str) -> bool:
|
|
293
|
-
error_deprecation()
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
def remove_training_data(id: str) -> bool:
|
|
297
|
-
error_deprecation()
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
def generate_sql(question: str) -> str:
|
|
301
|
-
error_deprecation()
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
def get_related_training_data(question: str) -> TrainingData:
|
|
305
|
-
error_deprecation()
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
def generate_meta(question: str) -> str:
|
|
309
|
-
error_deprecation()
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
def generate_followup_questions(question: str, df: pd.DataFrame) -> List[str]:
|
|
313
|
-
error_deprecation()
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
def generate_questions() -> List[str]:
|
|
317
|
-
error_deprecation()
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
def ask(
|
|
321
|
-
question: Union[str, None] = None,
|
|
322
|
-
print_results: bool = True,
|
|
323
|
-
auto_train: bool = True,
|
|
324
|
-
generate_followups: bool = True,
|
|
325
|
-
) -> Union[
|
|
326
|
-
Tuple[
|
|
327
|
-
Union[str, None],
|
|
328
|
-
Union[pd.DataFrame, None],
|
|
329
|
-
Union[plotly.graph_objs.Figure, None],
|
|
330
|
-
Union[List[str], None],
|
|
331
|
-
],
|
|
332
|
-
None,
|
|
333
|
-
]:
|
|
334
|
-
error_deprecation()
|
|
335
|
-
|
|
336
|
-
def generate_plotly_code(
|
|
337
|
-
question: Union[str, None],
|
|
338
|
-
sql: Union[str, None],
|
|
339
|
-
df: pd.DataFrame,
|
|
340
|
-
chart_instructions: Union[str, None] = None,
|
|
341
|
-
) -> str:
|
|
342
|
-
error_deprecation()
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
def get_plotly_figure(
|
|
346
|
-
plotly_code: str, df: pd.DataFrame, dark_mode: bool = True
|
|
347
|
-
) -> plotly.graph_objs.Figure:
|
|
348
|
-
error_deprecation()
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
def get_results(cs, default_database: str, sql: str) -> pd.DataFrame:
|
|
352
|
-
error_deprecation()
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
def generate_explanation(sql: str) -> str:
|
|
356
|
-
error_deprecation()
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
def generate_question(sql: str) -> str:
|
|
360
|
-
error_deprecation()
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
def get_all_questions() -> pd.DataFrame:
|
|
364
|
-
error_deprecation()
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
def get_training_data() -> pd.DataFrame:
|
|
368
|
-
error_deprecation()
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
def connect_to_sqlite(url: str):
|
|
372
|
-
error_deprecation()
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
def connect_to_snowflake(
|
|
376
|
-
account: str,
|
|
377
|
-
username: str,
|
|
378
|
-
password: str,
|
|
379
|
-
database: str,
|
|
380
|
-
schema: Union[str, None] = None,
|
|
381
|
-
role: Union[str, None] = None,
|
|
382
|
-
):
|
|
383
|
-
error_deprecation()
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
def connect_to_postgres(
|
|
387
|
-
host: str = None,
|
|
388
|
-
dbname: str = None,
|
|
389
|
-
user: str = None,
|
|
390
|
-
password: str = None,
|
|
391
|
-
port: int = None,
|
|
392
|
-
):
|
|
393
|
-
error_deprecation()
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
def connect_to_bigquery(cred_file_path: str = None, project_id: str = None):
|
|
397
|
-
error_deprecation()
|
|
8
|
+
# Version information
|
|
9
|
+
__version__ = "0.1.0"
|
|
10
|
+
|
|
11
|
+
# Import core framework components
|
|
12
|
+
from .core import (
|
|
13
|
+
# Interfaces
|
|
14
|
+
Agent,
|
|
15
|
+
ConversationStore,
|
|
16
|
+
LlmService,
|
|
17
|
+
SystemPromptBuilder,
|
|
18
|
+
Tool,
|
|
19
|
+
UserService,
|
|
20
|
+
T,
|
|
21
|
+
# Models
|
|
22
|
+
Conversation,
|
|
23
|
+
LlmMessage,
|
|
24
|
+
LlmRequest,
|
|
25
|
+
LlmResponse,
|
|
26
|
+
LlmStreamChunk,
|
|
27
|
+
Message,
|
|
28
|
+
ToolCall,
|
|
29
|
+
ToolContext,
|
|
30
|
+
ToolResult,
|
|
31
|
+
ToolSchema,
|
|
32
|
+
User,
|
|
33
|
+
# UI Components
|
|
34
|
+
UiComponent,
|
|
35
|
+
SimpleComponent,
|
|
36
|
+
SimpleComponentType,
|
|
37
|
+
SimpleTextComponent,
|
|
38
|
+
SimpleImageComponent,
|
|
39
|
+
SimpleLinkComponent,
|
|
40
|
+
# Rich Components
|
|
41
|
+
ArtifactComponent,
|
|
42
|
+
BadgeComponent,
|
|
43
|
+
CardComponent,
|
|
44
|
+
DataFrameComponent,
|
|
45
|
+
IconTextComponent,
|
|
46
|
+
LogViewerComponent,
|
|
47
|
+
NotificationComponent,
|
|
48
|
+
ProgressBarComponent,
|
|
49
|
+
ProgressDisplayComponent,
|
|
50
|
+
RichTextComponent,
|
|
51
|
+
StatusCardComponent,
|
|
52
|
+
TaskListComponent,
|
|
53
|
+
# Core implementations
|
|
54
|
+
Agent,
|
|
55
|
+
AgentConfig,
|
|
56
|
+
DefaultSystemPromptBuilder,
|
|
57
|
+
DefaultWorkflowHandler,
|
|
58
|
+
ToolRegistry,
|
|
59
|
+
# Evaluation
|
|
60
|
+
Evaluator,
|
|
61
|
+
TestCase,
|
|
62
|
+
ExpectedOutcome,
|
|
63
|
+
AgentResult,
|
|
64
|
+
EvaluationResult,
|
|
65
|
+
TestCaseResult,
|
|
66
|
+
AgentVariant,
|
|
67
|
+
EvaluationRunner,
|
|
68
|
+
TrajectoryEvaluator,
|
|
69
|
+
OutputEvaluator,
|
|
70
|
+
LLMAsJudgeEvaluator,
|
|
71
|
+
EfficiencyEvaluator,
|
|
72
|
+
EvaluationReport,
|
|
73
|
+
ComparisonReport,
|
|
74
|
+
EvaluationDataset,
|
|
75
|
+
# Exceptions
|
|
76
|
+
AgentError,
|
|
77
|
+
ConversationNotFoundError,
|
|
78
|
+
LlmServiceError,
|
|
79
|
+
PermissionError,
|
|
80
|
+
ToolExecutionError,
|
|
81
|
+
ToolNotFoundError,
|
|
82
|
+
ValidationError,
|
|
83
|
+
)
|
|
398
84
|
|
|
399
|
-
|
|
400
|
-
|
|
85
|
+
# Import basic implementations
|
|
86
|
+
from .integrations import MemoryConversationStore, MockLlmService
|
|
87
|
+
|
|
88
|
+
# Main exports
|
|
89
|
+
__all__ = [
|
|
90
|
+
# Version
|
|
91
|
+
"__version__",
|
|
92
|
+
# Core interfaces
|
|
93
|
+
"Agent",
|
|
94
|
+
"Tool",
|
|
95
|
+
"LlmService",
|
|
96
|
+
"ConversationStore",
|
|
97
|
+
"UserService",
|
|
98
|
+
"SystemPromptBuilder",
|
|
99
|
+
"T",
|
|
100
|
+
# Models
|
|
101
|
+
"User",
|
|
102
|
+
"Message",
|
|
103
|
+
"Conversation",
|
|
104
|
+
"ToolCall",
|
|
105
|
+
"ToolResult",
|
|
106
|
+
"ToolContext",
|
|
107
|
+
"ToolSchema",
|
|
108
|
+
"LlmMessage",
|
|
109
|
+
"LlmRequest",
|
|
110
|
+
"LlmResponse",
|
|
111
|
+
"LlmStreamChunk",
|
|
112
|
+
# UI Components
|
|
113
|
+
"UiComponent",
|
|
114
|
+
"SimpleComponent",
|
|
115
|
+
"SimpleComponentType",
|
|
116
|
+
"SimpleTextComponent",
|
|
117
|
+
"SimpleImageComponent",
|
|
118
|
+
"SimpleLinkComponent",
|
|
119
|
+
# Rich Components
|
|
120
|
+
"ArtifactComponent",
|
|
121
|
+
"BadgeComponent",
|
|
122
|
+
"CardComponent",
|
|
123
|
+
"DataFrameComponent",
|
|
124
|
+
"IconTextComponent",
|
|
125
|
+
"LogViewerComponent",
|
|
126
|
+
"NotificationComponent",
|
|
127
|
+
"ProgressBarComponent",
|
|
128
|
+
"ProgressDisplayComponent",
|
|
129
|
+
"RichTextComponent",
|
|
130
|
+
"StatusCardComponent",
|
|
131
|
+
"TaskListComponent",
|
|
132
|
+
# Core implementations
|
|
133
|
+
"Agent",
|
|
134
|
+
"AgentConfig",
|
|
135
|
+
"ToolRegistry",
|
|
136
|
+
"DefaultSystemPromptBuilder",
|
|
137
|
+
"DefaultWorkflowHandler",
|
|
138
|
+
# Evaluation
|
|
139
|
+
"Evaluator",
|
|
140
|
+
"TestCase",
|
|
141
|
+
"ExpectedOutcome",
|
|
142
|
+
"AgentResult",
|
|
143
|
+
"EvaluationResult",
|
|
144
|
+
"TestCaseResult",
|
|
145
|
+
"AgentVariant",
|
|
146
|
+
"EvaluationRunner",
|
|
147
|
+
"TrajectoryEvaluator",
|
|
148
|
+
"OutputEvaluator",
|
|
149
|
+
"LLMAsJudgeEvaluator",
|
|
150
|
+
"EfficiencyEvaluator",
|
|
151
|
+
"EvaluationReport",
|
|
152
|
+
"ComparisonReport",
|
|
153
|
+
"EvaluationDataset",
|
|
154
|
+
# Basic implementations
|
|
155
|
+
"MemoryConversationStore",
|
|
156
|
+
"MockLlmService",
|
|
157
|
+
# Server components
|
|
158
|
+
"VannaFlaskServer",
|
|
159
|
+
"VannaFastAPIServer",
|
|
160
|
+
"ChatHandler",
|
|
161
|
+
"ChatRequest",
|
|
162
|
+
"ChatStreamChunk",
|
|
163
|
+
"ExampleAgentLoader",
|
|
164
|
+
# Exceptions
|
|
165
|
+
"AgentError",
|
|
166
|
+
"ToolExecutionError",
|
|
167
|
+
"ToolNotFoundError",
|
|
168
|
+
"PermissionError",
|
|
169
|
+
"ConversationNotFoundError",
|
|
170
|
+
"LlmServiceError",
|
|
171
|
+
"ValidationError",
|
|
172
|
+
]
|
vanna/agents/__init__.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Capabilities module.
|
|
3
|
+
|
|
4
|
+
This package contains abstractions for tool capabilities - reusable utilities
|
|
5
|
+
that tools can compose via dependency injection.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .file_system import CommandResult, FileSearchMatch, FileSystem
|
|
9
|
+
from .sql_runner import RunSqlToolArgs, SqlRunner
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"FileSystem",
|
|
13
|
+
"FileSearchMatch",
|
|
14
|
+
"CommandResult",
|
|
15
|
+
"SqlRunner",
|
|
16
|
+
"RunSqlToolArgs",
|
|
17
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent memory capability package.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .base import AgentMemory
|
|
6
|
+
from .models import (
|
|
7
|
+
MemoryStats,
|
|
8
|
+
TextMemory,
|
|
9
|
+
TextMemorySearchResult,
|
|
10
|
+
ToolMemory,
|
|
11
|
+
ToolMemorySearchResult,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"AgentMemory",
|
|
16
|
+
"TextMemory",
|
|
17
|
+
"TextMemorySearchResult",
|
|
18
|
+
"ToolMemory",
|
|
19
|
+
"ToolMemorySearchResult",
|
|
20
|
+
"MemoryStats",
|
|
21
|
+
]
|