mb-rag 1.1.7__py3-none-any.whl → 1.1.9__py3-none-any.whl

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.

mb_rag/chatbot/basic.py CHANGED
@@ -2,6 +2,7 @@ import os
2
2
  from dotenv import load_dotenv
3
3
  from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
4
4
  from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
5
+ from langchain.document_loaders import TextLoader
5
6
  from IPython.display import display, HTML
6
7
  from typing import Optional, List, Dict, Any, Union
7
8
  from mb_rag.utils.extra import check_package
@@ -155,30 +156,40 @@ class ModelFactory:
155
156
  Returns:
156
157
  ChatGroq: Chatbot model
157
158
  """
158
- if not check_package("langchain-groq"):
159
+ if not check_package("langchain_groq"):
159
160
  raise ImportError("Langchain Groq package not found. Please install it using: pip install langchain-groq")
160
161
 
161
162
  from langchain_groq import ChatGroq
162
163
  kwargs["model"] = model_name
163
164
  return ChatGroq(**kwargs)
164
165
 
165
- def invoke_query(self,query: str,get_content_only: bool = True,images: list = None,pydantic_model = None) -> str:
166
+ def _reset_model(self):
167
+ """Reset the model"""
168
+ self.model = self.model.reset()
169
+
170
+ def invoke_query(self,query: str,file_path: str = None,get_content_only: bool = True,images: list = None,pydantic_model = None) -> str:
166
171
  """
167
172
  Invoke the model
168
173
  Args:
169
174
  query (str): Query to send to the model
175
+ file_path (str): Path to text file to load. Default is None
170
176
  get_content_only (bool): Whether to return only content
171
177
  images (list): List of images to send to the model
172
178
  pydantic_model: Pydantic model for structured output
173
179
  Returns:
174
180
  str: Response from the model
175
181
  """
176
-
182
+ if file_path:
183
+ loader = TextLoader(file_path)
184
+ document = loader.load()
185
+ query = document.content
186
+
177
187
  if pydantic_model is not None:
178
- try:
179
- self.model = self.model.with_structured_output(pydantic_model)
180
- except Exception as e:
181
- raise ValueError(f"Error with pydantic_model: {e}")
188
+ if hasattr(self.model, 'with_structured_output'):
189
+ try:
190
+ self.model = self.model.with_structured_output(pydantic_model)
191
+ except Exception as e:
192
+ raise ValueError(f"Error with pydantic_model: {e}")
182
193
  if images:
183
194
  res = self._model_invoke_images(images=images,prompt=query,pydantic_model=pydantic_model)
184
195
  else:
mb_rag/version.py CHANGED
@@ -1,5 +1,5 @@
1
1
  MAJOR_VERSION = 1
2
2
  MINOR_VERSION = 1
3
- PATCH_VERSION = 7
3
+ PATCH_VERSION = 9
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.2
2
2
  Name: mb_rag
3
- Version: 1.1.7
3
+ Version: 1.1.9
4
4
  Summary: RAG function file
5
5
  Author: ['Malav Bateriwala']
6
6
  Requires-Python: >=3.8
@@ -1,7 +1,7 @@
1
1
  mb_rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- mb_rag/version.py,sha256=Cpayvd-NH5r-VWXnUrdxc3Wl5e2683dhC75IB5-U87A,206
2
+ mb_rag/version.py,sha256=OJ5C8dPfTjHQppzvBtr3tex8vKiblUMZ8i5wkIS8_U0,206
3
3
  mb_rag/chatbot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- mb_rag/chatbot/basic.py,sha256=2TNPI1gAOGvhw1jgjGhy4M972tHVwNTs_cZR65PO8HM,14996
4
+ mb_rag/chatbot/basic.py,sha256=19spb9hBOhO4UYUZ3q6bzBOHnCrq6sqPFS0EhGPIugw,15448
5
5
  mb_rag/chatbot/chains.py,sha256=vDbLX5R29sWN1pcFqJ5fyxJEgMCM81JAikunAEvMC9A,7223
6
6
  mb_rag/chatbot/prompts.py,sha256=n1PyiLbU-5fkslRv6aVOzt0dDlwya_cEdQ7kRnRhMuY,1749
7
7
  mb_rag/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -9,7 +9,7 @@ mb_rag/rag/embeddings.py,sha256=KjBdekFDb5M3dRMco4r3dDMXMsG5dxdzKImuVIipsd0,2709
9
9
  mb_rag/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  mb_rag/utils/bounding_box.py,sha256=G0hdDam8QmYtD9lfwMeDHGm-TTo6KZg-yK5ESFL9zaM,8366
11
11
  mb_rag/utils/extra.py,sha256=spbFrGgdruNyYQ5PzgvpSIa6Nm0rn9bb4qc8W9g582o,2492
12
- mb_rag-1.1.7.dist-info/METADATA,sha256=q-CMqSDz0STKKK-EftC6W-HsjqO3kBgDhdW5F2mwo6s,233
13
- mb_rag-1.1.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
- mb_rag-1.1.7.dist-info/top_level.txt,sha256=FIK1eAa5uYnurgXZquBG-s3PIy-HDTC5yJBW4lTH_pM,7
15
- mb_rag-1.1.7.dist-info/RECORD,,
12
+ mb_rag-1.1.9.dist-info/METADATA,sha256=XPqRcdq60lulFNTaphL63ke0xn8pAEUhwf_OBStADT4,233
13
+ mb_rag-1.1.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ mb_rag-1.1.9.dist-info/top_level.txt,sha256=FIK1eAa5uYnurgXZquBG-s3PIy-HDTC5yJBW4lTH_pM,7
15
+ mb_rag-1.1.9.dist-info/RECORD,,
File without changes