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.
- {vector_vault-2.7.0 → vector_vault-2.7.2}/PKG-INFO +1 -1
- {vector_vault-2.7.0 → vector_vault-2.7.2}/setup.py +1 -1
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/PKG-INFO +1 -1
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/cloudmanager.py +11 -13
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/vault.py +22 -19
- {vector_vault-2.7.0 → vector_vault-2.7.2}/LICENSE +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/README.md +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/setup.cfg +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/SOURCES.txt +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/dependency_links.txt +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/requires.txt +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vector_vault.egg-info/top_level.txt +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/__init__.py +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/ai.py +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/cloud_api.py +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/creds.py +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/download.py +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/itemize.py +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/tools_gpt.py +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/vecreq.py +0 -0
- {vector_vault-2.7.0 → vector_vault-2.7.2}/vectorvault/wrap.py +0 -0
|
@@ -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,
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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
|
|
145
|
+
def delete_items(self, item_ids : list[int]) -> None:
|
|
147
146
|
'''
|
|
148
|
-
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
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
|
|
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
|