mmar-mapi 1.0.1__tar.gz → 1.0.3__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mmar-mapi
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Common pure/IO utilities for multi-modal architectures team
5
5
  Keywords:
6
6
  Author: Eugene Tagin
@@ -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.1"
4
+ version = "1.0.3"
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"
@@ -3,9 +3,10 @@ __version__ = "5.2.4"
3
3
  from .file_storage import FileStorage, ResourceId
4
4
  from .models.base import Base
5
5
  from .models.base_config_models import GigaChatConfig
6
- from .models.chat import Chat, Context, ChatMessage, AIMessage, HumanMessage, MiscMessage, make_content
6
+ from .models.chat import Chat, Context, ChatMessage, AIMessage, HumanMessage, MiscMessage, make_content, Content
7
7
  from .models.chat_item import ChatItem, OuterContextItem, InnerContextItem, ReplicaItem
8
8
  from .models.enums import MTRSLabelEnum, DiagnosticsXMLTagEnum, MTRSXMLTagEnum, DoctorChoiceXMLTagEnum
9
9
  from .models.tracks import TrackInfo, DomainInfo
10
10
  from .models.widget import Widget
11
11
  from .utils import make_session_id
12
+ from .xml_parser import XMLParser
@@ -0,0 +1,18 @@
1
+ import re
2
+ from enum import StrEnum
3
+
4
+
5
+ class XMLParser:
6
+ @staticmethod
7
+ def make_xml(body: str, tag: str | StrEnum) -> str:
8
+ return f"<{tag}>{body}</{tag}>"
9
+
10
+ @staticmethod
11
+ def remove_xml(text: str) -> str:
12
+ re_xml = re.compile(r"<(.*?)>")
13
+ return re.sub(re_xml, "", text).replace(" ", " ").strip()
14
+
15
+ @staticmethod
16
+ def get_tag_list(response: str, tag: str | StrEnum) -> list[str]:
17
+ tag_content = re.findall(f"<{tag}>(.*?)</{tag}>", response, re.DOTALL)
18
+ return [content.lower().strip() for content in tag_content]
File without changes
File without changes