vanna 0.7.5__tar.gz → 0.7.7__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.
- vanna-0.7.7/LICENSE +21 -0
- {vanna-0.7.5 → vanna-0.7.7}/PKG-INFO +55 -7
- {vanna-0.7.5 → vanna-0.7.7}/README.md +43 -3
- {vanna-0.7.5 → vanna-0.7.7}/pyproject.toml +5 -4
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/base/base.py +5 -2
- vanna-0.7.7/src/vanna/cohere/__init__.py +2 -0
- vanna-0.7.7/src/vanna/cohere/cohere_chat.py +94 -0
- vanna-0.7.7/src/vanna/cohere/cohere_embeddings.py +71 -0
- vanna-0.7.7/src/vanna/deepseek/__init__.py +1 -0
- vanna-0.7.7/src/vanna/deepseek/deepseek_chat.py +60 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/google/gemini_chat.py +23 -1
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/ollama/ollama.py +1 -1
- vanna-0.7.7/src/vanna/opensearch/__init__.py +2 -0
- vanna-0.7.7/src/vanna/opensearch/opensearch_vector_semantic.py +175 -0
- vanna-0.7.7/src/vanna/oracle/__init__.py +1 -0
- vanna-0.7.7/src/vanna/oracle/oracle_vector.py +585 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/remote.py +1 -1
- vanna-0.7.5/src/vanna/opensearch/__init__.py +0 -1
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/ZhipuAI/ZhipuAI_Chat.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/ZhipuAI/ZhipuAI_embeddings.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/ZhipuAI/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/advanced/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/anthropic/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/anthropic/anthropic_chat.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/azuresearch/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/azuresearch/azuresearch_vector.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/base/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/bedrock/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/bedrock/bedrock_converse.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/chromadb/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/chromadb/chromadb_vector.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/exceptions/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/faiss/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/faiss/faiss.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/flask/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/flask/assets.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/flask/auth.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/google/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/google/bigquery_vector.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/hf/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/hf/hf.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/local.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/marqo/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/marqo/marqo.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/milvus/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/milvus/milvus_vector.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/mistral/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/mistral/mistral.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/mock/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/mock/embedding.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/mock/llm.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/mock/vectordb.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/ollama/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/openai/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/openai/openai_chat.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/openai/openai_embeddings.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/opensearch/opensearch_vector.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/pgvector/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/pgvector/pgvector.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/pinecone/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/pinecone/pinecone_vector.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/qdrant/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/qdrant/qdrant.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/qianfan/Qianfan_Chat.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/qianfan/Qianfan_embeddings.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/qianfan/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/qianwen/QianwenAI_chat.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/qianwen/QianwenAI_embeddings.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/qianwen/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/types/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/utils.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/vannadb/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/vannadb/vannadb_vector.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/vllm/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/vllm/vllm.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/weaviate/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/weaviate/weaviate_vector.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/xinference/__init__.py +0 -0
- {vanna-0.7.5 → vanna-0.7.7}/src/vanna/xinference/xinference.py +0 -0
vanna-0.7.7/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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: vanna
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.7
|
|
4
4
|
Summary: Generate SQL queries from natural language
|
|
5
5
|
Author-email: Zain Hoda <zain@vanna.ai>
|
|
6
6
|
Requires-Python: >=3.9
|
|
@@ -8,6 +8,7 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
|
+
License-File: LICENSE
|
|
11
12
|
Requires-Dist: requests
|
|
12
13
|
Requires-Dist: tabulate
|
|
13
14
|
Requires-Dist: plotly
|
|
@@ -40,7 +41,7 @@ Requires-Dist: httpx ; extra == "all"
|
|
|
40
41
|
Requires-Dist: opensearch-py ; extra == "all"
|
|
41
42
|
Requires-Dist: opensearch-dsl ; extra == "all"
|
|
42
43
|
Requires-Dist: transformers ; extra == "all"
|
|
43
|
-
Requires-Dist: pinecone
|
|
44
|
+
Requires-Dist: pinecone ; extra == "all"
|
|
44
45
|
Requires-Dist: pymilvus[model] ; extra == "all"
|
|
45
46
|
Requires-Dist: weaviate-client ; extra == "all"
|
|
46
47
|
Requires-Dist: azure-search-documents ; extra == "all"
|
|
@@ -52,6 +53,8 @@ Requires-Dist: boto3 ; extra == "all"
|
|
|
52
53
|
Requires-Dist: botocore ; extra == "all"
|
|
53
54
|
Requires-Dist: langchain_core ; extra == "all"
|
|
54
55
|
Requires-Dist: langchain_postgres ; extra == "all"
|
|
56
|
+
Requires-Dist: langchain-community ; extra == "all"
|
|
57
|
+
Requires-Dist: langchain-huggingface ; extra == "all"
|
|
55
58
|
Requires-Dist: xinference-client ; extra == "all"
|
|
56
59
|
Requires-Dist: anthropic ; extra == "anthropic"
|
|
57
60
|
Requires-Dist: azure-search-documents ; extra == "azuresearch"
|
|
@@ -79,8 +82,12 @@ Requires-Dist: httpx ; extra == "ollama"
|
|
|
79
82
|
Requires-Dist: openai ; extra == "openai"
|
|
80
83
|
Requires-Dist: opensearch-py ; extra == "opensearch"
|
|
81
84
|
Requires-Dist: opensearch-dsl ; extra == "opensearch"
|
|
85
|
+
Requires-Dist: langchain-community ; extra == "opensearch"
|
|
86
|
+
Requires-Dist: langchain-huggingface ; extra == "opensearch"
|
|
87
|
+
Requires-Dist: oracledb ; extra == "oracle"
|
|
88
|
+
Requires-Dist: chromadb ; extra == "oracle"
|
|
82
89
|
Requires-Dist: langchain-postgres>=0.0.12 ; extra == "pgvector"
|
|
83
|
-
Requires-Dist: pinecone
|
|
90
|
+
Requires-Dist: pinecone ; extra == "pinecone"
|
|
84
91
|
Requires-Dist: fastembed ; extra == "pinecone"
|
|
85
92
|
Requires-Dist: psycopg2-binary ; extra == "postgres"
|
|
86
93
|
Requires-Dist: db-dtypes ; extra == "postgres"
|
|
@@ -115,6 +122,7 @@ Provides-Extra: mysql
|
|
|
115
122
|
Provides-Extra: ollama
|
|
116
123
|
Provides-Extra: openai
|
|
117
124
|
Provides-Extra: opensearch
|
|
125
|
+
Provides-Extra: oracle
|
|
118
126
|
Provides-Extra: pgvector
|
|
119
127
|
Provides-Extra: pinecone
|
|
120
128
|
Provides-Extra: postgres
|
|
@@ -129,9 +137,9 @@ Provides-Extra: zhipuai
|
|
|
129
137
|
|
|
130
138
|
|
|
131
139
|
|
|
132
|
-
| GitHub | PyPI | Documentation |
|
|
133
|
-
| ------ | ---- | ------------- |
|
|
134
|
-
| [](https://github.com/vanna-ai/vanna) | [](https://pypi.org/project/vanna/) | [](https://vanna.ai/docs/) |
|
|
140
|
+
| GitHub | PyPI | Documentation | Gurubase |
|
|
141
|
+
| ------ | ---- | ------------- | -------- |
|
|
142
|
+
| [](https://github.com/vanna-ai/vanna) | [](https://pypi.org/project/vanna/) | [](https://vanna.ai/docs/) | [](https://gurubase.io/g/vanna) |
|
|
135
143
|
|
|
136
144
|
# Vanna
|
|
137
145
|
Vanna is an MIT-licensed open-source Python RAG (Retrieval-Augmented Generation) framework for SQL generation and related functionality.
|
|
@@ -164,6 +172,46 @@ These are some of the user interfaces that we've built using Vanna. You can use
|
|
|
164
172
|
- [vanna-ai/vanna-flask](https://github.com/vanna-ai/vanna-flask)
|
|
165
173
|
- [vanna-ai/vanna-slack](https://github.com/vanna-ai/vanna-slack)
|
|
166
174
|
|
|
175
|
+
## Supported LLMs
|
|
176
|
+
|
|
177
|
+
- [OpenAI](https://github.com/vanna-ai/vanna/tree/main/src/vanna/openai)
|
|
178
|
+
- [Anthropic](https://github.com/vanna-ai/vanna/tree/main/src/vanna/anthropic)
|
|
179
|
+
- [Gemini](https://github.com/vanna-ai/vanna/blob/main/src/vanna/google/gemini_chat.py)
|
|
180
|
+
- [HuggingFace](https://github.com/vanna-ai/vanna/blob/main/src/vanna/hf/hf.py)
|
|
181
|
+
- [AWS Bedrock](https://github.com/vanna-ai/vanna/tree/main/src/vanna/bedrock)
|
|
182
|
+
- [Ollama](https://github.com/vanna-ai/vanna/tree/main/src/vanna/ollama)
|
|
183
|
+
- [Qianwen](https://github.com/vanna-ai/vanna/tree/main/src/vanna/qianwen)
|
|
184
|
+
- [Qianfan](https://github.com/vanna-ai/vanna/tree/main/src/vanna/qianfan)
|
|
185
|
+
- [Zhipu](https://github.com/vanna-ai/vanna/tree/main/src/vanna/ZhipuAI)
|
|
186
|
+
|
|
187
|
+
## Supported VectorStores
|
|
188
|
+
|
|
189
|
+
- [AzureSearch](https://github.com/vanna-ai/vanna/tree/main/src/vanna/azuresearch)
|
|
190
|
+
- [Opensearch](https://github.com/vanna-ai/vanna/tree/main/src/vanna/opensearch)
|
|
191
|
+
- [PgVector](https://github.com/vanna-ai/vanna/tree/main/src/vanna/pgvector)
|
|
192
|
+
- [PineCone](https://github.com/vanna-ai/vanna/tree/main/src/vanna/pinecone)
|
|
193
|
+
- [ChromaDB](https://github.com/vanna-ai/vanna/tree/main/src/vanna/chromadb)
|
|
194
|
+
- [FAISS](https://github.com/vanna-ai/vanna/tree/main/src/vanna/faiss)
|
|
195
|
+
- [Marqo](https://github.com/vanna-ai/vanna/tree/main/src/vanna/marqo)
|
|
196
|
+
- [Milvus](https://github.com/vanna-ai/vanna/tree/main/src/vanna/milvus)
|
|
197
|
+
- [Qdrant](https://github.com/vanna-ai/vanna/tree/main/src/vanna/qdrant)
|
|
198
|
+
- [Weaviate](https://github.com/vanna-ai/vanna/tree/main/src/vanna/weaviate)
|
|
199
|
+
- [Oracle](https://github.com/vanna-ai/vanna/tree/main/src/vanna/oracle)
|
|
200
|
+
|
|
201
|
+
## Supported Databases
|
|
202
|
+
|
|
203
|
+
- [PostgreSQL](https://www.postgresql.org/)
|
|
204
|
+
- [MySQL](https://www.mysql.com/)
|
|
205
|
+
- [PrestoDB](https://prestodb.io/)
|
|
206
|
+
- [Apache Hive](https://hive.apache.org/)
|
|
207
|
+
- [ClickHouse](https://clickhouse.com/)
|
|
208
|
+
- [Snowflake](https://www.snowflake.com/en/)
|
|
209
|
+
- [Oracle](https://www.oracle.com/)
|
|
210
|
+
- [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-downloads)
|
|
211
|
+
- [BigQuery](https://cloud.google.com/bigquery)
|
|
212
|
+
- [SQLite](https://www.sqlite.org/)
|
|
213
|
+
- [DuckDB](https://duckdb.org/)
|
|
214
|
+
|
|
167
215
|
|
|
168
216
|
## Getting started
|
|
169
217
|
See the [documentation](https://vanna.ai/docs/) for specifics on your desired database, LLM, etc.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
| GitHub | PyPI | Documentation |
|
|
4
|
-
| ------ | ---- | ------------- |
|
|
5
|
-
| [](https://github.com/vanna-ai/vanna) | [](https://pypi.org/project/vanna/) | [](https://vanna.ai/docs/) |
|
|
3
|
+
| GitHub | PyPI | Documentation | Gurubase |
|
|
4
|
+
| ------ | ---- | ------------- | -------- |
|
|
5
|
+
| [](https://github.com/vanna-ai/vanna) | [](https://pypi.org/project/vanna/) | [](https://vanna.ai/docs/) | [](https://gurubase.io/g/vanna) |
|
|
6
6
|
|
|
7
7
|
# Vanna
|
|
8
8
|
Vanna is an MIT-licensed open-source Python RAG (Retrieval-Augmented Generation) framework for SQL generation and related functionality.
|
|
@@ -35,6 +35,46 @@ These are some of the user interfaces that we've built using Vanna. You can use
|
|
|
35
35
|
- [vanna-ai/vanna-flask](https://github.com/vanna-ai/vanna-flask)
|
|
36
36
|
- [vanna-ai/vanna-slack](https://github.com/vanna-ai/vanna-slack)
|
|
37
37
|
|
|
38
|
+
## Supported LLMs
|
|
39
|
+
|
|
40
|
+
- [OpenAI](https://github.com/vanna-ai/vanna/tree/main/src/vanna/openai)
|
|
41
|
+
- [Anthropic](https://github.com/vanna-ai/vanna/tree/main/src/vanna/anthropic)
|
|
42
|
+
- [Gemini](https://github.com/vanna-ai/vanna/blob/main/src/vanna/google/gemini_chat.py)
|
|
43
|
+
- [HuggingFace](https://github.com/vanna-ai/vanna/blob/main/src/vanna/hf/hf.py)
|
|
44
|
+
- [AWS Bedrock](https://github.com/vanna-ai/vanna/tree/main/src/vanna/bedrock)
|
|
45
|
+
- [Ollama](https://github.com/vanna-ai/vanna/tree/main/src/vanna/ollama)
|
|
46
|
+
- [Qianwen](https://github.com/vanna-ai/vanna/tree/main/src/vanna/qianwen)
|
|
47
|
+
- [Qianfan](https://github.com/vanna-ai/vanna/tree/main/src/vanna/qianfan)
|
|
48
|
+
- [Zhipu](https://github.com/vanna-ai/vanna/tree/main/src/vanna/ZhipuAI)
|
|
49
|
+
|
|
50
|
+
## Supported VectorStores
|
|
51
|
+
|
|
52
|
+
- [AzureSearch](https://github.com/vanna-ai/vanna/tree/main/src/vanna/azuresearch)
|
|
53
|
+
- [Opensearch](https://github.com/vanna-ai/vanna/tree/main/src/vanna/opensearch)
|
|
54
|
+
- [PgVector](https://github.com/vanna-ai/vanna/tree/main/src/vanna/pgvector)
|
|
55
|
+
- [PineCone](https://github.com/vanna-ai/vanna/tree/main/src/vanna/pinecone)
|
|
56
|
+
- [ChromaDB](https://github.com/vanna-ai/vanna/tree/main/src/vanna/chromadb)
|
|
57
|
+
- [FAISS](https://github.com/vanna-ai/vanna/tree/main/src/vanna/faiss)
|
|
58
|
+
- [Marqo](https://github.com/vanna-ai/vanna/tree/main/src/vanna/marqo)
|
|
59
|
+
- [Milvus](https://github.com/vanna-ai/vanna/tree/main/src/vanna/milvus)
|
|
60
|
+
- [Qdrant](https://github.com/vanna-ai/vanna/tree/main/src/vanna/qdrant)
|
|
61
|
+
- [Weaviate](https://github.com/vanna-ai/vanna/tree/main/src/vanna/weaviate)
|
|
62
|
+
- [Oracle](https://github.com/vanna-ai/vanna/tree/main/src/vanna/oracle)
|
|
63
|
+
|
|
64
|
+
## Supported Databases
|
|
65
|
+
|
|
66
|
+
- [PostgreSQL](https://www.postgresql.org/)
|
|
67
|
+
- [MySQL](https://www.mysql.com/)
|
|
68
|
+
- [PrestoDB](https://prestodb.io/)
|
|
69
|
+
- [Apache Hive](https://hive.apache.org/)
|
|
70
|
+
- [ClickHouse](https://clickhouse.com/)
|
|
71
|
+
- [Snowflake](https://www.snowflake.com/en/)
|
|
72
|
+
- [Oracle](https://www.oracle.com/)
|
|
73
|
+
- [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-downloads)
|
|
74
|
+
- [BigQuery](https://cloud.google.com/bigquery)
|
|
75
|
+
- [SQLite](https://www.sqlite.org/)
|
|
76
|
+
- [DuckDB](https://duckdb.org/)
|
|
77
|
+
|
|
38
78
|
|
|
39
79
|
## Getting started
|
|
40
80
|
See the [documentation](https://vanna.ai/docs/) for specifics on your desired database, LLM, etc.
|
|
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "vanna"
|
|
7
|
-
version = "0.7.
|
|
7
|
+
version = "0.7.7"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Zain Hoda", email="zain@vanna.ai" },
|
|
10
10
|
]
|
|
@@ -33,7 +33,7 @@ bigquery = ["google-cloud-bigquery"]
|
|
|
33
33
|
snowflake = ["snowflake-connector-python"]
|
|
34
34
|
duckdb = ["duckdb"]
|
|
35
35
|
google = ["google-generativeai", "google-cloud-aiplatform"]
|
|
36
|
-
all = ["psycopg2-binary", "db-dtypes", "PyMySQL", "google-cloud-bigquery", "snowflake-connector-python", "duckdb", "openai", "qianfan", "mistralai>=1.0.0", "chromadb", "anthropic", "zhipuai", "marqo", "google-generativeai", "google-cloud-aiplatform", "qdrant-client", "fastembed", "ollama", "httpx", "opensearch-py", "opensearch-dsl", "transformers", "pinecone
|
|
36
|
+
all = ["psycopg2-binary", "db-dtypes", "PyMySQL", "google-cloud-bigquery", "snowflake-connector-python", "duckdb", "openai", "qianfan", "mistralai>=1.0.0", "chromadb", "anthropic", "zhipuai", "marqo", "google-generativeai", "google-cloud-aiplatform", "qdrant-client", "fastembed", "ollama", "httpx", "opensearch-py", "opensearch-dsl", "transformers", "pinecone", "pymilvus[model]","weaviate-client", "azure-search-documents", "azure-identity", "azure-common", "faiss-cpu", "boto", "boto3", "botocore", "langchain_core", "langchain_postgres", "langchain-community", "langchain-huggingface", "xinference-client"]
|
|
37
37
|
test = ["tox"]
|
|
38
38
|
chromadb = ["chromadb"]
|
|
39
39
|
openai = ["openai"]
|
|
@@ -46,8 +46,8 @@ zhipuai = ["zhipuai"]
|
|
|
46
46
|
ollama = ["ollama", "httpx"]
|
|
47
47
|
qdrant = ["qdrant-client", "fastembed"]
|
|
48
48
|
vllm = ["vllm"]
|
|
49
|
-
pinecone = ["pinecone
|
|
50
|
-
opensearch = ["opensearch-py", "opensearch-dsl"]
|
|
49
|
+
pinecone = ["pinecone", "fastembed"]
|
|
50
|
+
opensearch = ["opensearch-py", "opensearch-dsl", "langchain-community", "langchain-huggingface"]
|
|
51
51
|
hf = ["transformers"]
|
|
52
52
|
milvus = ["pymilvus[model]"]
|
|
53
53
|
bedrock = ["boto3", "botocore"]
|
|
@@ -57,3 +57,4 @@ pgvector = ["langchain-postgres>=0.0.12"]
|
|
|
57
57
|
faiss-cpu = ["faiss-cpu"]
|
|
58
58
|
faiss-gpu = ["faiss-gpu"]
|
|
59
59
|
xinference-client = ["xinference-client"]
|
|
60
|
+
oracle = ["oracledb", "chromadb"]
|
|
@@ -306,7 +306,7 @@ class VannaBase(ABC):
|
|
|
306
306
|
|
|
307
307
|
message_log = [
|
|
308
308
|
self.system_message(
|
|
309
|
-
f"You are a helpful data assistant. The user asked the question: '{question}'\n\nThe SQL query for this question was: {sql}\n\nThe following is a pandas DataFrame with the results of the query: \n{df.to_markdown()}\n\n"
|
|
309
|
+
f"You are a helpful data assistant. The user asked the question: '{question}'\n\nThe SQL query for this question was: {sql}\n\nThe following is a pandas DataFrame with the results of the query: \n{df.head(25).to_markdown()}\n\n"
|
|
310
310
|
),
|
|
311
311
|
self.user_message(
|
|
312
312
|
f"Generate a list of {n_questions} followup questions that the user might ask about this data. Respond with a list of questions, one per line. Do not answer with any explanations -- just the questions. Remember that there should be an unambiguous SQL query that can be generated from the question. Prefer questions that are answerable outside of the context of this conversation. Prefer questions that are slight modifications of the SQL query that was generated that allow digging deeper into the data. Each question will be turned into a button that the user can click to generate a new SQL query so don't use 'example' type questions. Each question must have a one-to-one correspondence with an instantiated SQL query." +
|
|
@@ -689,6 +689,9 @@ class VannaBase(ABC):
|
|
|
689
689
|
return response
|
|
690
690
|
|
|
691
691
|
def _extract_python_code(self, markdown_string: str) -> str:
|
|
692
|
+
# Strip whitespace to avoid indentation errors in LLM-generated code
|
|
693
|
+
markdown_string = markdown_string.strip()
|
|
694
|
+
|
|
692
695
|
# Regex pattern to match Python code blocks
|
|
693
696
|
pattern = r"```[\w\s]*python\n([\s\S]*?)```|```([\s\S]*?)```"
|
|
694
697
|
|
|
@@ -1167,7 +1170,7 @@ class VannaBase(ABC):
|
|
|
1167
1170
|
vn.connect_to_oracle(
|
|
1168
1171
|
user="username",
|
|
1169
1172
|
password="password",
|
|
1170
|
-
|
|
1173
|
+
dsn="host:port/sid",
|
|
1171
1174
|
)
|
|
1172
1175
|
```
|
|
1173
1176
|
Args:
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from openai import OpenAI
|
|
4
|
+
|
|
5
|
+
from ..base import VannaBase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Cohere_Chat(VannaBase):
|
|
9
|
+
def __init__(self, client=None, config=None):
|
|
10
|
+
VannaBase.__init__(self, config=config)
|
|
11
|
+
|
|
12
|
+
# default parameters - can be overridden using config
|
|
13
|
+
self.temperature = 0.2 # Lower temperature for more precise SQL generation
|
|
14
|
+
self.model = "command-a-03-2025" # Cohere's default model
|
|
15
|
+
|
|
16
|
+
if config is not None:
|
|
17
|
+
if "temperature" in config:
|
|
18
|
+
self.temperature = config["temperature"]
|
|
19
|
+
if "model" in config:
|
|
20
|
+
self.model = config["model"]
|
|
21
|
+
|
|
22
|
+
if client is not None:
|
|
23
|
+
self.client = client
|
|
24
|
+
return
|
|
25
|
+
|
|
26
|
+
# Check for API key in environment variable
|
|
27
|
+
api_key = os.getenv("COHERE_API_KEY")
|
|
28
|
+
|
|
29
|
+
# Check for API key in config
|
|
30
|
+
if config is not None and "api_key" in config:
|
|
31
|
+
api_key = config["api_key"]
|
|
32
|
+
|
|
33
|
+
# Validate API key
|
|
34
|
+
if not api_key:
|
|
35
|
+
raise ValueError("Cohere API key is required. Please provide it via config or set the COHERE_API_KEY environment variable.")
|
|
36
|
+
|
|
37
|
+
# Initialize client with validated API key
|
|
38
|
+
self.client = OpenAI(
|
|
39
|
+
base_url="https://api.cohere.ai/compatibility/v1",
|
|
40
|
+
api_key=api_key,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def system_message(self, message: str) -> any:
|
|
44
|
+
return {"role": "developer", "content": message} # Cohere uses 'developer' for system role
|
|
45
|
+
|
|
46
|
+
def user_message(self, message: str) -> any:
|
|
47
|
+
return {"role": "user", "content": message}
|
|
48
|
+
|
|
49
|
+
def assistant_message(self, message: str) -> any:
|
|
50
|
+
return {"role": "assistant", "content": message}
|
|
51
|
+
|
|
52
|
+
def submit_prompt(self, prompt, **kwargs) -> str:
|
|
53
|
+
if prompt is None:
|
|
54
|
+
raise Exception("Prompt is None")
|
|
55
|
+
|
|
56
|
+
if len(prompt) == 0:
|
|
57
|
+
raise Exception("Prompt is empty")
|
|
58
|
+
|
|
59
|
+
# Count the number of tokens in the message log
|
|
60
|
+
# Use 4 as an approximation for the number of characters per token
|
|
61
|
+
num_tokens = 0
|
|
62
|
+
for message in prompt:
|
|
63
|
+
num_tokens += len(message["content"]) / 4
|
|
64
|
+
|
|
65
|
+
# Use model from kwargs, config, or default
|
|
66
|
+
model = kwargs.get("model", self.model)
|
|
67
|
+
if self.config is not None and "model" in self.config and model == self.model:
|
|
68
|
+
model = self.config["model"]
|
|
69
|
+
|
|
70
|
+
print(f"Using model {model} for {num_tokens} tokens (approx)")
|
|
71
|
+
try:
|
|
72
|
+
response = self.client.chat.completions.create(
|
|
73
|
+
model=model,
|
|
74
|
+
messages=prompt,
|
|
75
|
+
temperature=self.temperature,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Check if response has expected structure
|
|
79
|
+
if not response or not hasattr(response, 'choices') or not response.choices:
|
|
80
|
+
raise ValueError("Received empty or malformed response from API")
|
|
81
|
+
|
|
82
|
+
if not response.choices[0] or not hasattr(response.choices[0], 'message'):
|
|
83
|
+
raise ValueError("Response is missing expected 'message' field")
|
|
84
|
+
|
|
85
|
+
if not hasattr(response.choices[0].message, 'content'):
|
|
86
|
+
raise ValueError("Response message is missing expected 'content' field")
|
|
87
|
+
|
|
88
|
+
return response.choices[0].message.content
|
|
89
|
+
|
|
90
|
+
except Exception as e:
|
|
91
|
+
# Log the error and raise a more informative exception
|
|
92
|
+
error_msg = f"Error processing Cohere chat response: {str(e)}"
|
|
93
|
+
print(error_msg)
|
|
94
|
+
raise Exception(error_msg)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from openai import OpenAI
|
|
4
|
+
|
|
5
|
+
from ..base import VannaBase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Cohere_Embeddings(VannaBase):
|
|
9
|
+
def __init__(self, client=None, config=None):
|
|
10
|
+
VannaBase.__init__(self, config=config)
|
|
11
|
+
|
|
12
|
+
# Default embedding model
|
|
13
|
+
self.model = "embed-multilingual-v3.0"
|
|
14
|
+
|
|
15
|
+
if config is not None and "model" in config:
|
|
16
|
+
self.model = config["model"]
|
|
17
|
+
|
|
18
|
+
if client is not None:
|
|
19
|
+
self.client = client
|
|
20
|
+
return
|
|
21
|
+
|
|
22
|
+
# Check for API key in environment variable
|
|
23
|
+
api_key = os.getenv("COHERE_API_KEY")
|
|
24
|
+
|
|
25
|
+
# Check for API key in config
|
|
26
|
+
if config is not None and "api_key" in config:
|
|
27
|
+
api_key = config["api_key"]
|
|
28
|
+
|
|
29
|
+
# Validate API key
|
|
30
|
+
if not api_key:
|
|
31
|
+
raise ValueError("Cohere API key is required. Please provide it via config or set the COHERE_API_KEY environment variable.")
|
|
32
|
+
|
|
33
|
+
# Initialize client with validated API key
|
|
34
|
+
self.client = OpenAI(
|
|
35
|
+
base_url="https://api.cohere.ai/compatibility/v1",
|
|
36
|
+
api_key=api_key,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def generate_embedding(self, data: str, **kwargs) -> list[float]:
|
|
40
|
+
if not data:
|
|
41
|
+
raise ValueError("Cannot generate embedding for empty input data")
|
|
42
|
+
|
|
43
|
+
# Use model from kwargs, config, or default
|
|
44
|
+
model = kwargs.get("model", self.model)
|
|
45
|
+
if self.config is not None and "model" in self.config and model == self.model:
|
|
46
|
+
model = self.config["model"]
|
|
47
|
+
|
|
48
|
+
try:
|
|
49
|
+
embedding = self.client.embeddings.create(
|
|
50
|
+
model=model,
|
|
51
|
+
input=data,
|
|
52
|
+
encoding_format="float", # Ensure we get float values
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Check if response has expected structure
|
|
56
|
+
if not embedding or not hasattr(embedding, 'data') or not embedding.data:
|
|
57
|
+
raise ValueError("Received empty or malformed embedding response from API")
|
|
58
|
+
|
|
59
|
+
if not embedding.data[0] or not hasattr(embedding.data[0], 'embedding'):
|
|
60
|
+
raise ValueError("Embedding response is missing expected 'embedding' field")
|
|
61
|
+
|
|
62
|
+
if not embedding.data[0].embedding:
|
|
63
|
+
raise ValueError("Received empty embedding vector")
|
|
64
|
+
|
|
65
|
+
return embedding.data[0].embedding
|
|
66
|
+
|
|
67
|
+
except Exception as e:
|
|
68
|
+
# Log the error and raise a more informative exception
|
|
69
|
+
error_msg = f"Error generating embedding with Cohere: {str(e)}"
|
|
70
|
+
print(error_msg)
|
|
71
|
+
raise Exception(error_msg)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .deepseek_chat import DeepSeekChat
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from openai import OpenAI
|
|
4
|
+
|
|
5
|
+
from ..base import VannaBase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# from vanna.chromadb import ChromaDB_VectorStore
|
|
10
|
+
|
|
11
|
+
# class DeepSeekVanna(ChromaDB_VectorStore, DeepSeekChat):
|
|
12
|
+
# def __init__(self, config=None):
|
|
13
|
+
# ChromaDB_VectorStore.__init__(self, config=config)
|
|
14
|
+
# DeepSeekChat.__init__(self, config=config)
|
|
15
|
+
|
|
16
|
+
# vn = DeepSeekVanna(config={"api_key": "sk-************", "model": "deepseek-chat"})
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DeepSeekChat(VannaBase):
|
|
20
|
+
def __init__(self, config=None):
|
|
21
|
+
if config is None:
|
|
22
|
+
raise ValueError(
|
|
23
|
+
"For DeepSeek, config must be provided with an api_key and model"
|
|
24
|
+
)
|
|
25
|
+
if "api_key" not in config:
|
|
26
|
+
raise ValueError("config must contain a DeepSeek api_key")
|
|
27
|
+
|
|
28
|
+
if "model" not in config:
|
|
29
|
+
raise ValueError("config must contain a DeepSeek model")
|
|
30
|
+
|
|
31
|
+
api_key = config["api_key"]
|
|
32
|
+
model = config["model"]
|
|
33
|
+
self.model = model
|
|
34
|
+
self.client = OpenAI(api_key=api_key, base_url="https://api.deepseek.com/v1")
|
|
35
|
+
|
|
36
|
+
def system_message(self, message: str) -> any:
|
|
37
|
+
return {"role": "system", "content": message}
|
|
38
|
+
|
|
39
|
+
def user_message(self, message: str) -> any:
|
|
40
|
+
return {"role": "user", "content": message}
|
|
41
|
+
|
|
42
|
+
def assistant_message(self, message: str) -> any:
|
|
43
|
+
return {"role": "assistant", "content": message}
|
|
44
|
+
|
|
45
|
+
def generate_sql(self, question: str, **kwargs) -> str:
|
|
46
|
+
# 使用父类的 generate_sql
|
|
47
|
+
sql = super().generate_sql(question, **kwargs)
|
|
48
|
+
|
|
49
|
+
# 替换 "\_" 为 "_"
|
|
50
|
+
sql = sql.replace("\\_", "_")
|
|
51
|
+
|
|
52
|
+
return sql
|
|
53
|
+
|
|
54
|
+
def submit_prompt(self, prompt, **kwargs) -> str:
|
|
55
|
+
chat_response = self.client.chat.completions.create(
|
|
56
|
+
model=self.model,
|
|
57
|
+
messages=prompt,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
return chat_response.choices[0].message.content
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
|
|
2
3
|
from ..base import VannaBase
|
|
3
4
|
|
|
4
5
|
|
|
@@ -30,8 +31,29 @@ class GoogleGeminiChat(VannaBase):
|
|
|
30
31
|
self.chat_model = genai.GenerativeModel(model_name)
|
|
31
32
|
else:
|
|
32
33
|
# Authenticate using VertexAI
|
|
34
|
+
import google.auth
|
|
35
|
+
import vertexai
|
|
33
36
|
from vertexai.generative_models import GenerativeModel
|
|
34
|
-
|
|
37
|
+
|
|
38
|
+
json_file_path = config.get("google_credentials") # Assuming the JSON file path is provided in the config
|
|
39
|
+
|
|
40
|
+
if not json_file_path or not os.path.exists(json_file_path):
|
|
41
|
+
raise FileNotFoundError(f"JSON credentials file not found at: {json_file_path}")
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
# Validate and set the JSON file path for GOOGLE_APPLICATION_CREDENTIALS
|
|
45
|
+
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = json_file_path
|
|
46
|
+
|
|
47
|
+
# Initialize VertexAI with the credentials
|
|
48
|
+
credentials, _ = google.auth.default()
|
|
49
|
+
vertexai.init(credentials=credentials)
|
|
50
|
+
self.chat_model = GenerativeModel(model_name)
|
|
51
|
+
except google.auth.exceptions.DefaultCredentialsError as e:
|
|
52
|
+
raise RuntimeError(f"Default credentials error: {e}")
|
|
53
|
+
except google.auth.exceptions.TransportError as e:
|
|
54
|
+
raise RuntimeError(f"Transport error during authentication: {e}")
|
|
55
|
+
except Exception as e:
|
|
56
|
+
raise RuntimeError(f"Failed to authenticate using JSON file: {e}")
|
|
35
57
|
|
|
36
58
|
def system_message(self, message: str) -> any:
|
|
37
59
|
return message
|
|
@@ -91,7 +91,7 @@ class Ollama(VannaBase):
|
|
|
91
91
|
f"model={self.model},\n"
|
|
92
92
|
f"options={self.ollama_options},\n"
|
|
93
93
|
f"keep_alive={self.keep_alive}")
|
|
94
|
-
self.log(f"Prompt Content:\n{json.dumps(prompt)}")
|
|
94
|
+
self.log(f"Prompt Content:\n{json.dumps(prompt, ensure_ascii=False)}")
|
|
95
95
|
response_dict = self.ollama_client.chat(model=self.model,
|
|
96
96
|
messages=prompt,
|
|
97
97
|
stream=False,
|