vector-vault 4.2.8__tar.gz → 4.3.0__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.
- {vector_vault-4.2.8 → vector_vault-4.3.0}/PKG-INFO +1 -1
- {vector_vault-4.2.8 → vector_vault-4.3.0}/setup.py +1 -1
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vector_vault.egg-info/PKG-INFO +1 -1
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/cloudmanager.py +2 -2
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/vault.py +14 -23
- {vector_vault-4.2.8 → vector_vault-4.3.0}/LICENSE +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/README.md +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/setup.cfg +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vector_vault.egg-info/SOURCES.txt +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vector_vault.egg-info/dependency_links.txt +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vector_vault.egg-info/requires.txt +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vector_vault.egg-info/top_level.txt +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/__init__.py +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/ai.py +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/cloud_api.py +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/creds.py +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/download.py +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/itemize.py +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/tools_gpt.py +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/vecreq.py +0 -0
- {vector_vault-4.2.8 → vector_vault-4.3.0}/vectorvault/wrap.py +0 -0
|
@@ -17,7 +17,7 @@ from google.cloud import storage
|
|
|
17
17
|
from .creds import CustomCredentials
|
|
18
18
|
from .vecreq import call_proj, call_update
|
|
19
19
|
from .itemize import cloud_name
|
|
20
|
-
from .vault import ThreadPoolExecutor, as_completed, time, json, os, tempfile, time
|
|
20
|
+
from .vault import ThreadPoolExecutor, T, as_completed, time, json, os, tempfile, time
|
|
21
21
|
|
|
22
22
|
class CloudManager:
|
|
23
23
|
def __init__(self, user: str, api_key: str, vault: str, ai_api: str = None):
|
|
@@ -100,7 +100,7 @@ class CloudManager:
|
|
|
100
100
|
return _map
|
|
101
101
|
|
|
102
102
|
def update(self):
|
|
103
|
-
call_update(self.user, self.vault, self.api)
|
|
103
|
+
T(target=call_update, args=(self.user, self.vault, self.api)).start()
|
|
104
104
|
|
|
105
105
|
def build_update(self):
|
|
106
106
|
_map = self.get_mapping()
|
|
@@ -78,8 +78,14 @@ class Vault:
|
|
|
78
78
|
if openai_key:
|
|
79
79
|
self.openai_key = openai_key
|
|
80
80
|
openai.api_key = self.openai_key
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
try:
|
|
82
|
+
self.cloud_manager = CloudManager(self.user, self.api, self.vault, self.openai_key)
|
|
83
|
+
print(f'Connected vault: {self.vault}') if self.verbose else 0
|
|
84
|
+
except Exception as e:
|
|
85
|
+
print('API KEY NOT FOUND or no internet connection!', e)
|
|
86
|
+
# user can still use the get_chat() function without an api key
|
|
87
|
+
self.cloud_manager = None
|
|
88
|
+
|
|
83
89
|
self.embeddings_model = embeddings_model if embeddings_model else 'text-embedding-3-small'
|
|
84
90
|
self.dims = 1536 if embeddings_model != 'text-embedding-3-large' else 3072
|
|
85
91
|
self.vectors = get_vectors(self.dims)
|
|
@@ -95,19 +101,6 @@ class Vault:
|
|
|
95
101
|
self.tools = ToolsGPT(verbose=verbose)
|
|
96
102
|
self.rate_limiter = RateLimiter(max_attempts=30)
|
|
97
103
|
self.cuid = conversation_user_id
|
|
98
|
-
t.join()
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def connect_to_cloud(self):
|
|
102
|
-
try:
|
|
103
|
-
self.cloud_manager = CloudManager(self.user, self.api, self.vault, self.openai_key)
|
|
104
|
-
print(f'Connected vault: {self.vault}') if self.verbose else 0
|
|
105
|
-
|
|
106
|
-
except Exception as e:
|
|
107
|
-
print('API KEY NOT FOUND or no internet connection!', e)
|
|
108
|
-
# user can still use the get_chat() function without an api key
|
|
109
|
-
self.cloud_manager = None
|
|
110
|
-
|
|
111
104
|
|
|
112
105
|
def get_vaults(self, vault: str = None):
|
|
113
106
|
'''
|
|
@@ -392,8 +385,6 @@ class Vault:
|
|
|
392
385
|
def check_index(self):
|
|
393
386
|
if not self.x_checked:
|
|
394
387
|
start_time = time.time()
|
|
395
|
-
while self.cloud_manager is None:
|
|
396
|
-
time.sleep(.01)
|
|
397
388
|
if self.cloud_manager.vault_exists(name_vecs(self.vault, self.user, self.api)):
|
|
398
389
|
if not self.vecs_loaded:
|
|
399
390
|
self.load_vectors()
|
|
@@ -1015,7 +1006,7 @@ class Vault:
|
|
|
1015
1006
|
print(f"API Failed too many times, exiting loop: {e}.")
|
|
1016
1007
|
break
|
|
1017
1008
|
|
|
1018
|
-
self.update_conversation_history(self.cuid, response) if self.cuid else None
|
|
1009
|
+
self.update_conversation_history(self.cuid, response, user=False) if self.cuid else None
|
|
1019
1010
|
print("get chat time --- %s seconds ---" % (time.time() - start_time)) if self.verbose else 0
|
|
1020
1011
|
|
|
1021
1012
|
return {'response': response, 'context': context} if return_context else response
|
|
@@ -1135,7 +1126,7 @@ class Vault:
|
|
|
1135
1126
|
except Exception as e:
|
|
1136
1127
|
raise e
|
|
1137
1128
|
if counter == len(inputs):
|
|
1138
|
-
self.update_conversation_history(self.cuid, full_response) if self.cuid else None
|
|
1129
|
+
self.update_conversation_history(self.cuid, full_response, user=False) if self.cuid else None
|
|
1139
1130
|
yield '!END'
|
|
1140
1131
|
self.rate_limiter.on_success()
|
|
1141
1132
|
|
|
@@ -1173,11 +1164,11 @@ class Vault:
|
|
|
1173
1164
|
for i in range(len(metatag)):
|
|
1174
1165
|
yield str(metatag_prefixes[i]) + str(item['metadata'][f'{metatag[i]}'])
|
|
1175
1166
|
yield item['data']
|
|
1176
|
-
self.update_conversation_history(self.cuid, full_response) if self.cuid else None
|
|
1167
|
+
self.update_conversation_history(self.cuid, full_response, user=False) if self.cuid else None
|
|
1177
1168
|
yield '!END'
|
|
1178
1169
|
self.rate_limiter.on_success()
|
|
1179
1170
|
else:
|
|
1180
|
-
self.update_conversation_history(self.cuid, full_response) if self.cuid else None
|
|
1171
|
+
self.update_conversation_history(self.cuid, full_response, user=False) if self.cuid else None
|
|
1181
1172
|
yield '!END'
|
|
1182
1173
|
self.rate_limiter.on_success()
|
|
1183
1174
|
|
|
@@ -1189,7 +1180,7 @@ class Vault:
|
|
|
1189
1180
|
self.rate_limiter.on_success()
|
|
1190
1181
|
except Exception as e:
|
|
1191
1182
|
raise e
|
|
1192
|
-
self.update_conversation_history(self.cuid, full_response) if self.cuid else None
|
|
1183
|
+
self.update_conversation_history(self.cuid, full_response, user=False) if self.cuid else None
|
|
1193
1184
|
yield '!END'
|
|
1194
1185
|
|
|
1195
1186
|
self.rate_limiter.on_success()
|
|
@@ -1283,7 +1274,7 @@ class Vault:
|
|
|
1283
1274
|
t2 = T(target=self.cloud_manager.upload_to_cloud, args=(f'user_history/{conversation_id}/metadata', json.dumps(metadata_list)))
|
|
1284
1275
|
t1.start()
|
|
1285
1276
|
t2.start()
|
|
1286
|
-
|
|
1277
|
+
self.add_n_save(message, vault = f'user_history/{conversation_id}/vectors', name = message_id)
|
|
1287
1278
|
t1.join()
|
|
1288
1279
|
t2.join()
|
|
1289
1280
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|