mmar-mapi 1.0.7__py3-none-any.whl → 1.0.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 mmar-mapi might be problematic. Click here for more details.

mmar_mapi/models/chat.py CHANGED
@@ -242,6 +242,16 @@ class Chat(Base):
242
242
  def rfind_in_messages(self, func: Callable[[ChatMessage], T | None]) -> T | None:
243
243
  return find_in_messages(self.messages[::-1], func)
244
244
 
245
+ def get_last_user_message(self) -> HumanMessage | None:
246
+ messages = self.messages
247
+ if not messages:
248
+ return []
249
+ message = messages[-1]
250
+ return message if isinstance(message, HumanMessage) else None
251
+
252
+ def count_messages(self, func: Callable[[ChatMessage], bool]) -> int:
253
+ return sum(map(func, self.messages))
254
+
245
255
 
246
256
  def make_content(
247
257
  text: str | None = None,
@@ -26,9 +26,17 @@ class Widget(BaseModel):
26
26
  def make_inline_buttons(ibuttons: dict[str, str], by=1) -> "Widget":
27
27
  return _make_inline_buttons(ibuttons=ibuttons, by=by)
28
28
 
29
+ @staticmethod
30
+ def make_buttons(buttons: list[str], by=1) -> "Widget":
31
+ return _make_buttons(buttons=buttons, by=1)
32
+
29
33
 
30
34
  def _make_inline_buttons(ibuttons: dict[str, str], by=1) -> "Widget":
31
35
  ibs0 = [f"{key}:{val}" for key, val in ibuttons.items()]
32
- ibs = list(chunked(ibs0, n=by))
33
- res = Widget(ibuttons=ibs)
36
+ res = Widget(ibuttons=list(chunked(ibs0, n=by)))
37
+ return res
38
+
39
+
40
+ def _make_buttons(buttons: list[str], by=1) -> "Widget":
41
+ res = Widget(buttons=list(chunked(buttons, n=by)))
34
42
  return res
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mmar-mapi
3
- Version: 1.0.7
3
+ Version: 1.0.9
4
4
  Summary: Common pure/IO utilities for multi-modal architectures team
5
5
  Keywords:
6
6
  Author: Eugene Tagin
@@ -3,15 +3,15 @@ mmar_mapi/api.py,sha256=C9Sr8dISvf51xfEznPjccI_odaG4coQE3HI_0jVpjMQ,1677
3
3
  mmar_mapi/file_storage.py,sha256=GbahBabBdAKjlAnv1MszERUxxZyA9HGMiR9tz2a9dgY,4409
4
4
  mmar_mapi/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  mmar_mapi/models/base.py,sha256=mKtXV2x51XVj7W-et9tjGcPMDUUUMelW-BywMgFc2p0,411
6
- mmar_mapi/models/chat.py,sha256=IsIYoHY3Taxnfn-Audeml-WLGIbJgKr_-Arg-ZA8FIE,13293
6
+ mmar_mapi/models/chat.py,sha256=HC-zl32wu5xMyam3iZXZKc4vSfxtc4f-vMb9FgB8m1Q,13655
7
7
  mmar_mapi/models/chat_item.py,sha256=ZfCKvTqr7gpuJSAuHVxWRnlTefRwki_IVNA2N_CXGdg,5557
8
8
  mmar_mapi/models/enums.py,sha256=J-GNpql9MCnKnWiV9aJRQGI-pAybvV86923RZs99grA,1006
9
9
  mmar_mapi/models/tracks.py,sha256=HKDp-BX1p7AlDfSEKfOKCu0TRSK9cD4Dmq1vJt8oRjw,307
10
- mmar_mapi/models/widget.py,sha256=pQHiOukNLzsrz5lr5ptMeARPxSzJhJnijA0rVpVSIhk,1108
10
+ mmar_mapi/models/widget.py,sha256=ObQlY24nJ1buQ501eFoVFSHe5HcvnuQd_x2hrDevDpo,1354
11
11
  mmar_mapi/type_union.py,sha256=diwmzcnbqkpGFckPHNw9o8zyQ955mOGNvhTlcBJ0RMI,1905
12
12
  mmar_mapi/utils.py,sha256=hcKJVslvTBLw2vjZ9zcKZxh_tqk48obHcVs_i3Rxn3M,112
13
13
  mmar_mapi/xml_parser.py,sha256=VvLIX_XCZao9i0qqpTVx8nx0vbFXSe8pEbdJdXnj97g,568
14
- mmar_mapi-1.0.7.dist-info/licenses/LICENSE,sha256=2A90w8WjhOgQXnFuUijKJYazaqZ4_NTokYb9Po4y-9k,1061
15
- mmar_mapi-1.0.7.dist-info/WHEEL,sha256=Pi5uDq5Fdo_Rr-HD5h9BiPn9Et29Y9Sh8NhcJNnFU1c,79
16
- mmar_mapi-1.0.7.dist-info/METADATA,sha256=GnTR9S4PdQJak3j-3tIJ61xrA7bU1AjubCe-vRWkL3I,914
17
- mmar_mapi-1.0.7.dist-info/RECORD,,
14
+ mmar_mapi-1.0.9.dist-info/licenses/LICENSE,sha256=2A90w8WjhOgQXnFuUijKJYazaqZ4_NTokYb9Po4y-9k,1061
15
+ mmar_mapi-1.0.9.dist-info/WHEEL,sha256=Pi5uDq5Fdo_Rr-HD5h9BiPn9Et29Y9Sh8NhcJNnFU1c,79
16
+ mmar_mapi-1.0.9.dist-info/METADATA,sha256=adosbshlLDyXhtjup8WuoJC1AgxHrCMKy5BQXixOwMs,914
17
+ mmar_mapi-1.0.9.dist-info/RECORD,,