vector-vault 2.7.0__tar.gz → 2.7.2__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 (21) hide show
  1. {vector_vault-2.7.0 → vector_vault-2.7.2}/PKG-INFO +1 -1
  2. {vector_vault-2.7.0 → vector_vault-2.7.2}/setup.py +1 -1
  3. {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/PKG-INFO +1 -1
  4. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/cloudmanager.py +11 -13
  5. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/vault.py +22 -19
  6. {vector_vault-2.7.0 → vector_vault-2.7.2}/LICENSE +0 -0
  7. {vector_vault-2.7.0 → vector_vault-2.7.2}/README.md +0 -0
  8. {vector_vault-2.7.0 → vector_vault-2.7.2}/setup.cfg +0 -0
  9. {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/SOURCES.txt +0 -0
  10. {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/dependency_links.txt +0 -0
  11. {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/requires.txt +0 -0
  12. {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/top_level.txt +0 -0
  13. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/__init__.py +0 -0
  14. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/ai.py +0 -0
  15. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/cloud_api.py +0 -0
  16. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/creds.py +0 -0
  17. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/download.py +0 -0
  18. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/itemize.py +0 -0
  19. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/tools_gpt.py +0 -0
  20. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/vecreq.py +0 -0
  21. {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/wrap.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vector_vault
3
- Version: 2.7.0
3
+ Version: 2.7.2
4
4
  Summary: Customize ChatGPT and unleash the full potential of generative AI 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="2.7.0",
5
+ version="2.7.2",
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: 2.7.0
3
+ Version: 2.7.2
4
4
  Summary: Customize ChatGPT and unleash the full potential of generative AI with Vector Vault
5
5
  Home-page: https://github.com/John-Rood/VectorVault
6
6
  Author: VectorVault.io
@@ -100,11 +100,11 @@ class CloudManager:
100
100
  else:
101
101
  print(f"Item metadata at path {meta_path} does not exist.")
102
102
 
103
- def rename_item(self, vault, old_item, new_item):
104
- old_path = self.cloud_name(vault, old_item, self.user, self.api, item=True)
105
- new_path = self.cloud_name(vault, new_item, self.user, self.api, item=True)
106
- old_meta_path = self.cloud_name(vault, old_item, self.user, self.api, meta=True)
107
- new_meta_path = self.cloud_name(vault, new_item, self.user, self.api, meta=True)
103
+ def rename_item(self, old_item : int, new_item : int):
104
+ old_path = self.cloud_name(self.vault, old_item, self.user, self.api, item=True)
105
+ new_path = self.cloud_name(self.vault, new_item, self.user, self.api, item=True)
106
+ old_meta_path = self.cloud_name(self.vault, old_item, self.user, self.api, meta=True)
107
+ new_meta_path = self.cloud_name(self.vault, new_item, self.user, self.api, meta=True)
108
108
 
109
109
  old_blob = self.cloud.blob(old_path)
110
110
  new_blob = self.cloud.blob(new_path)
@@ -117,19 +117,17 @@ class CloudManager:
117
117
  else:
118
118
  print(f"Item at path {old_path} does not exist.")
119
119
  if old_meta_blob.exists(self.storage_client):
120
- self.cloud.copy_blob(old_meta_blob, self.cloud, new_meta_blob.name)
120
+ meta_data_string = old_meta_blob.download_as_string()
121
+ meta_data = json.loads(meta_data_string)
122
+ meta_data['item_id'] -= 1
123
+ new_meta_blob.upload_from_string(json.dumps(meta_data))
121
124
  old_meta_blob.delete()
122
125
  else:
123
126
  print(f"Item at path {old_path} does not exist.")
124
127
 
125
128
  def delete_and_rename_all_items_after(self, item_id):
126
- """
127
- Deletes an item specified by item_id and renames all subsequent items
128
- by decrementing their item_ids by one.
129
- """
130
-
131
129
  # Delete the specified item
132
- self.delete_item(self.cloud_name(self.vault, item_id, self.user, self.api, item=True))
130
+ self.delete_item(item_id)
133
131
 
134
132
  # Start renaming subsequent items
135
133
  current_item_id = item_id + 1
@@ -142,7 +140,7 @@ class CloudManager:
142
140
 
143
141
  if current_blob.exists(self.storage_client):
144
142
  # Rename the current item to next_item_id
145
- self.rename_item(self.vault, current_item_id, next_item_id)
143
+ self.rename_item(current_item_id, next_item_id)
146
144
  current_item_id += 1
147
145
  else:
148
146
  # If the blob doesn't exist, break out of the loop
@@ -18,12 +18,11 @@ import tempfile
18
18
  import os
19
19
  import time
20
20
  import re
21
- import openai
22
21
  import json
23
22
  import traceback
24
23
  from concurrent.futures import ThreadPoolExecutor
25
24
  from .cloudmanager import CloudManager
26
- from .ai import AI
25
+ from .ai import AI, openai
27
26
  from .itemize import itemize, name_vecs, get_item, get_vectors, build_return, cloud_name
28
27
  from .vecreq import call_get_similar
29
28
  from .tools_gpt import ToolsGPT
@@ -96,7 +95,7 @@ class Vault:
96
95
  if self.saved_already == True:
97
96
  self.clear_cache()
98
97
  print("The last save was aborted before the build process finished. Clearing cache to start again...")
99
- self.saved_already = True
98
+ self.saved_already = True # Make sure the if the save process is interrupted, data will not get corrupted
100
99
  start_time = time.time()
101
100
  self.vectors.build(trees)
102
101
 
@@ -143,28 +142,31 @@ class Vault:
143
142
  self.cloud_manager.delete()
144
143
  print('Vault deleted')
145
144
 
146
- def delete_item(self, item_id : int):
145
+ def delete_items(self, item_ids : list[int]) -> None:
147
146
  '''
148
- Enter the item id to delete
147
+ Deletes one or more items from item_id(s) passed in.
148
+ item_ids is a list of one or more integers
149
149
  '''
150
150
  if self.verbose == True:
151
151
  print('Deleting item and rebuilding database...')
152
152
 
153
- num_existing_items = self.vectors.get_n_items()
154
- new_index = get_vectors(self.dims)
155
- plus_one = 0
153
+ for item_id in item_ids:
154
+ num_existing_items = self.vectors.get_n_items()
155
+ self.cloud_manager.delete_and_rename_all_items_after(item_id)
156
+ new_index = get_vectors(self.dims)
157
+ plus_one = 0
156
158
 
157
- for i in range((num_existing_items - 1)):
158
- if i == item_id:
159
- plus_one += 1
160
- else:
161
- vector = self.vectors.get_item_vector(i + plus_one)
162
- new_index.add_item(i, vector)
159
+ for i in range((num_existing_items - 1)):
160
+ if i in item_ids:
161
+ # equals 0 until the item being deleting has been removed
162
+ plus_one += 1
163
+ else:
164
+ vector = self.vectors.get_item_vector(i - plus_one)
165
+ new_index.add_item(i - plus_one, vector)
163
166
 
164
- self.x = i + 1
165
- self.vectors = new_index
166
- self.cloud_manager.delete_and_rename_all_items_after(item_id)
167
- print('Item deleted')
167
+ self.x = i + 1
168
+ self.vectors = new_index
169
+ print(f'Item {item_id} deleted')
168
170
 
169
171
  def check_index(self):
170
172
  '''
@@ -279,11 +281,12 @@ class Vault:
279
281
  '2023-07-16T04:29:00.730754', 'updated_at': '2023-07-16T04:29:00.730758'},
280
282
  'distance': 0.7101698517799377}]`
281
283
  '''
284
+ results = []
282
285
  self.load_vectors()
283
286
  start_time = time.time()
284
287
 
285
288
  for i in ids:
286
- results = []
289
+ print(i)
287
290
  # Retrieve the item
288
291
  item_data = self.cloud_manager.download_text_from_cloud(cloud_name(self.vault, i, self.user, self.api, item=True))
289
292
  # Retrieve the metadata
File without changes
File without changes
File without changes