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,103 @@
1
+ """
2
+ Agent memory capability interface for tool usage learning.
3
+
4
+ This module contains the abstract base class for agent memory operations,
5
+ following the same pattern as the FileSystem interface.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from abc import ABC, abstractmethod
11
+ from typing import TYPE_CHECKING, Any, Dict, List, Optional
12
+
13
+ if TYPE_CHECKING:
14
+ from vanna.core.tool import ToolContext
15
+ from .models import (
16
+ ToolMemorySearchResult,
17
+ TextMemory,
18
+ TextMemorySearchResult,
19
+ ToolMemory,
20
+ )
21
+
22
+
23
+ class AgentMemory(ABC):
24
+ """Abstract base class for agent memory operations."""
25
+
26
+ @abstractmethod
27
+ async def save_tool_usage(
28
+ self,
29
+ question: str,
30
+ tool_name: str,
31
+ args: Dict[str, Any],
32
+ context: "ToolContext",
33
+ success: bool = True,
34
+ metadata: Optional[Dict[str, Any]] = None,
35
+ ) -> None:
36
+ """Save a tool usage pattern for future reference."""
37
+ pass
38
+
39
+ @abstractmethod
40
+ async def save_text_memory(
41
+ self, content: str, context: "ToolContext"
42
+ ) -> "TextMemory":
43
+ """Save a free-form text memory."""
44
+ pass
45
+
46
+ @abstractmethod
47
+ async def search_similar_usage(
48
+ self,
49
+ question: str,
50
+ context: "ToolContext",
51
+ *,
52
+ limit: int = 10,
53
+ similarity_threshold: float = 0.7,
54
+ tool_name_filter: Optional[str] = None,
55
+ ) -> List[ToolMemorySearchResult]:
56
+ """Search for similar tool usage patterns based on a question."""
57
+ pass
58
+
59
+ @abstractmethod
60
+ async def search_text_memories(
61
+ self,
62
+ query: str,
63
+ context: "ToolContext",
64
+ *,
65
+ limit: int = 10,
66
+ similarity_threshold: float = 0.7,
67
+ ) -> List["TextMemorySearchResult"]:
68
+ """Search stored text memories based on a query."""
69
+ pass
70
+
71
+ @abstractmethod
72
+ async def get_recent_memories(
73
+ self, context: "ToolContext", limit: int = 10
74
+ ) -> List[ToolMemory]:
75
+ """Get recently added memories. Returns most recent memories first."""
76
+ pass
77
+
78
+ @abstractmethod
79
+ async def get_recent_text_memories(
80
+ self, context: "ToolContext", limit: int = 10
81
+ ) -> List["TextMemory"]:
82
+ """Fetch recently stored text memories."""
83
+ pass
84
+
85
+ @abstractmethod
86
+ async def delete_by_id(self, context: "ToolContext", memory_id: str) -> bool:
87
+ """Delete a memory by its ID. Returns True if deleted, False if not found."""
88
+ pass
89
+
90
+ @abstractmethod
91
+ async def delete_text_memory(self, context: "ToolContext", memory_id: str) -> bool:
92
+ """Delete a text memory by its ID. Returns True if deleted, False if not found."""
93
+ pass
94
+
95
+ @abstractmethod
96
+ async def clear_memories(
97
+ self,
98
+ context: "ToolContext",
99
+ tool_name: Optional[str] = None,
100
+ before_date: Optional[str] = None,
101
+ ) -> int:
102
+ """Clear stored memories (tool or text). Returns number of memories deleted."""
103
+ pass
@@ -0,0 +1,53 @@
1
+ """
2
+ Memory storage models and types.
3
+ """
4
+
5
+ from typing import Any, Dict, List, Optional
6
+
7
+ from pydantic import BaseModel
8
+
9
+
10
+ class ToolMemory(BaseModel):
11
+ """Represents a stored tool usage memory."""
12
+
13
+ memory_id: Optional[str] = None
14
+ question: str
15
+ tool_name: str
16
+ args: Dict[str, Any]
17
+ timestamp: Optional[str] = None
18
+ success: bool = True
19
+ metadata: Optional[Dict[str, Any]] = None
20
+
21
+
22
+ class TextMemory(BaseModel):
23
+ """Represents a stored free-form text memory."""
24
+
25
+ memory_id: Optional[str] = None
26
+ content: str
27
+ timestamp: Optional[str] = None
28
+
29
+
30
+ class ToolMemorySearchResult(BaseModel):
31
+ """Represents a search result from tool memory storage."""
32
+
33
+ memory: ToolMemory
34
+ similarity_score: float
35
+ rank: int
36
+
37
+
38
+ class TextMemorySearchResult(BaseModel):
39
+ """Represents a search result from text memory storage."""
40
+
41
+ memory: TextMemory
42
+ similarity_score: float
43
+ rank: int
44
+
45
+
46
+ class MemoryStats(BaseModel):
47
+ """Memory storage statistics."""
48
+
49
+ total_memories: int
50
+ unique_tools: int
51
+ unique_questions: int
52
+ success_rate: float
53
+ most_used_tools: Dict[str, int]
@@ -0,0 +1,14 @@
1
+ """
2
+ File system capability.
3
+
4
+ This module provides abstractions for file system operations used by tools.
5
+ """
6
+
7
+ from .base import FileSystem
8
+ from .models import CommandResult, FileSearchMatch
9
+
10
+ __all__ = [
11
+ "FileSystem",
12
+ "FileSearchMatch",
13
+ "CommandResult",
14
+ ]
@@ -0,0 +1,71 @@
1
+ """
2
+ File system capability interface.
3
+
4
+ This module contains the abstract base class for file system operations.
5
+ """
6
+
7
+ from abc import ABC, abstractmethod
8
+ from typing import TYPE_CHECKING, List, Optional
9
+
10
+ from .models import CommandResult, FileSearchMatch
11
+
12
+ if TYPE_CHECKING:
13
+ from vanna.core.tool import ToolContext
14
+
15
+
16
+ class FileSystem(ABC):
17
+ """Abstract base class for file system operations."""
18
+
19
+ @abstractmethod
20
+ async def list_files(self, directory: str, context: "ToolContext") -> List[str]:
21
+ """List files in a directory."""
22
+ pass
23
+
24
+ @abstractmethod
25
+ async def read_file(self, filename: str, context: "ToolContext") -> str:
26
+ """Read the contents of a file."""
27
+ pass
28
+
29
+ @abstractmethod
30
+ async def write_file(
31
+ self,
32
+ filename: str,
33
+ content: str,
34
+ context: "ToolContext",
35
+ overwrite: bool = False,
36
+ ) -> None:
37
+ """Write content to a file."""
38
+ pass
39
+
40
+ @abstractmethod
41
+ async def exists(self, path: str, context: "ToolContext") -> bool:
42
+ """Check if a file or directory exists."""
43
+ pass
44
+
45
+ @abstractmethod
46
+ async def is_directory(self, path: str, context: "ToolContext") -> bool:
47
+ """Check if a path is a directory."""
48
+ pass
49
+
50
+ @abstractmethod
51
+ async def search_files(
52
+ self,
53
+ query: str,
54
+ context: "ToolContext",
55
+ *,
56
+ max_results: int = 20,
57
+ include_content: bool = False,
58
+ ) -> List[FileSearchMatch]:
59
+ """Search for files matching a query within the accessible namespace."""
60
+ pass
61
+
62
+ @abstractmethod
63
+ async def run_bash(
64
+ self,
65
+ command: str,
66
+ context: "ToolContext",
67
+ *,
68
+ timeout: Optional[float] = None,
69
+ ) -> CommandResult:
70
+ """Execute a bash command within the accessible namespace."""
71
+ pass
@@ -0,0 +1,25 @@
1
+ """
2
+ File system capability models.
3
+
4
+ This module contains data models for file system operations.
5
+ """
6
+
7
+ from dataclasses import dataclass
8
+ from typing import Optional
9
+
10
+
11
+ @dataclass
12
+ class FileSearchMatch:
13
+ """Represents a single search result within a file system."""
14
+
15
+ path: str
16
+ snippet: Optional[str] = None
17
+
18
+
19
+ @dataclass
20
+ class CommandResult:
21
+ """Represents the result of executing a shell command."""
22
+
23
+ stdout: str
24
+ stderr: str
25
+ returncode: int
@@ -0,0 +1,13 @@
1
+ """
2
+ SQL runner capability.
3
+
4
+ This module provides abstractions for SQL execution used by tools.
5
+ """
6
+
7
+ from .base import SqlRunner
8
+ from .models import RunSqlToolArgs
9
+
10
+ __all__ = [
11
+ "SqlRunner",
12
+ "RunSqlToolArgs",
13
+ ]
@@ -0,0 +1,37 @@
1
+ """
2
+ SQL runner capability interface.
3
+
4
+ This module contains the abstract base class for SQL execution.
5
+ """
6
+
7
+ from abc import ABC, abstractmethod
8
+ from typing import TYPE_CHECKING
9
+
10
+ import pandas as pd
11
+
12
+ from .models import RunSqlToolArgs
13
+
14
+ if TYPE_CHECKING:
15
+ from vanna.core.tool import ToolContext
16
+
17
+
18
+ class SqlRunner(ABC):
19
+ """Interface for SQL execution with different implementations."""
20
+
21
+ @abstractmethod
22
+ async def run_sql(
23
+ self, args: RunSqlToolArgs, context: "ToolContext"
24
+ ) -> pd.DataFrame:
25
+ """Execute SQL query and return results as a DataFrame.
26
+
27
+ Args:
28
+ args: SQL query arguments
29
+ context: Tool execution context
30
+
31
+ Returns:
32
+ DataFrame with query results
33
+
34
+ Raises:
35
+ Exception: If query execution fails
36
+ """
37
+ pass
@@ -0,0 +1,13 @@
1
+ """
2
+ SQL runner capability models.
3
+
4
+ This module contains data models for SQL execution.
5
+ """
6
+
7
+ from pydantic import BaseModel, Field
8
+
9
+
10
+ class RunSqlToolArgs(BaseModel):
11
+ """Arguments for run_sql tool."""
12
+
13
+ sql: str = Field(description="SQL query to execute")
@@ -0,0 +1,92 @@
1
+ """UI Component system for Vanna Agents."""
2
+
3
+ # Base component
4
+ from .base import UiComponent
5
+
6
+ # Simple components
7
+ from .simple import (
8
+ SimpleComponent,
9
+ SimpleComponentType,
10
+ SimpleTextComponent,
11
+ SimpleImageComponent,
12
+ SimpleLinkComponent,
13
+ )
14
+
15
+ # Rich components - re-export all
16
+ from .rich import (
17
+ # Base
18
+ RichComponent,
19
+ ComponentType,
20
+ ComponentLifecycle,
21
+ # Text
22
+ RichTextComponent,
23
+ # Data
24
+ DataFrameComponent,
25
+ ChartComponent,
26
+ # Feedback
27
+ NotificationComponent,
28
+ StatusCardComponent,
29
+ ProgressBarComponent,
30
+ ProgressDisplayComponent,
31
+ StatusIndicatorComponent,
32
+ LogViewerComponent,
33
+ LogEntry,
34
+ BadgeComponent,
35
+ IconTextComponent,
36
+ # Interactive
37
+ TaskListComponent,
38
+ Task,
39
+ StatusBarUpdateComponent,
40
+ TaskTrackerUpdateComponent,
41
+ ChatInputUpdateComponent,
42
+ TaskOperation,
43
+ ButtonComponent,
44
+ ButtonGroupComponent,
45
+ # Containers
46
+ CardComponent,
47
+ # Specialized
48
+ ArtifactComponent,
49
+ )
50
+
51
+ __all__ = [
52
+ # Base
53
+ "UiComponent",
54
+ # Simple components
55
+ "SimpleComponent",
56
+ "SimpleComponentType",
57
+ "SimpleTextComponent",
58
+ "SimpleImageComponent",
59
+ "SimpleLinkComponent",
60
+ # Rich components - Base
61
+ "RichComponent",
62
+ "ComponentType",
63
+ "ComponentLifecycle",
64
+ # Rich components - Text
65
+ "RichTextComponent",
66
+ # Rich components - Data
67
+ "DataFrameComponent",
68
+ "ChartComponent",
69
+ # Rich components - Feedback
70
+ "NotificationComponent",
71
+ "StatusCardComponent",
72
+ "ProgressBarComponent",
73
+ "ProgressDisplayComponent",
74
+ "StatusIndicatorComponent",
75
+ "LogViewerComponent",
76
+ "LogEntry",
77
+ "BadgeComponent",
78
+ "IconTextComponent",
79
+ # Rich components - Interactive
80
+ "TaskListComponent",
81
+ "Task",
82
+ "StatusBarUpdateComponent",
83
+ "TaskTrackerUpdateComponent",
84
+ "ChatInputUpdateComponent",
85
+ "TaskOperation",
86
+ "ButtonComponent",
87
+ "ButtonGroupComponent",
88
+ # Rich components - Containers
89
+ "CardComponent",
90
+ # Rich components - Specialized
91
+ "ArtifactComponent",
92
+ ]
@@ -0,0 +1,11 @@
1
+ """
2
+ UI components base - re-exports UiComponent from core.
3
+
4
+ UiComponent lives in core/ because it's a fundamental return type for tools.
5
+ This module provides backward compatibility by re-exporting it here.
6
+ """
7
+
8
+ # Re-export UiComponent from core for backward compatibility
9
+ from ..core.components import UiComponent
10
+
11
+ __all__ = ["UiComponent"]
@@ -0,0 +1,83 @@
1
+ """Rich UI components for the Vanna Agents framework."""
2
+
3
+ # Base classes and enums - import from core
4
+ from ...core.rich_component import RichComponent, ComponentType, ComponentLifecycle
5
+
6
+ # Text component
7
+ from .text import RichTextComponent
8
+
9
+ # Data components
10
+ from .data import (
11
+ DataFrameComponent,
12
+ ChartComponent,
13
+ )
14
+
15
+ # Feedback components
16
+ from .feedback import (
17
+ NotificationComponent,
18
+ StatusCardComponent,
19
+ ProgressBarComponent,
20
+ ProgressDisplayComponent,
21
+ StatusIndicatorComponent,
22
+ LogViewerComponent,
23
+ LogEntry,
24
+ BadgeComponent,
25
+ IconTextComponent,
26
+ )
27
+
28
+ # Interactive components
29
+ from .interactive import (
30
+ TaskListComponent,
31
+ Task,
32
+ StatusBarUpdateComponent,
33
+ TaskTrackerUpdateComponent,
34
+ ChatInputUpdateComponent,
35
+ TaskOperation,
36
+ ButtonComponent,
37
+ ButtonGroupComponent,
38
+ )
39
+
40
+ # Container components
41
+ from .containers import (
42
+ CardComponent,
43
+ )
44
+
45
+ # Specialized components
46
+ from .specialized import (
47
+ ArtifactComponent,
48
+ )
49
+
50
+ __all__ = [
51
+ # Base
52
+ "RichComponent",
53
+ "ComponentType",
54
+ "ComponentLifecycle",
55
+ # Text
56
+ "RichTextComponent",
57
+ # Data
58
+ "DataFrameComponent",
59
+ "ChartComponent",
60
+ # Feedback
61
+ "NotificationComponent",
62
+ "StatusCardComponent",
63
+ "ProgressBarComponent",
64
+ "ProgressDisplayComponent",
65
+ "StatusIndicatorComponent",
66
+ "LogViewerComponent",
67
+ "LogEntry",
68
+ "BadgeComponent",
69
+ "IconTextComponent",
70
+ # Interactive
71
+ "TaskListComponent",
72
+ "Task",
73
+ "StatusBarUpdateComponent",
74
+ "TaskTrackerUpdateComponent",
75
+ "ChatInputUpdateComponent",
76
+ "TaskOperation",
77
+ "ButtonComponent",
78
+ "ButtonGroupComponent",
79
+ # Containers
80
+ "CardComponent",
81
+ # Specialized
82
+ "ArtifactComponent",
83
+ ]
@@ -0,0 +1,7 @@
1
+ """Container components for layout."""
2
+
3
+ from .card import CardComponent
4
+
5
+ __all__ = [
6
+ "CardComponent",
7
+ ]
@@ -0,0 +1,20 @@
1
+ """Card component for displaying structured information."""
2
+
3
+ from typing import Any, Dict, List, Optional
4
+ from pydantic import Field
5
+ from ....core.rich_component import RichComponent, ComponentType
6
+
7
+
8
+ class CardComponent(RichComponent):
9
+ """Card component for displaying structured information."""
10
+
11
+ type: ComponentType = ComponentType.CARD
12
+ title: str
13
+ content: str
14
+ subtitle: Optional[str] = None
15
+ icon: Optional[str] = None
16
+ status: Optional[str] = None # "success", "warning", "error", "info"
17
+ actions: List[Dict[str, Any]] = Field(default_factory=list)
18
+ collapsible: bool = False
19
+ collapsed: bool = False
20
+ markdown: bool = False # Whether content should be rendered as markdown
@@ -0,0 +1,9 @@
1
+ """Data display components."""
2
+
3
+ from .dataframe import DataFrameComponent
4
+ from .chart import ChartComponent
5
+
6
+ __all__ = [
7
+ "DataFrameComponent",
8
+ "ChartComponent",
9
+ ]
@@ -0,0 +1,17 @@
1
+ """Chart component for data visualization."""
2
+
3
+ from typing import Any, Dict, Optional, Union
4
+ from pydantic import Field
5
+ from ....core.rich_component import RichComponent, ComponentType
6
+
7
+
8
+ class ChartComponent(RichComponent):
9
+ """Chart component for data visualization."""
10
+
11
+ type: ComponentType = ComponentType.CHART
12
+ chart_type: str # "line", "bar", "pie", "scatter", etc.
13
+ data: Dict[str, Any] # Chart data in format expected by frontend
14
+ title: Optional[str] = None
15
+ width: Optional[Union[str, int]] = None
16
+ height: Optional[Union[str, int]] = None
17
+ config: Dict[str, Any] = Field(default_factory=dict) # Chart-specific config
@@ -0,0 +1,93 @@
1
+ """DataFrame component for displaying tabular data."""
2
+
3
+ from typing import Any, Dict, List, Optional
4
+ from pydantic import Field
5
+ from ....core.rich_component import RichComponent, ComponentType
6
+
7
+
8
+ class DataFrameComponent(RichComponent):
9
+ """DataFrame component specifically for displaying tabular data from SQL queries and similar sources."""
10
+
11
+ type: ComponentType = ComponentType.DATAFRAME
12
+ rows: List[Dict[str, Any]] = Field(default_factory=list) # List of row dictionaries
13
+ columns: List[str] = Field(default_factory=list) # Column names in display order
14
+ title: Optional[str] = None
15
+ description: Optional[str] = None
16
+ row_count: int = 0
17
+ column_count: int = 0
18
+
19
+ # Display options
20
+ max_rows_displayed: int = 100 # Limit rows shown in UI
21
+ searchable: bool = True
22
+ sortable: bool = True
23
+ filterable: bool = True
24
+ exportable: bool = True # Allow export to CSV/Excel
25
+
26
+ # Styling options
27
+ striped: bool = True
28
+ bordered: bool = True
29
+ compact: bool = False
30
+
31
+ # Pagination
32
+ paginated: bool = True
33
+ page_size: int = 25
34
+
35
+ # Data types for better formatting (optional)
36
+ column_types: Dict[str, str] = Field(
37
+ default_factory=dict
38
+ ) # column_name -> "string"|"number"|"date"|"boolean"
39
+
40
+ def __init__(self, **kwargs: Any) -> None:
41
+ # Set defaults before calling super().__init__
42
+ if "rows" not in kwargs:
43
+ kwargs["rows"] = []
44
+ if "columns" not in kwargs:
45
+ kwargs["columns"] = []
46
+ if "column_types" not in kwargs:
47
+ kwargs["column_types"] = {}
48
+
49
+ super().__init__(**kwargs)
50
+
51
+ # Auto-calculate counts if not provided
52
+ if self.rows and len(self.rows) > 0:
53
+ if "row_count" not in kwargs:
54
+ self.row_count = len(self.rows)
55
+ if not self.columns and self.rows:
56
+ self.columns = list(self.rows[0].keys())
57
+ if "column_count" not in kwargs:
58
+ self.column_count = len(self.columns)
59
+ else:
60
+ if "row_count" not in kwargs:
61
+ self.row_count = 0
62
+ if "column_count" not in kwargs:
63
+ self.column_count = len(self.columns) if self.columns else 0
64
+
65
+ @classmethod
66
+ def from_records(
67
+ cls,
68
+ records: List[Dict[str, Any]],
69
+ title: Optional[str] = None,
70
+ description: Optional[str] = None,
71
+ **kwargs: Any,
72
+ ) -> "DataFrameComponent":
73
+ """Create a DataFrame component from a list of record dictionaries."""
74
+ columns = list(records[0].keys()) if records else []
75
+
76
+ # Ensure we pass the required arguments correctly
77
+ component_data = {
78
+ "rows": records,
79
+ "columns": columns,
80
+ "row_count": len(records),
81
+ "column_count": len(columns),
82
+ "column_types": {}, # Initialize empty dict
83
+ }
84
+
85
+ if title is not None:
86
+ component_data["title"] = title
87
+ if description is not None:
88
+ component_data["description"] = description
89
+
90
+ # Merge with any additional kwargs
91
+ component_data.update(kwargs)
92
+
93
+ return cls(**component_data)