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.
Files changed (302) hide show
  1. vanna/__init__.py +167 -395
  2. vanna/agents/__init__.py +7 -0
  3. vanna/capabilities/__init__.py +17 -0
  4. vanna/capabilities/agent_memory/__init__.py +21 -0
  5. vanna/capabilities/agent_memory/base.py +103 -0
  6. vanna/capabilities/agent_memory/models.py +53 -0
  7. vanna/capabilities/file_system/__init__.py +14 -0
  8. vanna/capabilities/file_system/base.py +71 -0
  9. vanna/capabilities/file_system/models.py +25 -0
  10. vanna/capabilities/sql_runner/__init__.py +13 -0
  11. vanna/capabilities/sql_runner/base.py +37 -0
  12. vanna/capabilities/sql_runner/models.py +13 -0
  13. vanna/components/__init__.py +92 -0
  14. vanna/components/base.py +11 -0
  15. vanna/components/rich/__init__.py +83 -0
  16. vanna/components/rich/containers/__init__.py +7 -0
  17. vanna/components/rich/containers/card.py +20 -0
  18. vanna/components/rich/data/__init__.py +9 -0
  19. vanna/components/rich/data/chart.py +17 -0
  20. vanna/components/rich/data/dataframe.py +93 -0
  21. vanna/components/rich/feedback/__init__.py +21 -0
  22. vanna/components/rich/feedback/badge.py +16 -0
  23. vanna/components/rich/feedback/icon_text.py +14 -0
  24. vanna/components/rich/feedback/log_viewer.py +41 -0
  25. vanna/components/rich/feedback/notification.py +19 -0
  26. vanna/components/rich/feedback/progress.py +37 -0
  27. vanna/components/rich/feedback/status_card.py +28 -0
  28. vanna/components/rich/feedback/status_indicator.py +14 -0
  29. vanna/components/rich/interactive/__init__.py +21 -0
  30. vanna/components/rich/interactive/button.py +95 -0
  31. vanna/components/rich/interactive/task_list.py +58 -0
  32. vanna/components/rich/interactive/ui_state.py +93 -0
  33. vanna/components/rich/specialized/__init__.py +7 -0
  34. vanna/components/rich/specialized/artifact.py +20 -0
  35. vanna/components/rich/text.py +16 -0
  36. vanna/components/simple/__init__.py +15 -0
  37. vanna/components/simple/image.py +15 -0
  38. vanna/components/simple/link.py +15 -0
  39. vanna/components/simple/text.py +11 -0
  40. vanna/core/__init__.py +193 -0
  41. vanna/core/_compat.py +19 -0
  42. vanna/core/agent/__init__.py +10 -0
  43. vanna/core/agent/agent.py +1407 -0
  44. vanna/core/agent/config.py +123 -0
  45. vanna/core/audit/__init__.py +28 -0
  46. vanna/core/audit/base.py +299 -0
  47. vanna/core/audit/models.py +131 -0
  48. vanna/core/component_manager.py +329 -0
  49. vanna/core/components.py +53 -0
  50. vanna/core/enhancer/__init__.py +11 -0
  51. vanna/core/enhancer/base.py +94 -0
  52. vanna/core/enhancer/default.py +118 -0
  53. vanna/core/enricher/__init__.py +10 -0
  54. vanna/core/enricher/base.py +59 -0
  55. vanna/core/errors.py +47 -0
  56. vanna/core/evaluation/__init__.py +81 -0
  57. vanna/core/evaluation/base.py +186 -0
  58. vanna/core/evaluation/dataset.py +254 -0
  59. vanna/core/evaluation/evaluators.py +376 -0
  60. vanna/core/evaluation/report.py +289 -0
  61. vanna/core/evaluation/runner.py +313 -0
  62. vanna/core/filter/__init__.py +10 -0
  63. vanna/core/filter/base.py +67 -0
  64. vanna/core/lifecycle/__init__.py +10 -0
  65. vanna/core/lifecycle/base.py +83 -0
  66. vanna/core/llm/__init__.py +16 -0
  67. vanna/core/llm/base.py +40 -0
  68. vanna/core/llm/models.py +61 -0
  69. vanna/core/middleware/__init__.py +10 -0
  70. vanna/core/middleware/base.py +69 -0
  71. vanna/core/observability/__init__.py +11 -0
  72. vanna/core/observability/base.py +88 -0
  73. vanna/core/observability/models.py +47 -0
  74. vanna/core/recovery/__init__.py +11 -0
  75. vanna/core/recovery/base.py +84 -0
  76. vanna/core/recovery/models.py +32 -0
  77. vanna/core/registry.py +278 -0
  78. vanna/core/rich_component.py +156 -0
  79. vanna/core/simple_component.py +27 -0
  80. vanna/core/storage/__init__.py +14 -0
  81. vanna/core/storage/base.py +46 -0
  82. vanna/core/storage/models.py +46 -0
  83. vanna/core/system_prompt/__init__.py +13 -0
  84. vanna/core/system_prompt/base.py +36 -0
  85. vanna/core/system_prompt/default.py +157 -0
  86. vanna/core/tool/__init__.py +18 -0
  87. vanna/core/tool/base.py +70 -0
  88. vanna/core/tool/models.py +84 -0
  89. vanna/core/user/__init__.py +17 -0
  90. vanna/core/user/base.py +29 -0
  91. vanna/core/user/models.py +25 -0
  92. vanna/core/user/request_context.py +70 -0
  93. vanna/core/user/resolver.py +42 -0
  94. vanna/core/validation.py +164 -0
  95. vanna/core/workflow/__init__.py +12 -0
  96. vanna/core/workflow/base.py +254 -0
  97. vanna/core/workflow/default.py +789 -0
  98. vanna/examples/__init__.py +1 -0
  99. vanna/examples/__main__.py +44 -0
  100. vanna/examples/anthropic_quickstart.py +80 -0
  101. vanna/examples/artifact_example.py +293 -0
  102. vanna/examples/claude_sqlite_example.py +236 -0
  103. vanna/examples/coding_agent_example.py +300 -0
  104. vanna/examples/custom_system_prompt_example.py +174 -0
  105. vanna/examples/default_workflow_handler_example.py +208 -0
  106. vanna/examples/email_auth_example.py +340 -0
  107. vanna/examples/evaluation_example.py +269 -0
  108. vanna/examples/extensibility_example.py +262 -0
  109. vanna/examples/minimal_example.py +67 -0
  110. vanna/examples/mock_auth_example.py +227 -0
  111. vanna/examples/mock_custom_tool.py +311 -0
  112. vanna/examples/mock_quickstart.py +79 -0
  113. vanna/examples/mock_quota_example.py +145 -0
  114. vanna/examples/mock_rich_components_demo.py +396 -0
  115. vanna/examples/mock_sqlite_example.py +223 -0
  116. vanna/examples/openai_quickstart.py +83 -0
  117. vanna/examples/primitive_components_demo.py +305 -0
  118. vanna/examples/quota_lifecycle_example.py +139 -0
  119. vanna/examples/visualization_example.py +251 -0
  120. vanna/integrations/__init__.py +17 -0
  121. vanna/integrations/anthropic/__init__.py +9 -0
  122. vanna/integrations/anthropic/llm.py +270 -0
  123. vanna/integrations/azureopenai/__init__.py +9 -0
  124. vanna/integrations/azureopenai/llm.py +329 -0
  125. vanna/integrations/azuresearch/__init__.py +7 -0
  126. vanna/integrations/azuresearch/agent_memory.py +413 -0
  127. vanna/integrations/bigquery/__init__.py +5 -0
  128. vanna/integrations/bigquery/sql_runner.py +81 -0
  129. vanna/integrations/chromadb/__init__.py +104 -0
  130. vanna/integrations/chromadb/agent_memory.py +416 -0
  131. vanna/integrations/clickhouse/__init__.py +5 -0
  132. vanna/integrations/clickhouse/sql_runner.py +82 -0
  133. vanna/integrations/duckdb/__init__.py +5 -0
  134. vanna/integrations/duckdb/sql_runner.py +65 -0
  135. vanna/integrations/faiss/__init__.py +7 -0
  136. vanna/integrations/faiss/agent_memory.py +431 -0
  137. vanna/integrations/google/__init__.py +9 -0
  138. vanna/integrations/google/gemini.py +370 -0
  139. vanna/integrations/hive/__init__.py +5 -0
  140. vanna/integrations/hive/sql_runner.py +87 -0
  141. vanna/integrations/local/__init__.py +17 -0
  142. vanna/integrations/local/agent_memory/__init__.py +7 -0
  143. vanna/integrations/local/agent_memory/in_memory.py +285 -0
  144. vanna/integrations/local/audit.py +59 -0
  145. vanna/integrations/local/file_system.py +242 -0
  146. vanna/integrations/local/file_system_conversation_store.py +255 -0
  147. vanna/integrations/local/storage.py +62 -0
  148. vanna/integrations/marqo/__init__.py +7 -0
  149. vanna/integrations/marqo/agent_memory.py +354 -0
  150. vanna/integrations/milvus/__init__.py +7 -0
  151. vanna/integrations/milvus/agent_memory.py +458 -0
  152. vanna/integrations/mock/__init__.py +9 -0
  153. vanna/integrations/mock/llm.py +65 -0
  154. vanna/integrations/mssql/__init__.py +5 -0
  155. vanna/integrations/mssql/sql_runner.py +66 -0
  156. vanna/integrations/mysql/__init__.py +5 -0
  157. vanna/integrations/mysql/sql_runner.py +92 -0
  158. vanna/integrations/ollama/__init__.py +7 -0
  159. vanna/integrations/ollama/llm.py +252 -0
  160. vanna/integrations/openai/__init__.py +10 -0
  161. vanna/integrations/openai/llm.py +267 -0
  162. vanna/integrations/openai/responses.py +163 -0
  163. vanna/integrations/opensearch/__init__.py +7 -0
  164. vanna/integrations/opensearch/agent_memory.py +411 -0
  165. vanna/integrations/oracle/__init__.py +5 -0
  166. vanna/integrations/oracle/sql_runner.py +75 -0
  167. vanna/integrations/pinecone/__init__.py +7 -0
  168. vanna/integrations/pinecone/agent_memory.py +329 -0
  169. vanna/integrations/plotly/__init__.py +5 -0
  170. vanna/integrations/plotly/chart_generator.py +313 -0
  171. vanna/integrations/postgres/__init__.py +9 -0
  172. vanna/integrations/postgres/sql_runner.py +112 -0
  173. vanna/integrations/premium/agent_memory/__init__.py +7 -0
  174. vanna/integrations/premium/agent_memory/premium.py +186 -0
  175. vanna/integrations/presto/__init__.py +5 -0
  176. vanna/integrations/presto/sql_runner.py +107 -0
  177. vanna/integrations/qdrant/__init__.py +7 -0
  178. vanna/integrations/qdrant/agent_memory.py +461 -0
  179. vanna/integrations/snowflake/__init__.py +5 -0
  180. vanna/integrations/snowflake/sql_runner.py +147 -0
  181. vanna/integrations/sqlite/__init__.py +9 -0
  182. vanna/integrations/sqlite/sql_runner.py +65 -0
  183. vanna/integrations/weaviate/__init__.py +7 -0
  184. vanna/integrations/weaviate/agent_memory.py +428 -0
  185. vanna/{ZhipuAI → legacy/ZhipuAI}/ZhipuAI_embeddings.py +11 -11
  186. vanna/legacy/__init__.py +403 -0
  187. vanna/legacy/adapter.py +463 -0
  188. vanna/{advanced → legacy/advanced}/__init__.py +3 -1
  189. vanna/{anthropic → legacy/anthropic}/anthropic_chat.py +9 -7
  190. vanna/{azuresearch → legacy/azuresearch}/azuresearch_vector.py +79 -41
  191. vanna/{base → legacy/base}/base.py +247 -223
  192. vanna/legacy/bedrock/__init__.py +1 -0
  193. vanna/{bedrock → legacy/bedrock}/bedrock_converse.py +13 -12
  194. vanna/{chromadb → legacy/chromadb}/chromadb_vector.py +3 -1
  195. vanna/legacy/cohere/__init__.py +2 -0
  196. vanna/{cohere → legacy/cohere}/cohere_chat.py +19 -14
  197. vanna/{cohere → legacy/cohere}/cohere_embeddings.py +25 -19
  198. vanna/{deepseek → legacy/deepseek}/deepseek_chat.py +5 -6
  199. vanna/legacy/faiss/__init__.py +1 -0
  200. vanna/{faiss → legacy/faiss}/faiss.py +113 -59
  201. vanna/{flask → legacy/flask}/__init__.py +84 -43
  202. vanna/{flask → legacy/flask}/assets.py +5 -5
  203. vanna/{flask → legacy/flask}/auth.py +5 -4
  204. vanna/{google → legacy/google}/bigquery_vector.py +75 -42
  205. vanna/{google → legacy/google}/gemini_chat.py +7 -3
  206. vanna/{hf → legacy/hf}/hf.py +0 -1
  207. vanna/{milvus → legacy/milvus}/milvus_vector.py +58 -35
  208. vanna/{mock → legacy/mock}/llm.py +0 -1
  209. vanna/legacy/mock/vectordb.py +67 -0
  210. vanna/legacy/ollama/ollama.py +110 -0
  211. vanna/{openai → legacy/openai}/openai_chat.py +2 -6
  212. vanna/legacy/opensearch/opensearch_vector.py +369 -0
  213. vanna/legacy/opensearch/opensearch_vector_semantic.py +200 -0
  214. vanna/legacy/oracle/oracle_vector.py +584 -0
  215. vanna/{pgvector → legacy/pgvector}/pgvector.py +42 -13
  216. vanna/{qdrant → legacy/qdrant}/qdrant.py +2 -6
  217. vanna/legacy/qianfan/Qianfan_Chat.py +170 -0
  218. vanna/legacy/qianfan/Qianfan_embeddings.py +36 -0
  219. vanna/legacy/qianwen/QianwenAI_chat.py +132 -0
  220. vanna/{remote.py → legacy/remote.py} +28 -26
  221. vanna/{utils.py → legacy/utils.py} +6 -11
  222. vanna/{vannadb → legacy/vannadb}/vannadb_vector.py +115 -46
  223. vanna/{vllm → legacy/vllm}/vllm.py +5 -6
  224. vanna/{weaviate → legacy/weaviate}/weaviate_vector.py +59 -40
  225. vanna/{xinference → legacy/xinference}/xinference.py +6 -6
  226. vanna/py.typed +0 -0
  227. vanna/servers/__init__.py +16 -0
  228. vanna/servers/__main__.py +8 -0
  229. vanna/servers/base/__init__.py +18 -0
  230. vanna/servers/base/chat_handler.py +65 -0
  231. vanna/servers/base/models.py +111 -0
  232. vanna/servers/base/rich_chat_handler.py +141 -0
  233. vanna/servers/base/templates.py +331 -0
  234. vanna/servers/cli/__init__.py +7 -0
  235. vanna/servers/cli/server_runner.py +204 -0
  236. vanna/servers/fastapi/__init__.py +7 -0
  237. vanna/servers/fastapi/app.py +163 -0
  238. vanna/servers/fastapi/routes.py +183 -0
  239. vanna/servers/flask/__init__.py +7 -0
  240. vanna/servers/flask/app.py +132 -0
  241. vanna/servers/flask/routes.py +137 -0
  242. vanna/tools/__init__.py +41 -0
  243. vanna/tools/agent_memory.py +322 -0
  244. vanna/tools/file_system.py +879 -0
  245. vanna/tools/python.py +222 -0
  246. vanna/tools/run_sql.py +165 -0
  247. vanna/tools/visualize_data.py +195 -0
  248. vanna/utils/__init__.py +0 -0
  249. vanna/web_components/__init__.py +44 -0
  250. vanna-2.0.0.dist-info/METADATA +485 -0
  251. vanna-2.0.0.dist-info/RECORD +289 -0
  252. vanna-2.0.0.dist-info/entry_points.txt +3 -0
  253. vanna/bedrock/__init__.py +0 -1
  254. vanna/cohere/__init__.py +0 -2
  255. vanna/faiss/__init__.py +0 -1
  256. vanna/mock/vectordb.py +0 -55
  257. vanna/ollama/ollama.py +0 -103
  258. vanna/opensearch/opensearch_vector.py +0 -392
  259. vanna/opensearch/opensearch_vector_semantic.py +0 -175
  260. vanna/oracle/oracle_vector.py +0 -585
  261. vanna/qianfan/Qianfan_Chat.py +0 -165
  262. vanna/qianfan/Qianfan_embeddings.py +0 -36
  263. vanna/qianwen/QianwenAI_chat.py +0 -133
  264. vanna-0.7.8.dist-info/METADATA +0 -408
  265. vanna-0.7.8.dist-info/RECORD +0 -79
  266. /vanna/{ZhipuAI → legacy/ZhipuAI}/ZhipuAI_Chat.py +0 -0
  267. /vanna/{ZhipuAI → legacy/ZhipuAI}/__init__.py +0 -0
  268. /vanna/{anthropic → legacy/anthropic}/__init__.py +0 -0
  269. /vanna/{azuresearch → legacy/azuresearch}/__init__.py +0 -0
  270. /vanna/{base → legacy/base}/__init__.py +0 -0
  271. /vanna/{chromadb → legacy/chromadb}/__init__.py +0 -0
  272. /vanna/{deepseek → legacy/deepseek}/__init__.py +0 -0
  273. /vanna/{exceptions → legacy/exceptions}/__init__.py +0 -0
  274. /vanna/{google → legacy/google}/__init__.py +0 -0
  275. /vanna/{hf → legacy/hf}/__init__.py +0 -0
  276. /vanna/{local.py → legacy/local.py} +0 -0
  277. /vanna/{marqo → legacy/marqo}/__init__.py +0 -0
  278. /vanna/{marqo → legacy/marqo}/marqo.py +0 -0
  279. /vanna/{milvus → legacy/milvus}/__init__.py +0 -0
  280. /vanna/{mistral → legacy/mistral}/__init__.py +0 -0
  281. /vanna/{mistral → legacy/mistral}/mistral.py +0 -0
  282. /vanna/{mock → legacy/mock}/__init__.py +0 -0
  283. /vanna/{mock → legacy/mock}/embedding.py +0 -0
  284. /vanna/{ollama → legacy/ollama}/__init__.py +0 -0
  285. /vanna/{openai → legacy/openai}/__init__.py +0 -0
  286. /vanna/{openai → legacy/openai}/openai_embeddings.py +0 -0
  287. /vanna/{opensearch → legacy/opensearch}/__init__.py +0 -0
  288. /vanna/{oracle → legacy/oracle}/__init__.py +0 -0
  289. /vanna/{pgvector → legacy/pgvector}/__init__.py +0 -0
  290. /vanna/{pinecone → legacy/pinecone}/__init__.py +0 -0
  291. /vanna/{pinecone → legacy/pinecone}/pinecone_vector.py +0 -0
  292. /vanna/{qdrant → legacy/qdrant}/__init__.py +0 -0
  293. /vanna/{qianfan → legacy/qianfan}/__init__.py +0 -0
  294. /vanna/{qianwen → legacy/qianwen}/QianwenAI_embeddings.py +0 -0
  295. /vanna/{qianwen → legacy/qianwen}/__init__.py +0 -0
  296. /vanna/{types → legacy/types}/__init__.py +0 -0
  297. /vanna/{vannadb → legacy/vannadb}/__init__.py +0 -0
  298. /vanna/{vllm → legacy/vllm}/__init__.py +0 -0
  299. /vanna/{weaviate → legacy/weaviate}/__init__.py +0 -0
  300. /vanna/{xinference → legacy/xinference}/__init__.py +0 -0
  301. {vanna-0.7.8.dist-info → vanna-2.0.0.dist-info}/WHEEL +0 -0
  302. {vanna-0.7.8.dist-info → vanna-2.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,403 @@
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[Callable[[str], pd.DataFrame], None] = (
29
+ None # Function to convert SQL to a Pandas DataFrame
30
+ )
31
+ """
32
+ **Example**
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.
39
+
40
+ """
41
+
42
+ __org: Union[str, None] = None # Organization name for Vanna.AI
43
+
44
+ _unauthenticated_endpoint = "https://ask.vanna.ai/unauthenticated_rpc"
45
+
46
+
47
+ def error_deprecation():
48
+ raise Exception("""
49
+ Please switch to the following method for initializing Vanna:
50
+
51
+ from vanna.remote import VannaDefault
52
+
53
+ api_key = # Your API key from https://vanna.ai/account/profile
54
+ vanna_model_name = # Your model name from https://vanna.ai/account/profile
55
+
56
+ vn = VannaDefault(model=vanna_model_name, api_key=api_key)
57
+ """)
58
+
59
+
60
+ def __unauthenticated_rpc_call(method, params):
61
+ headers = {
62
+ "Content-Type": "application/json",
63
+ }
64
+ data = {"method": method, "params": [__dataclass_to_dict(obj) for obj in params]}
65
+
66
+ response = requests.post(
67
+ _unauthenticated_endpoint, headers=headers, data=json.dumps(data)
68
+ )
69
+ return response.json()
70
+
71
+
72
+ def __dataclass_to_dict(obj):
73
+ return dataclasses.asdict(obj)
74
+
75
+
76
+ def get_api_key(email: str, otp_code: Union[str, None] = None) -> str:
77
+ """
78
+ **Example:**
79
+ ```python
80
+ vn.get_api_key(email="my-email@example.com")
81
+ ```
82
+
83
+ Login to the Vanna.AI API.
84
+
85
+ Args:
86
+ email (str): The email address to login with.
87
+ otp_code (Union[str, None]): The OTP code to login with. If None, an OTP code will be sent to the email address.
88
+
89
+ Returns:
90
+ str: The API key.
91
+ """
92
+ vanna_api_key = os.environ.get("VANNA_API_KEY", None)
93
+
94
+ if vanna_api_key is not None:
95
+ return vanna_api_key
96
+
97
+ if email == "my-email@example.com":
98
+ raise ValidationError(
99
+ "Please replace 'my-email@example.com' with your email address."
100
+ )
101
+
102
+ if otp_code is None:
103
+ params = [UserEmail(email=email)]
104
+
105
+ d = __unauthenticated_rpc_call(method="send_otp", params=params)
106
+
107
+ if "result" not in d:
108
+ raise OTPCodeError("Error sending OTP code.")
109
+
110
+ status = Status(**d["result"])
111
+
112
+ if not status.success:
113
+ raise OTPCodeError(f"Error sending OTP code: {status.message}")
114
+
115
+ otp_code = input("Check your email for the code and enter it here: ")
116
+
117
+ params = [UserOTP(email=email, otp=otp_code)]
118
+
119
+ d = __unauthenticated_rpc_call(method="verify_otp", params=params)
120
+
121
+ if "result" not in d:
122
+ raise OTPCodeError("Error verifying OTP code.")
123
+
124
+ key = ApiKey(**d["result"])
125
+
126
+ if key is None:
127
+ raise OTPCodeError("Error verifying OTP code.")
128
+
129
+ api_key = key.key
130
+
131
+ return api_key
132
+
133
+
134
+ def set_api_key(key: str) -> None:
135
+ error_deprecation()
136
+
137
+
138
+ def get_models() -> List[str]:
139
+ error_deprecation()
140
+
141
+
142
+ def create_model(model: str, db_type: str) -> bool:
143
+ error_deprecation()
144
+
145
+
146
+ def add_user_to_model(model: str, email: str, is_admin: bool) -> bool:
147
+ error_deprecation()
148
+
149
+
150
+ def update_model_visibility(public: bool) -> bool:
151
+ error_deprecation()
152
+
153
+
154
+ def set_model(model: str):
155
+ error_deprecation()
156
+
157
+
158
+ def add_sql(
159
+ question: str, sql: str, tag: Union[str, None] = "Manually Trained"
160
+ ) -> bool:
161
+ error_deprecation()
162
+
163
+
164
+ def add_ddl(ddl: str) -> bool:
165
+ error_deprecation()
166
+
167
+
168
+ def add_documentation(documentation: str) -> bool:
169
+ error_deprecation()
170
+
171
+
172
+ @dataclass
173
+ class TrainingPlanItem:
174
+ item_type: str
175
+ item_group: str
176
+ item_name: str
177
+ item_value: str
178
+
179
+ def __str__(self):
180
+ if self.item_type == self.ITEM_TYPE_SQL:
181
+ return f"Train on SQL: {self.item_group} {self.item_name}"
182
+ elif self.item_type == self.ITEM_TYPE_DDL:
183
+ return f"Train on DDL: {self.item_group} {self.item_name}"
184
+ elif self.item_type == self.ITEM_TYPE_IS:
185
+ return f"Train on Information Schema: {self.item_group} {self.item_name}"
186
+
187
+ ITEM_TYPE_SQL = "sql"
188
+ ITEM_TYPE_DDL = "ddl"
189
+ ITEM_TYPE_IS = "is"
190
+
191
+
192
+ class TrainingPlan:
193
+ """
194
+ A class representing a training plan. You can see what's in it, and remove items from it that you don't want trained.
195
+
196
+ **Example:**
197
+ ```python
198
+ plan = vn.get_training_plan()
199
+
200
+ plan.get_summary()
201
+ ```
202
+
203
+ """
204
+
205
+ _plan: List[TrainingPlanItem]
206
+
207
+ def __init__(self, plan: List[TrainingPlanItem]):
208
+ self._plan = plan
209
+
210
+ def __str__(self):
211
+ return "\n".join(self.get_summary())
212
+
213
+ def __repr__(self):
214
+ return self.__str__()
215
+
216
+ def get_summary(self) -> List[str]:
217
+ """
218
+ **Example:**
219
+ ```python
220
+ plan = vn.get_training_plan()
221
+
222
+ plan.get_summary()
223
+ ```
224
+
225
+ Get a summary of the training plan.
226
+
227
+ Returns:
228
+ List[str]: A list of strings describing the training plan.
229
+ """
230
+
231
+ return [f"{item}" for item in self._plan]
232
+
233
+ def remove_item(self, item: str):
234
+ """
235
+ **Example:**
236
+ ```python
237
+ plan = vn.get_training_plan()
238
+
239
+ plan.remove_item("Train on SQL: What is the average salary of employees?")
240
+ ```
241
+
242
+ Remove an item from the training plan.
243
+
244
+ Args:
245
+ item (str): The item to remove.
246
+ """
247
+ for plan_item in self._plan:
248
+ if str(plan_item) == item:
249
+ self._plan.remove(plan_item)
250
+ break
251
+
252
+
253
+ def get_training_plan_postgres(
254
+ filter_databases: Union[List[str], None] = None,
255
+ filter_schemas: Union[List[str], None] = None,
256
+ include_information_schema: bool = False,
257
+ use_historical_queries: bool = True,
258
+ ) -> TrainingPlan:
259
+ error_deprecation()
260
+
261
+
262
+ def get_training_plan_generic(df) -> TrainingPlan:
263
+ error_deprecation()
264
+
265
+
266
+ def get_training_plan_experimental(
267
+ filter_databases: Union[List[str], None] = None,
268
+ filter_schemas: Union[List[str], None] = None,
269
+ include_information_schema: bool = False,
270
+ use_historical_queries: bool = True,
271
+ ) -> TrainingPlan:
272
+ error_deprecation()
273
+
274
+
275
+ def train(
276
+ question: str = None,
277
+ sql: str = None,
278
+ ddl: str = None,
279
+ documentation: str = None,
280
+ json_file: str = None,
281
+ sql_file: str = None,
282
+ plan: TrainingPlan = None,
283
+ ) -> bool:
284
+ error_deprecation()
285
+
286
+
287
+ def flag_sql_for_review(
288
+ question: str, sql: Union[str, None] = None, error_msg: Union[str, None] = None
289
+ ) -> bool:
290
+ error_deprecation()
291
+
292
+
293
+ def remove_sql(question: str) -> bool:
294
+ error_deprecation()
295
+
296
+
297
+ def remove_training_data(id: str) -> bool:
298
+ error_deprecation()
299
+
300
+
301
+ def generate_sql(question: str) -> str:
302
+ error_deprecation()
303
+
304
+
305
+ def get_related_training_data(question: str) -> TrainingData:
306
+ error_deprecation()
307
+
308
+
309
+ def generate_meta(question: str) -> str:
310
+ error_deprecation()
311
+
312
+
313
+ def generate_followup_questions(question: str, df: pd.DataFrame) -> List[str]:
314
+ error_deprecation()
315
+
316
+
317
+ def generate_questions() -> List[str]:
318
+ error_deprecation()
319
+
320
+
321
+ def ask(
322
+ question: Union[str, None] = None,
323
+ print_results: bool = True,
324
+ auto_train: bool = True,
325
+ generate_followups: bool = True,
326
+ ) -> Union[
327
+ Tuple[
328
+ Union[str, None],
329
+ Union[pd.DataFrame, None],
330
+ Union[plotly.graph_objs.Figure, None],
331
+ Union[List[str], None],
332
+ ],
333
+ None,
334
+ ]:
335
+ error_deprecation()
336
+
337
+
338
+ def generate_plotly_code(
339
+ question: Union[str, None],
340
+ sql: Union[str, None],
341
+ df: pd.DataFrame,
342
+ chart_instructions: Union[str, None] = None,
343
+ ) -> str:
344
+ error_deprecation()
345
+
346
+
347
+ def get_plotly_figure(
348
+ plotly_code: str, df: pd.DataFrame, dark_mode: bool = True
349
+ ) -> plotly.graph_objs.Figure:
350
+ error_deprecation()
351
+
352
+
353
+ def get_results(cs, default_database: str, sql: str) -> pd.DataFrame:
354
+ error_deprecation()
355
+
356
+
357
+ def generate_explanation(sql: str) -> str:
358
+ error_deprecation()
359
+
360
+
361
+ def generate_question(sql: str) -> str:
362
+ error_deprecation()
363
+
364
+
365
+ def get_all_questions() -> pd.DataFrame:
366
+ error_deprecation()
367
+
368
+
369
+ def get_training_data() -> pd.DataFrame:
370
+ error_deprecation()
371
+
372
+
373
+ def connect_to_sqlite(url: str):
374
+ error_deprecation()
375
+
376
+
377
+ def connect_to_snowflake(
378
+ account: str,
379
+ username: str,
380
+ password: str,
381
+ database: str,
382
+ schema: Union[str, None] = None,
383
+ role: Union[str, None] = None,
384
+ ):
385
+ error_deprecation()
386
+
387
+
388
+ def connect_to_postgres(
389
+ host: str = None,
390
+ dbname: str = None,
391
+ user: str = None,
392
+ password: str = None,
393
+ port: int = None,
394
+ ):
395
+ error_deprecation()
396
+
397
+
398
+ def connect_to_bigquery(cred_file_path: str = None, project_id: str = None):
399
+ error_deprecation()
400
+
401
+
402
+ def connect_to_duckdb(url: str = "memory", init_sql: str = None):
403
+ error_deprecation()