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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vector_vault
3
- Version: 7.2.4
3
+ Version: 7.2.6
4
4
  Summary: Quickly create RAG apps, Agents, and Unleash the full power of 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="7.2.4",
5
+ version="7.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: 7.2.4
3
+ Version: 7.2.6
4
4
  Summary: Quickly create RAG apps, Agents, and Unleash the full power of AI with Vector Vault
5
5
  Home-page: https://github.com/John-Rood/VectorVault
6
6
  Author: VectorVault.io
@@ -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-3": 128000,
400
- "grok-3-fast-latest": 128000,
401
- "grok-3-mini": 128000,
402
- "grok-3-mini-fast": 128000,
403
- "grok-2-vision-latest": 32000,
404
- "default": "grok-3-latest",
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-4": 128000,
408
- "grok-3": 128000,
409
- "grok-3-mini": 128000,
410
- "grok-2-vision-latest": 16000,
411
- "default": "grok-3-latest",
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 self.default_model
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
- context = self.get_similar(search_input, n=n_context)
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
- context = self.get_similar(search_input, n=n_context)
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