vector-vault 7.2.4__tar.gz → 7.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.
- {vector_vault-7.2.4 → vector_vault-7.2.6}/PKG-INFO +1 -1
- {vector_vault-7.2.4 → vector_vault-7.2.6}/setup.py +1 -1
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vector_vault.egg-info/PKG-INFO +1 -1
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vectorvault/ai.py +16 -12
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vectorvault/vault.py +44 -4
- {vector_vault-7.2.4 → vector_vault-7.2.6}/LICENSE +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/README.md +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/setup.cfg +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vector_vault.egg-info/SOURCES.txt +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vector_vault.egg-info/dependency_links.txt +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vector_vault.egg-info/requires.txt +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vector_vault.egg-info/top_level.txt +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vectorvault/__init__.py +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vectorvault/cloud_api.py +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vectorvault/cloudmanager.py +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vectorvault/credentials_manager.py +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vectorvault/itemize.py +0 -0
- {vector_vault-7.2.4 → vector_vault-7.2.6}/vectorvault/utils.py +0 -0
|
@@ -395,20 +395,24 @@ class GrokPlatform(LLMPlatform):
|
|
|
395
395
|
|
|
396
396
|
# Example model token limits for xAI Grok (adjust as needed)
|
|
397
397
|
self.model_token_limits = {
|
|
398
|
+
"grok-code-fast": 256000,
|
|
398
399
|
"grok-4": 256000,
|
|
399
|
-
"grok-
|
|
400
|
-
"grok-
|
|
401
|
-
"grok-3
|
|
402
|
-
"grok-3-mini
|
|
403
|
-
"grok-2-vision-latest":
|
|
404
|
-
"default": "grok-
|
|
400
|
+
"grok-4-fast-reasoning": 2000000,
|
|
401
|
+
"grok-4-fast-non-reasoning": 2000000,
|
|
402
|
+
"grok-3": 131072,
|
|
403
|
+
"grok-3-mini": 131072,
|
|
404
|
+
"grok-2-vision-latest": 32768,
|
|
405
|
+
"default": "grok-4-fast-non-reasoning",
|
|
405
406
|
}
|
|
406
407
|
self.front_model_token_limits = {
|
|
407
|
-
"grok-
|
|
408
|
-
"grok-
|
|
409
|
-
"grok-
|
|
410
|
-
"grok-
|
|
411
|
-
"
|
|
408
|
+
"grok-code-fast": 256000,
|
|
409
|
+
"grok-4": 256000,
|
|
410
|
+
"grok-4-fast-reasoning": 2000000,
|
|
411
|
+
"grok-4-fast-non-reasoning": 2000000,
|
|
412
|
+
"grok-3": 131072,
|
|
413
|
+
"grok-3-mini": 131072,
|
|
414
|
+
"grok-2-vision-latest": 32768,
|
|
415
|
+
"default": "grok-4-fast-non-reasoning",
|
|
412
416
|
}
|
|
413
417
|
|
|
414
418
|
self.default_model = self.model_token_limits["default"]
|
|
@@ -520,7 +524,7 @@ class GrokPlatform(LLMPlatform):
|
|
|
520
524
|
}
|
|
521
525
|
]
|
|
522
526
|
"""
|
|
523
|
-
model = model if model else
|
|
527
|
+
model = model if model else "grok-2-vision-latest"
|
|
524
528
|
if not image_path and not image_url:
|
|
525
529
|
raise ValueError("Must specify either image_path or image_url.")
|
|
526
530
|
|
|
@@ -852,7 +852,7 @@ class Vault:
|
|
|
852
852
|
def load_vectors(self, vault = None):
|
|
853
853
|
start_time = time.time()
|
|
854
854
|
vault = vault if vault else self.vault
|
|
855
|
-
t = T(target=self.load_mapping())
|
|
855
|
+
t = T(target=self.load_mapping, args=(vault,))
|
|
856
856
|
t.start()
|
|
857
857
|
temp_file_path = self.cloud_manager.download_to_temp_file(name_vecs(vault, self.user, self.api))
|
|
858
858
|
self._vectors = get_vectors(self.dims)
|
|
@@ -1003,7 +1003,7 @@ class Vault:
|
|
|
1003
1003
|
Internal function that returns vector similar items. Requires input vector, returns similar items
|
|
1004
1004
|
'''
|
|
1005
1005
|
try:
|
|
1006
|
-
self.load_vectors()
|
|
1006
|
+
self.load_vectors(vault)
|
|
1007
1007
|
start_time = time.time()
|
|
1008
1008
|
if not include_distances:
|
|
1009
1009
|
vecs = self.vectors.get_nns_by_vector(vector, n)
|
|
@@ -1181,6 +1181,38 @@ class Vault:
|
|
|
1181
1181
|
return self.get_items_by_vector(vector, n, include_distances = include_distances, vault = vault if vault else self.vault)
|
|
1182
1182
|
|
|
1183
1183
|
|
|
1184
|
+
def get_similar_from_vaults(self, text: str, n: int = 4, vaults: List[str] = None):
|
|
1185
|
+
'''
|
|
1186
|
+
Searches for the n most similar items in each of the provided vaults, combines the results,
|
|
1187
|
+
sorts by distance, and returns the closest n items overall (with distances).
|
|
1188
|
+
|
|
1189
|
+
Args:
|
|
1190
|
+
text: The query text to embed and search with
|
|
1191
|
+
n: The number of nearest items to retrieve per vault, and the number of items to return overall
|
|
1192
|
+
vaults: A non-empty list of vault names to search
|
|
1193
|
+
|
|
1194
|
+
Returns:
|
|
1195
|
+
A list of up to n items, each including a 'distance' field
|
|
1196
|
+
'''
|
|
1197
|
+
if not vaults or not isinstance(vaults, list):
|
|
1198
|
+
raise ValueError("A non-empty list of vaults must be provided.")
|
|
1199
|
+
|
|
1200
|
+
T(target=self.cloud_manager.build_update, args=(n,)).start()
|
|
1201
|
+
vector = self.process_batch([text], never_stop=False, loop_timeout=180)[0]
|
|
1202
|
+
|
|
1203
|
+
combined_results = []
|
|
1204
|
+
for v in vaults:
|
|
1205
|
+
try:
|
|
1206
|
+
results = self.get_items_by_vector(vector, n, include_distances=True, vault=v)
|
|
1207
|
+
combined_results.extend(results)
|
|
1208
|
+
except Exception:
|
|
1209
|
+
# Skip vaults that cannot be loaded or queried
|
|
1210
|
+
continue
|
|
1211
|
+
|
|
1212
|
+
combined_sorted = sorted(combined_results, key=lambda x: x.get('distance', float('inf')))
|
|
1213
|
+
return combined_sorted[:n]
|
|
1214
|
+
|
|
1215
|
+
|
|
1184
1216
|
def add_item(self, text: str, meta: dict = None, name: str = None):
|
|
1185
1217
|
"""
|
|
1186
1218
|
If your text length is greater than 15000 characters, you should use Vault.split_text(your_text) to
|
|
@@ -1317,6 +1349,7 @@ class Vault:
|
|
|
1317
1349
|
timeout: int = 300,
|
|
1318
1350
|
image_path: str = None,
|
|
1319
1351
|
image_url: str = None,
|
|
1352
|
+
vaults: List[str] = None,
|
|
1320
1353
|
):
|
|
1321
1354
|
'''
|
|
1322
1355
|
Chat get response from OpenAI's ChatGPT.
|
|
@@ -1404,7 +1437,10 @@ class Vault:
|
|
|
1404
1437
|
else:
|
|
1405
1438
|
search_input = segment + history if history_search else segment
|
|
1406
1439
|
|
|
1407
|
-
|
|
1440
|
+
if vaults and isinstance(vaults, list) and all(isinstance(v, str) for v in vaults):
|
|
1441
|
+
context = self.get_similar_from_vaults(search_input, n=n_context, vaults=vaults)
|
|
1442
|
+
else:
|
|
1443
|
+
context = self.get_similar(search_input, n=n_context)
|
|
1408
1444
|
input_ = str(context) if include_context_meta else ''
|
|
1409
1445
|
for text in context:
|
|
1410
1446
|
input_ += text['data']
|
|
@@ -1454,6 +1490,7 @@ class Vault:
|
|
|
1454
1490
|
timeout: int = 300,
|
|
1455
1491
|
image_path: str = None,
|
|
1456
1492
|
image_url: str = None,
|
|
1493
|
+
vaults: List[str] = None,
|
|
1457
1494
|
):
|
|
1458
1495
|
'''
|
|
1459
1496
|
Always use this get_chat_stream() wrapped by either print_stream(), or cloud_stream()
|
|
@@ -1547,7 +1584,10 @@ class Vault:
|
|
|
1547
1584
|
else:
|
|
1548
1585
|
search_input = segment + history if history_search else segment
|
|
1549
1586
|
|
|
1550
|
-
|
|
1587
|
+
if vaults and isinstance(vaults, list) and all(isinstance(v, str) for v in vaults):
|
|
1588
|
+
context = self.get_similar_from_vaults(search_input, n=n_context, vaults=vaults)
|
|
1589
|
+
else:
|
|
1590
|
+
context = self.get_similar(search_input, n=n_context)
|
|
1551
1591
|
input_ = str(context) if include_context_meta else ''
|
|
1552
1592
|
for text in context:
|
|
1553
1593
|
input_ += text['data']
|
|
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
|