vanna 0.3.1__py3-none-any.whl → 0.3.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vanna/ZhipuAI/ZhipuAI_Chat.py +2 -7
- vanna/base/base.py +14 -18
- vanna/chromadb/chromadb_vector.py +4 -3
- vanna/flask/assets.py +14 -14
- vanna/openai/openai_chat.py +26 -2
- vanna/utils.py +27 -0
- {vanna-0.3.1.dist-info → vanna-0.3.3.dist-info}/METADATA +5 -1
- {vanna-0.3.1.dist-info → vanna-0.3.3.dist-info}/RECORD +9 -9
- {vanna-0.3.1.dist-info → vanna-0.3.3.dist-info}/WHEEL +0 -0
vanna/openai/openai_chat.py
CHANGED
|
@@ -41,7 +41,7 @@ class OpenAI_Chat(VannaBase):
|
|
|
41
41
|
if config is None and client is None:
|
|
42
42
|
self.client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
|
43
43
|
return
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
if "api_key" in config:
|
|
46
46
|
self.client = OpenAI(api_key=config["api_key"])
|
|
47
47
|
|
|
@@ -67,7 +67,31 @@ class OpenAI_Chat(VannaBase):
|
|
|
67
67
|
for message in prompt:
|
|
68
68
|
num_tokens += len(message["content"]) / 4
|
|
69
69
|
|
|
70
|
-
if
|
|
70
|
+
if kwargs.get("model", None) is not None:
|
|
71
|
+
model = kwargs.get("model", None)
|
|
72
|
+
print(
|
|
73
|
+
f"Using model {model} for {num_tokens} tokens (approx)"
|
|
74
|
+
)
|
|
75
|
+
response = self.client.chat.completions.create(
|
|
76
|
+
model=model,
|
|
77
|
+
messages=prompt,
|
|
78
|
+
max_tokens=self.max_tokens,
|
|
79
|
+
stop=None,
|
|
80
|
+
temperature=self.temperature,
|
|
81
|
+
)
|
|
82
|
+
elif kwargs.get("engine", None) is not None:
|
|
83
|
+
engine = kwargs.get("engine", None)
|
|
84
|
+
print(
|
|
85
|
+
f"Using model {engine} for {num_tokens} tokens (approx)"
|
|
86
|
+
)
|
|
87
|
+
response = self.client.chat.completions.create(
|
|
88
|
+
engine=engine,
|
|
89
|
+
messages=prompt,
|
|
90
|
+
max_tokens=self.max_tokens,
|
|
91
|
+
stop=None,
|
|
92
|
+
temperature=self.temperature,
|
|
93
|
+
)
|
|
94
|
+
elif self.config is not None and "engine" in self.config:
|
|
71
95
|
print(
|
|
72
96
|
f"Using engine {self.config['engine']} for {num_tokens} tokens (approx)"
|
|
73
97
|
)
|
vanna/utils.py
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import hashlib
|
|
1
2
|
import os
|
|
2
3
|
import re
|
|
4
|
+
import uuid
|
|
5
|
+
from typing import Union
|
|
3
6
|
|
|
4
7
|
from .exceptions import ImproperlyConfigured, ValidationError
|
|
5
8
|
|
|
@@ -48,3 +51,27 @@ def sanitize_model_name(model_name):
|
|
|
48
51
|
return model_name
|
|
49
52
|
except Exception as e:
|
|
50
53
|
raise ValidationError(e)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def deterministic_uuid(content: Union[str, bytes]) -> str:
|
|
57
|
+
"""Creates deterministic UUID on hash value of string or byte content.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
content: String or byte representation of data.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
UUID of the content.
|
|
64
|
+
"""
|
|
65
|
+
if isinstance(content, str):
|
|
66
|
+
content_bytes = content.encode("utf-8")
|
|
67
|
+
elif isinstance(content, bytes):
|
|
68
|
+
content_bytes = content
|
|
69
|
+
else:
|
|
70
|
+
raise ValueError(f"Content type {type(content)} not supported !")
|
|
71
|
+
|
|
72
|
+
hash_object = hashlib.sha256(content_bytes)
|
|
73
|
+
hash_hex = hash_object.hexdigest()
|
|
74
|
+
namespace = uuid.UUID("00000000-0000-0000-0000-000000000000")
|
|
75
|
+
content_uuid = str(uuid.uuid5(namespace, hash_hex))
|
|
76
|
+
|
|
77
|
+
return content_uuid
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: vanna
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Generate SQL queries from natural language
|
|
5
5
|
Author-email: Zain Hoda <zain@vanna.ai>
|
|
6
6
|
Requires-Python: >=3.9
|
|
@@ -26,6 +26,8 @@ Requires-Dist: openai ; extra == "all"
|
|
|
26
26
|
Requires-Dist: mistralai ; extra == "all"
|
|
27
27
|
Requires-Dist: chromadb ; extra == "all"
|
|
28
28
|
Requires-Dist: anthropic ; extra == "all"
|
|
29
|
+
Requires-Dist: zhipuai ; extra == "all"
|
|
30
|
+
Requires-Dist: marqo ; extra == "all"
|
|
29
31
|
Requires-Dist: anthropic ; extra == "anthropic"
|
|
30
32
|
Requires-Dist: google-cloud-bigquery ; extra == "bigquery"
|
|
31
33
|
Requires-Dist: chromadb ; extra == "chromadb"
|
|
@@ -39,6 +41,7 @@ Requires-Dist: psycopg2-binary ; extra == "postgres"
|
|
|
39
41
|
Requires-Dist: db-dtypes ; extra == "postgres"
|
|
40
42
|
Requires-Dist: snowflake-connector-python ; extra == "snowflake"
|
|
41
43
|
Requires-Dist: tox ; extra == "test"
|
|
44
|
+
Requires-Dist: zhipuai ; extra == "zhipuai"
|
|
42
45
|
Project-URL: Bug Tracker, https://github.com/vanna-ai/vanna/issues
|
|
43
46
|
Project-URL: Homepage, https://github.com/vanna-ai/vanna
|
|
44
47
|
Provides-Extra: all
|
|
@@ -54,6 +57,7 @@ Provides-Extra: openai
|
|
|
54
57
|
Provides-Extra: postgres
|
|
55
58
|
Provides-Extra: snowflake
|
|
56
59
|
Provides-Extra: test
|
|
60
|
+
Provides-Extra: zhipuai
|
|
57
61
|
|
|
58
62
|
|
|
59
63
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
vanna/__init__.py,sha256=4zz2kSkVZenjwJQg-ETWsIVYdz3gio275i9DMa_aHxM,9248
|
|
2
2
|
vanna/local.py,sha256=U5s8ybCRQhBUizi8I69o3jqOpTeu_6KGYY6DMwZxjG4,313
|
|
3
3
|
vanna/remote.py,sha256=qqaTA4l-ikVH_1aQInae4DyTAfCCmFokQme6Jq_i1us,12803
|
|
4
|
-
vanna/utils.py,sha256=
|
|
5
|
-
vanna/ZhipuAI/ZhipuAI_Chat.py,sha256=
|
|
4
|
+
vanna/utils.py,sha256=cs0B_0MwhmPI2nWjVHifDYCmCR0kkddylQ2vloaPDSw,2247
|
|
5
|
+
vanna/ZhipuAI/ZhipuAI_Chat.py,sha256=rz4W30QxL9OkuJq560VPTUc2iaNz05s_7edu4r7nrXo,8728
|
|
6
6
|
vanna/ZhipuAI/ZhipuAI_embeddings.py,sha256=lUqzJg9fOx7rVFhjdkFjXcDeVGV4aAB5Ss0oERsa8pE,2849
|
|
7
7
|
vanna/ZhipuAI/__init__.py,sha256=NlsijtcZp5Tj9jkOe9fNcOQND_QsGgu7otODsCLBPr0,116
|
|
8
8
|
vanna/anthropic/__init__.py,sha256=85s_2mAyyPxc0T_0JEvYeAkEKWJwkwqoyUwSC5dw9Gk,43
|
|
9
9
|
vanna/anthropic/anthropic_chat.py,sha256=Wk0o-NMW1uvR2fhSWxrR_2FqNh-dLprNG4uuVqpqAkY,2615
|
|
10
10
|
vanna/base/__init__.py,sha256=Sl-HM1RRYzAZoSqmL1CZQmF3ZF-byYTCFQP3JZ2A5MU,28
|
|
11
|
-
vanna/base/base.py,sha256=
|
|
11
|
+
vanna/base/base.py,sha256=r_eF2YfOnfYGMSJwPt7mpQt4Hso3_59twQkPKrjtmws,54875
|
|
12
12
|
vanna/chromadb/__init__.py,sha256=-iL0nW_g4uM8nWKMuWnNePfN4nb9uk8P3WzGvezOqRg,50
|
|
13
|
-
vanna/chromadb/chromadb_vector.py,sha256=
|
|
13
|
+
vanna/chromadb/chromadb_vector.py,sha256=6ZQUE6YncNmRqAAHKDxgLD2dn_d26W_cSub4CM_b8dA,8453
|
|
14
14
|
vanna/exceptions/__init__.py,sha256=N76unE7sjbGGBz6LmCrPQAugFWr9cUFv8ErJxBrCTts,717
|
|
15
15
|
vanna/flask/__init__.py,sha256=UgM0Ce5pGDdadWV6ZEAXj7RXDE1E420DW1wtR-juBMw,21212
|
|
16
|
-
vanna/flask/assets.py,sha256=
|
|
16
|
+
vanna/flask/assets.py,sha256=pOOtPV8aWtFsTuxJneFHcfrXhXh6cOSvS-Y8JO2HYrY,180924
|
|
17
17
|
vanna/marqo/__init__.py,sha256=GaAWtJ0B-H5rTY607iLCCrLD7T0zMYM5qWIomEB9gLk,37
|
|
18
18
|
vanna/marqo/marqo.py,sha256=W7WTtzWp4RJjZVy6OaXHqncUBIPdI4Q7qH7BRCxZ1_A,5242
|
|
19
19
|
vanna/mistral/__init__.py,sha256=70rTY-69Z2ehkkMj84dNMCukPo6AWdflBGvIB_pztS0,29
|
|
@@ -21,11 +21,11 @@ vanna/mistral/mistral.py,sha256=DAEqAT9SzC91rfMM_S3SuzBZ34MrKHw9qAj6EP2MGVk,1508
|
|
|
21
21
|
vanna/ollama/__init__.py,sha256=4xyu8aHPdnEHg5a-QAMwr5o0ns5wevsp_zkI-ndMO2k,27
|
|
22
22
|
vanna/ollama/ollama.py,sha256=jfW9VQHAcmzDeo4jF3HJjOMYwAWmptknKqEJaQ0MTno,2418
|
|
23
23
|
vanna/openai/__init__.py,sha256=tGkeQ7wTIPsando7QhoSHehtoQVdYLwFbKNlSmCmNeQ,86
|
|
24
|
-
vanna/openai/openai_chat.py,sha256=
|
|
24
|
+
vanna/openai/openai_chat.py,sha256=lm-hUsQxu6Q1t06A2csC037zI4VkMk0wFbQ-_Lj74Wg,4764
|
|
25
25
|
vanna/openai/openai_embeddings.py,sha256=g4pNh9LVcYP9wOoO8ecaccDFWmCUYMInebfHucAa2Gc,1260
|
|
26
26
|
vanna/types/__init__.py,sha256=Qhn_YscKtJh7mFPCyCDLa2K8a4ORLMGVnPpTbv9uB2U,4957
|
|
27
27
|
vanna/vannadb/__init__.py,sha256=C6UkYocmO6dmzfPKZaWojN0mI5YlZZ9VIbdcquBE58A,48
|
|
28
28
|
vanna/vannadb/vannadb_vector.py,sha256=f4kddaJgTpZync7wnQi09QdODUuMtiHsK7WfKBUAmSo,5644
|
|
29
|
-
vanna-0.3.
|
|
30
|
-
vanna-0.3.
|
|
31
|
-
vanna-0.3.
|
|
29
|
+
vanna-0.3.3.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
30
|
+
vanna-0.3.3.dist-info/METADATA,sha256=ijf-5mr2VmnkMHFRJB1x0wnXP0W8KGPnG-j0TauVFXA,10107
|
|
31
|
+
vanna-0.3.3.dist-info/RECORD,,
|
|
File without changes
|