mb-rag 1.1.8__py3-none-any.whl → 1.1.10__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
@@ -65,7 +66,9 @@ class ModelFactory:
65
66
  'anthropic': self.create_anthropic,
66
67
  'google': self.create_google,
67
68
  'ollama': self.create_ollama,
68
- 'groq': self.create_groq
69
+ 'groq': self.create_groq,
70
+ 'deepseek': self.create_deepseek,
71
+ 'qwen' : self.create_qwen,
69
72
  }
70
73
 
71
74
  model_data = creators.get(model_type)
@@ -162,23 +165,67 @@ class ModelFactory:
162
165
  kwargs["model"] = model_name
163
166
  return ChatGroq(**kwargs)
164
167
 
165
- def invoke_query(self,query: str,get_content_only: bool = True,images: list = None,pydantic_model = None) -> str:
168
+ @classmethod
169
+ def create_deepseek(cls, model_name: str = "deepseek-chat", **kwargs) -> Any:
170
+ """
171
+ Create Deepseek chatbot model
172
+ Args:
173
+ model_name (str): Name of the model
174
+ **kwargs: Additional arguments
175
+ Returns:
176
+ ChatDeepseek: Chatbot model
177
+ """
178
+ if not check_package("langchain_deepseek"):
179
+ raise ImportError("Langchain Deepseek package not found. Please install it using: pip install langchain-deepseek")
180
+
181
+ from langchain_deepseek import ChatDeepSeek
182
+ kwargs["model"] = model_name
183
+ return ChatDeepSeek(**kwargs)
184
+
185
+ @classmethod
186
+ def create_qwen(cls, model_name: str = "qwen", **kwargs) -> Any:
187
+ """
188
+ Create Qwen chatbot model
189
+ Args:
190
+ model_name (str): Name of the model
191
+ **kwargs: Additional arguments
192
+ Returns:
193
+ ChatQwen: Chatbot model
194
+ """
195
+ if not check_package("langchain_community"):
196
+ raise ImportError("Langchain Qwen package not found. Please install it using: pip install langchain_community")
197
+
198
+ from langchain_community.chat_models.tongyi import ChatTongyi
199
+ kwargs["model"] = model_name
200
+ return ChatTongyi(streaming=True,**kwargs)
201
+
202
+ def _reset_model(self):
203
+ """Reset the model"""
204
+ self.model = self.model.reset()
205
+
206
+ def invoke_query(self,query: str,file_path: str = None,get_content_only: bool = True,images: list = None,pydantic_model = None) -> str:
166
207
  """
167
208
  Invoke the model
168
209
  Args:
169
210
  query (str): Query to send to the model
211
+ file_path (str): Path to text file to load. Default is None
170
212
  get_content_only (bool): Whether to return only content
171
213
  images (list): List of images to send to the model
172
214
  pydantic_model: Pydantic model for structured output
173
215
  Returns:
174
216
  str: Response from the model
175
217
  """
176
-
218
+ if file_path:
219
+ loader = TextLoader(file_path)
220
+ document = loader.load()
221
+ query = document.content
222
+
177
223
  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}")
224
+ if hasattr(self.model, 'with_structured_output'):
225
+ try:
226
+ self.model = self.model.with_structured_output(pydantic_model)
227
+ except Exception as e:
228
+ raise ValueError(f"Error with pydantic_model: {e}")
182
229
  if images:
183
230
  res = self._model_invoke_images(images=images,prompt=query,pydantic_model=pydantic_model)
184
231
  else:
mb_rag/version.py CHANGED
@@ -1,5 +1,5 @@
1
1
  MAJOR_VERSION = 1
2
2
  MINOR_VERSION = 1
3
- PATCH_VERSION = 8
3
+ PATCH_VERSION = 10
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.8
3
+ Version: 1.1.10
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=KVSx7GHamT2Lhevius5IvrISRnIQAUyfTN8AIHPdB3s,206
2
+ mb_rag/version.py,sha256=xBDDlvCAF-wcYw_LU24Q5In5Tf5HJhO5hhybChnGc4A,207
3
3
  mb_rag/chatbot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- mb_rag/chatbot/basic.py,sha256=3hMqYy_qx13sV6QMjA2xPGhQarKg8CWyA0euuBUtPYM,14996
4
+ mb_rag/chatbot/basic.py,sha256=X7vj8qWxFUsdXfdr75J4sEenYX8NqF6G2hZXy0Lyvyo,16809
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.8.dist-info/METADATA,sha256=0Q9q-lnStphaaMM9Qqrkm5qIT2ptg2gdsXTmwcw2eG8,233
13
- mb_rag-1.1.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
- mb_rag-1.1.8.dist-info/top_level.txt,sha256=FIK1eAa5uYnurgXZquBG-s3PIy-HDTC5yJBW4lTH_pM,7
15
- mb_rag-1.1.8.dist-info/RECORD,,
12
+ mb_rag-1.1.10.dist-info/METADATA,sha256=oJvCNSnaP8QR0n0mpo8YOvBro3OIM9ZCPcdw7Am4Y4Q,234
13
+ mb_rag-1.1.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ mb_rag-1.1.10.dist-info/top_level.txt,sha256=FIK1eAa5uYnurgXZquBG-s3PIy-HDTC5yJBW4lTH_pM,7
15
+ mb_rag-1.1.10.dist-info/RECORD,,