mmar-mapi 1.0.7__tar.gz → 1.0.9__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 mmar-mapi might be problematic. Click here for more details.
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/PKG-INFO +1 -1
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/pyproject.toml +1 -1
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/models/chat.py +10 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/models/widget.py +10 -2
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/LICENSE +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/README.md +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/__init__.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/api.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/file_storage.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/models/__init__.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/models/base.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/models/chat_item.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/models/enums.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/models/tracks.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/type_union.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/utils.py +0 -0
- {mmar_mapi-1.0.7 → mmar_mapi-1.0.9}/src/mmar_mapi/xml_parser.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mmar-mapi"
|
|
3
3
|
# dynamic version is not supported yet on uv_build
|
|
4
|
-
version = "1.0.
|
|
4
|
+
version = "1.0.9"
|
|
5
5
|
description = "Common pure/IO utilities for multi-modal architectures team"
|
|
6
6
|
authors = [{name = "Eugene Tagin", email = "tagin@airi.net"}]
|
|
7
7
|
license = "MIT"
|
|
@@ -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
|
-
|
|
33
|
-
res
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|