mb-rag 1.1.37__tar.gz → 1.1.39__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.

Potentially problematic release.


This version of mb-rag might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mb_rag
3
- Version: 1.1.37
3
+ Version: 1.1.39
4
4
  Summary: RAG function file
5
5
  Author: ['Malav Bateriwala']
6
6
  Requires-Python: >=3.8
@@ -325,7 +325,8 @@ class embedding_generator:
325
325
  # Initialize generator
326
326
  gen = embedding_generator(
327
327
  model="openai",
328
- model_type="text-embedding-3-small"
328
+ model_type="text-embedding-3-small",
329
+ collection_name='test'
329
330
  )
330
331
 
331
332
  # Generate embeddings
@@ -335,7 +336,7 @@ class embedding_generator:
335
336
  )
336
337
 
337
338
  # Load retriever
338
- retriever = gen.load_retriever('./embeddings')
339
+ retriever = gen.load_retriever('./embeddings', collection_name='test')
339
340
 
340
341
  # Query embeddings
341
342
  results = gen.query_embeddings("What is this about?")
@@ -430,12 +431,13 @@ class embedding_generator:
430
431
  else:
431
432
  return "Vector store not found"
432
433
 
433
- def load_embeddings(self, embeddings_folder_path: str):
434
+ def load_embeddings(self, embeddings_folder_path: str,collection_name: str = 'test'):
434
435
  """
435
436
  Load embeddings from folder.
436
437
 
437
438
  Args:
438
439
  embeddings_folder_path (str): Path to embeddings folder
440
+ collection_name (str): Name of the collection. Default: 'test'
439
441
 
440
442
  Returns:
441
443
  Optional[Chroma]: Loaded vector store or None if not found
@@ -443,7 +445,8 @@ class embedding_generator:
443
445
  if self.check_file(embeddings_folder_path):
444
446
  if self.vector_store_type == 'chroma':
445
447
  return Chroma(persist_directory=embeddings_folder_path,
446
- embedding_function=self.model)
448
+ embedding_function=self.model,
449
+ collection_name=collection_name)
447
450
  else:
448
451
  if self.logger:
449
452
  self.logger.info("Embeddings file not found")
@@ -451,7 +454,8 @@ class embedding_generator:
451
454
 
452
455
  def load_retriever(self, embeddings_folder_path: str,
453
456
  search_type: List[str] = ["similarity_score_threshold"],
454
- search_params: List[Dict] = [{"k": 3, "score_threshold": 0.9}]):
457
+ search_params: List[Dict] = [{"k": 3, "score_threshold": 0.9}],
458
+ collection_name: str = 'test'):
455
459
  """
456
460
  Load retriever with search configuration.
457
461
 
@@ -459,6 +463,7 @@ class embedding_generator:
459
463
  embeddings_folder_path (str): Path to embeddings folder
460
464
  search_type (List[str]): List of search types
461
465
  search_params (List[Dict]): List of search parameters
466
+ collection_name (str): Name of the collection. Default: 'test'
462
467
 
463
468
  Returns:
464
469
  Union[Any, List[Any]]: Single retriever or list of retrievers
@@ -472,7 +477,7 @@ class embedding_generator:
472
477
  )
473
478
  ```
474
479
  """
475
- db = self.load_embeddings(embeddings_folder_path)
480
+ db = self.load_embeddings(embeddings_folder_path, collection_name)
476
481
  if db is not None:
477
482
  if self.vector_store_type == 'chroma':
478
483
  if len(search_type) != len(search_params):
@@ -508,7 +513,7 @@ class embedding_generator:
508
513
  chunk_overlap (int): Overlap between chunks
509
514
  """
510
515
  if self.vector_store_type == 'chroma':
511
- db = self.load_embeddings(embeddings_folder_path)
516
+ db = self.load_embeddings(embeddings_folder_path, collection_name)
512
517
  if db is not None:
513
518
  docs = self.tokenize(data, text_splitter_type, chunk_size, chunk_overlap)
514
519
  db.add_documents(docs)
@@ -1,5 +1,5 @@
1
1
  MAJOR_VERSION = 1
2
2
  MINOR_VERSION = 1
3
- PATCH_VERSION = 37
3
+ PATCH_VERSION = 39
4
4
  version = '{}.{}.{}'.format(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION)
5
5
  __all__ = ['MAJOR_VERSION', 'MINOR_VERSION', 'PATCH_VERSION', 'version']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mb_rag
3
- Version: 1.1.37
3
+ Version: 1.1.39
4
4
  Summary: RAG function file
5
5
  Author: ['Malav Bateriwala']
6
6
  Requires-Python: >=3.8
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes