mb-rag 1.1.28__py3-none-any.whl → 1.1.29__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
@@ -316,21 +316,26 @@ class ModelFactory:
316
316
  str: Output from the model
317
317
  """
318
318
  base64_images = [self._image_to_base64(image) for image in images]
319
- image_prompt_create = [{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{base64_images[i]}"}} for i in range(len(images))]
320
- prompt_new = [{"type": "text", "text": prompt},
321
- *image_prompt_create,]
322
- if pydantic_model is not None:
323
- try:
324
- self.model = self.model.with_structured_output(pydantic_model)
325
- except Exception as e:
326
- print(f"Error with pydantic_model: {e}")
327
- print("Continuing without structured output")
328
- message= HumanMessage(content=prompt_new,)
329
- response = self.model.invoke([message])
330
- try:
319
+ if self.model_name=='ollama':
320
+ ollama_model = self.model.bind(images=[base64_images])
321
+ response = ollama_model.invoke([HumanMessage(content=prompt)])
331
322
  return response.content
332
- except Exception:
333
- return response
323
+ else:
324
+ image_prompt_create = [{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{base64_images[i]}"}} for i in range(len(images))]
325
+ prompt_new = [{"type": "text", "text": prompt},
326
+ *image_prompt_create,]
327
+ if pydantic_model is not None:
328
+ try:
329
+ self.model = self.model.with_structured_output(pydantic_model)
330
+ except Exception as e:
331
+ print(f"Error with pydantic_model: {e}")
332
+ print("Continuing without structured output")
333
+ message= HumanMessage(content=prompt_new,)
334
+ response = self.model.invoke([message])
335
+ try:
336
+ return response.content
337
+ except Exception:
338
+ return response
334
339
 
335
340
  class ConversationModel:
336
341
  """
mb_rag/version.py CHANGED
@@ -1,5 +1,5 @@
1
1
  MAJOR_VERSION = 1
2
2
  MINOR_VERSION = 1
3
- PATCH_VERSION = 28
3
+ PATCH_VERSION = 29
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.28
3
+ Version: 1.1.29
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=Jjd2mCudGZRz7bRa7R4U_JjRiyIfx48EnBIOJCCQwhM,207
2
+ mb_rag/version.py,sha256=ITnbW1vqO-j5BPqKB80kAPQo-teqS8UgeKu0ZGjsi3Q,207
3
3
  mb_rag/chatbot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- mb_rag/chatbot/basic.py,sha256=_-ZYE_xMX__H9gGGFI96oQ0R-nwhikGDFcFa91CIS4w,23103
4
+ mb_rag/chatbot/basic.py,sha256=Jj5c46lZHAHftpVoT3cr_xHtJ6auJB_vqJ6IgAXLbos,23393
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
@@ -11,7 +11,7 @@ mb_rag/utils/bounding_box.py,sha256=G0hdDam8QmYtD9lfwMeDHGm-TTo6KZg-yK5ESFL9zaM,
11
11
  mb_rag/utils/document_extract.py,sha256=vZiFB1RYm1BIEaNA0MveJ5Zp-KEi0ngKjW8xEdtPqXA,12558
12
12
  mb_rag/utils/extra.py,sha256=spbFrGgdruNyYQ5PzgvpSIa6Nm0rn9bb4qc8W9g582o,2492
13
13
  mb_rag/utils/pdf_extract.py,sha256=cVeMyhnAU4XZxjIZHKMYhrktTjUNOjhx2r_LZKReOZE,15598
14
- mb_rag-1.1.28.dist-info/METADATA,sha256=SrvA8RRcIxPKtwB19iQjO4-m8XuqKpmDkTT0u8p1Tu4,234
15
- mb_rag-1.1.28.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
16
- mb_rag-1.1.28.dist-info/top_level.txt,sha256=FIK1eAa5uYnurgXZquBG-s3PIy-HDTC5yJBW4lTH_pM,7
17
- mb_rag-1.1.28.dist-info/RECORD,,
14
+ mb_rag-1.1.29.dist-info/METADATA,sha256=vWy1_OLmVPaiAbeZtm1QRN-UAUyc_Hw13vcxjnz5FSs,234
15
+ mb_rag-1.1.29.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
16
+ mb_rag-1.1.29.dist-info/top_level.txt,sha256=FIK1eAa5uYnurgXZquBG-s3PIy-HDTC5yJBW4lTH_pM,7
17
+ mb_rag-1.1.29.dist-info/RECORD,,