vector-vault 5.2.4__tar.gz → 5.2.6__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.
Files changed (22) hide show
  1. {vector_vault-5.2.4 → vector_vault-5.2.6}/PKG-INFO +1 -1
  2. {vector_vault-5.2.4 → vector_vault-5.2.6}/setup.py +1 -1
  3. {vector_vault-5.2.4 → vector_vault-5.2.6}/vector_vault.egg-info/PKG-INFO +1 -1
  4. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/cloudmanager.py +21 -11
  5. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/vault.py +30 -27
  6. {vector_vault-5.2.4 → vector_vault-5.2.6}/LICENSE +0 -0
  7. {vector_vault-5.2.4 → vector_vault-5.2.6}/README.md +0 -0
  8. {vector_vault-5.2.4 → vector_vault-5.2.6}/setup.cfg +0 -0
  9. {vector_vault-5.2.4 → vector_vault-5.2.6}/vector_vault.egg-info/SOURCES.txt +0 -0
  10. {vector_vault-5.2.4 → vector_vault-5.2.6}/vector_vault.egg-info/dependency_links.txt +0 -0
  11. {vector_vault-5.2.4 → vector_vault-5.2.6}/vector_vault.egg-info/requires.txt +0 -0
  12. {vector_vault-5.2.4 → vector_vault-5.2.6}/vector_vault.egg-info/top_level.txt +0 -0
  13. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/__init__.py +0 -0
  14. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/ai.py +0 -0
  15. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/cloud_api.py +0 -0
  16. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/creds.py +0 -0
  17. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/download.py +0 -0
  18. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/groq_api.py +0 -0
  19. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/itemize.py +0 -0
  20. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/tools_gpt.py +0 -0
  21. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/vecreq.py +0 -0
  22. {vector_vault-5.2.4 → vector_vault-5.2.6}/vectorvault/wrap.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vector_vault
3
- Version: 5.2.4
3
+ Version: 5.2.6
4
4
  Summary: Quickly create ChatGPT RAG apps and Unleash the full potential of GenAI with Vector Vault
5
5
  Home-page: https://github.com/John-Rood/VectorVault
6
6
  Author: VectorVault.io
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="vector_vault",
5
- version="5.2.4",
5
+ version="5.2.6",
6
6
  packages=find_packages(),
7
7
  author="VectorVault.io",
8
8
  author_email="john@johnrood.com",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vector-vault
3
- Version: 5.2.4
3
+ Version: 5.2.6
4
4
  Summary: Quickly create ChatGPT RAG apps and Unleash the full potential of GenAI with Vector Vault
5
5
  Home-page: https://github.com/John-Rood/VectorVault
6
6
  Author: VectorVault.io
@@ -116,22 +116,32 @@ class CloudManager:
116
116
 
117
117
  def build_update(self):
118
118
  _map = self.get_mapping()
119
- entry_updated = False
120
- for entry in _map:
121
- if entry['vault'] == self.vault:
122
- entry['last_use'] = time.time()
123
- entry['total_use'] = entry.get('total_use', 0) + 1
124
- entry_updated = True
125
- break
126
-
127
- _map.append({'vault': self.vault, 'last_use': time.time(), 'total_use': 1}) if not entry_updated else 0
128
-
119
+ for i in range(len(_map)):
120
+ if _map[i]['vault'] == self.vault:
121
+ _map[i]['last_use'] = time.time()
122
+ try:
123
+ _map[i]['total_use'] += 1
124
+ except:
125
+ _map[i]['total_use'] = 1
126
+
129
127
  with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file:
130
128
  _path = temp_file.name
131
129
  json.dump(_map, temp_file, indent=2)
132
130
 
133
131
  self.upload_temp_file(_path, f'{self.username}.json')
134
-
132
+
133
+ def build_data_update(self):
134
+ _map = self.get_mapping()
135
+ for i in range(len(_map)):
136
+ if _map[i]['vault'] == self.vault:
137
+ _map[i]['last_update'] = time.time()
138
+
139
+ with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file:
140
+ _path = temp_file.name
141
+ json.dump(_map, temp_file, indent=2)
142
+
143
+ self.upload_temp_file(_path, f'{self.username}.json')
144
+
135
145
  def delete_blob(self, blob):
136
146
  blob.delete()
137
147
 
@@ -254,7 +254,8 @@ class Vault:
254
254
  total_saved_items += 1
255
255
 
256
256
  self.upload_vectors(vault)
257
- self.cloud_manager.update()
257
+ self.update_vault_data(this_vault_only=True)
258
+ self.cloud_manager.build_data_update()
258
259
  print(f"upload time --- {(time.time() - start_time)} seconds --- {total_saved_items} items saved") if self.verbose else 0
259
260
 
260
261
 
@@ -278,6 +279,7 @@ class Vault:
278
279
  self.items.clear()
279
280
  self.cloud_manager.delete()
280
281
  self.x = 0
282
+ self.update_vault_data(remove_vault=True)
281
283
  print('Vault deleted')
282
284
 
283
285
 
@@ -287,35 +289,35 @@ class Vault:
287
289
  self.map.popitem()
288
290
 
289
291
 
290
- def update_vault_data(self):
292
+ def update_vault_data(self, this_vault_only=False, remove_vault=False):
291
293
  nary = []
292
- try:
294
+ try: # try because new users do not have this file on first call
293
295
  vault_data = self.cloud_manager.get_mapping()
294
- all_vaults = self.get_vaults('')
295
- _data = [vault for vault in vault_data if vault['vault'] in all_vaults]
296
- for i in all_vaults:
297
- total_items = self.get_total_items(i)
298
- time.sleep(.01)
299
- item = self.get_items([ total_items - 1 ], i)[0]['metadata']
300
- try:
301
- time_for_last_item = item['updated']
302
- except:
303
- time_for_last_item = item['updated_at']
304
-
305
- vault_dict = { 'vault': f'{i}', 'total_items': total_items, 'last_update': time_for_last_item }
306
-
307
- for original_data in _data:
308
- if original_data['vault'] == f'{i}':
309
- if 'last_use' in original_data:
310
- vault_dict['last_use'] = original_data['last_use']
311
- if 'total_use' in original_data:
312
- vault_dict['total_use'] = original_data['total_use']
313
-
314
- nary.append(vault_dict)
315
-
316
- except Exception as e:
296
+ all_vaults = [i['vault'] for i in vault_data]
297
+ if self.vault not in all_vaults:
298
+ nary.append({ 'vault': f'{self.vault}', 'total_items': self.get_total_items(), 'last_update': time.time(), 'last_use': time.time(), 'total_use': 1 })
299
+
300
+ for i in vault_data:
301
+ if not this_vault_only and not remove_vault:
302
+ total_items = self.get_total_items(i['vault'])
303
+ else:
304
+ total_items = i['total_items']
305
+
306
+ if this_vault_only and i['vault'] == self.vault:
307
+ total_items = self.get_total_items()
308
+
309
+ vault_dict = { 'vault': i['vault'], 'total_items': total_items, 'last_update': i['last_update'] }
310
+
311
+ if 'last_use' in i:
312
+ vault_dict['last_use'] = i['last_use']
313
+ if 'total_use' in i:
314
+ vault_dict['total_use'] = i['total_use']
315
+
316
+ nary.append(vault_dict) if not remove_vault else 0
317
+
318
+ except Exception as e: # so we make the file
317
319
  print(f"An error occurred: {e}")
318
- nary.append({ 'vault': 'demo', 'total_items': 0, 'last_update': time.time(), 'last_use': time.time(), 'total_use': 0 })
320
+ nary.append({ 'vault': 'demo', 'total_items': 0, 'last_update': time.time(), 'last_use': time.time(), 'total_use': 1 })
319
321
 
320
322
  with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file:
321
323
  nary_temp_file_path = temp_file.name
@@ -362,6 +364,7 @@ class Vault:
362
364
  self.remap(item_id)
363
365
  rebuild_vectors(item_id)
364
366
 
367
+ self.update_vault_data(this_vault_only=True)
365
368
  print(f'Item {item_id} deleted') if self.verbose else 0
366
369
 
367
370
 
File without changes
File without changes
File without changes