agi-med-common 4.2.5__py3-none-any.whl → 4.2.7__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.
- agi_med_common/__init__.py +3 -3
- agi_med_common/models/__init__.py +1 -1
- agi_med_common/models/chat_item/outer_context_item.py +1 -2
- agi_med_common/models/chat_item/replica_item.py +9 -2
- agi_med_common/models/enums.py +58 -0
- agi_med_common/models/widget.py +20 -0
- {agi_med_common-4.2.5.dist-info → agi_med_common-4.2.7.dist-info}/METADATA +1 -1
- agi_med_common-4.2.7.dist-info/RECORD +24 -0
- agi_med_common/models/enums/__init__.py +0 -9
- agi_med_common/models/enums/diagnostics_xml_tag_enum.py +0 -11
- agi_med_common/models/enums/doctor_choice_xml_tag_enum.py +0 -11
- agi_med_common/models/enums/moderation_label_enum.py +0 -14
- agi_med_common/models/enums/mtrs_label_enum.py +0 -10
- agi_med_common/models/enums/mtrs_xml_tag_enum.py +0 -11
- agi_med_common/models/enums/track_id_enum.py +0 -18
- agi_med_common-4.2.5.dist-info/RECORD +0 -29
- {agi_med_common-4.2.5.dist-info → agi_med_common-4.2.7.dist-info}/WHEEL +0 -0
- {agi_med_common-4.2.5.dist-info → agi_med_common-4.2.7.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
__version__ = "4.2.
|
1
|
+
__version__ = "4.2.7"
|
2
2
|
|
3
|
-
from .logger import LogLevelEnum, logger_init
|
3
|
+
from .logger import LogLevelEnum, logger_init, log_llm_error
|
4
4
|
from .models import (
|
5
|
-
TrackIdEnum,
|
6
5
|
StateEnum,
|
7
6
|
MTRSLabelEnum,
|
8
7
|
ActionEnum,
|
@@ -13,6 +12,7 @@ from .models import (
|
|
13
12
|
ReplicaItem,
|
14
13
|
ReplicaItemPair,
|
15
14
|
)
|
15
|
+
from .models.widget import Widget
|
16
16
|
from .file_storage import FileStorage
|
17
17
|
from .models import DiagnosticsXMLTagEnum, MTRSXMLTagEnum, DoctorChoiceXMLTagEnum
|
18
18
|
from .utils import make_session_id, read_json
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from ._base import _Base
|
2
2
|
|
3
|
-
from .enums import
|
3
|
+
from .enums import StateEnum, MTRSLabelEnum, ActionEnum, ModerationLabelEnum
|
4
4
|
from .enums import DiagnosticsXMLTagEnum, MTRSXMLTagEnum, DoctorChoiceXMLTagEnum
|
5
5
|
|
6
6
|
from .chat_item import ChatItem, OuterContextItem, InnerContextItem, ReplicaItem, ReplicaItemPair
|
@@ -2,7 +2,6 @@ from pydantic import Field, ConfigDict
|
|
2
2
|
from typing import Any
|
3
3
|
|
4
4
|
from .. import _Base
|
5
|
-
from ..enums import TrackIdEnum
|
6
5
|
|
7
6
|
|
8
7
|
class OuterContextItem(_Base):
|
@@ -14,7 +13,7 @@ class OuterContextItem(_Base):
|
|
14
13
|
user_id: str = Field("", alias="UserId", examples=["123456789"])
|
15
14
|
session_id: str = Field("", alias="SessionId", examples=["987654321"])
|
16
15
|
client_id: str = Field("", alias="ClientId", examples=["543216789"])
|
17
|
-
track_id:
|
16
|
+
track_id: str = Field(default="Consultation", alias="TrackId")
|
18
17
|
entrypoint_key: str = Field("", alias="EntrypointKey", examples=["giga"])
|
19
18
|
|
20
19
|
def create_id(self, short: bool = False, clean: bool = False) -> str:
|
@@ -1,10 +1,11 @@
|
|
1
1
|
from datetime import datetime
|
2
|
-
from typing import Any
|
2
|
+
from typing import Any
|
3
3
|
|
4
4
|
from pydantic import Field, ConfigDict
|
5
5
|
|
6
6
|
from .. import _Base
|
7
7
|
from ..enums import StateEnum, ActionEnum, ModerationLabelEnum
|
8
|
+
from agi_med_common.models.widget import Widget
|
8
9
|
|
9
10
|
|
10
11
|
_DATETIME_FORMAT: str = "%Y-%m-%d-%H-%M-%S"
|
@@ -13,7 +14,9 @@ _EXAMPLE_DATETIME: str = datetime(1970, 1, 1, 0, 0, 0).strftime(_DATETIME_FORMAT
|
|
13
14
|
|
14
15
|
class ReplicaItem(_Base):
|
15
16
|
body: str = Field("", alias="Body", examples=["Привет"])
|
16
|
-
resource_id:
|
17
|
+
resource_id: str | None = Field(None, alias="ResourceId", examples=["<link-id>"])
|
18
|
+
widget: Widget | None = Field(None, alias="Widget", examples=[None])
|
19
|
+
command: str | None = Field(None, alias="Command", examples=[None])
|
17
20
|
role: bool = Field(False, alias="Role", description="True = ai, False = client", examples=[False])
|
18
21
|
date_time: str = Field(
|
19
22
|
_EXAMPLE_DATETIME,
|
@@ -37,6 +40,10 @@ class ReplicaItem(_Base):
|
|
37
40
|
def DATETIME_FORMAT() -> str:
|
38
41
|
return _DATETIME_FORMAT
|
39
42
|
|
43
|
+
def with_now_datetime(self):
|
44
|
+
dt = datetime.now().strftime(ReplicaItem.DATETIME_FORMAT())
|
45
|
+
return self.model_copy(update=dict(date_time=dt))
|
46
|
+
|
40
47
|
|
41
48
|
class ReplicaItemPair(_Base):
|
42
49
|
# remove annoying warning for protected `model_` namespace
|
@@ -0,0 +1,58 @@
|
|
1
|
+
from enum import IntEnum, StrEnum, auto
|
2
|
+
|
3
|
+
|
4
|
+
StateEnum, ActionEnum = str, str
|
5
|
+
|
6
|
+
|
7
|
+
class ModerationLabelEnum(IntEnum):
|
8
|
+
@staticmethod
|
9
|
+
def _generate_next_value_(name, start, count, last_values):
|
10
|
+
return count
|
11
|
+
|
12
|
+
OK = auto()
|
13
|
+
NON_MED = auto()
|
14
|
+
CHILD = auto()
|
15
|
+
ABSURD = auto()
|
16
|
+
GREETING = auto()
|
17
|
+
RECEIPT = auto()
|
18
|
+
|
19
|
+
|
20
|
+
class DoctorChoiceXMLTagEnum(StrEnum):
|
21
|
+
@staticmethod
|
22
|
+
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str:
|
23
|
+
return f"{name.lower()}"
|
24
|
+
|
25
|
+
DIAGNOSTICS = auto()
|
26
|
+
SUMMARIZATION = auto()
|
27
|
+
MTRS = auto()
|
28
|
+
|
29
|
+
|
30
|
+
class MTRSXMLTagEnum(StrEnum):
|
31
|
+
@staticmethod
|
32
|
+
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str:
|
33
|
+
return f"mtrs_{name.lower()}"
|
34
|
+
|
35
|
+
NAME = auto()
|
36
|
+
LABEL = auto()
|
37
|
+
DESC = auto()
|
38
|
+
|
39
|
+
|
40
|
+
class MTRSLabelEnum(StrEnum):
|
41
|
+
@staticmethod
|
42
|
+
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str:
|
43
|
+
return name.upper()
|
44
|
+
|
45
|
+
LABORATORY = auto()
|
46
|
+
INSTRUMENTAL = auto()
|
47
|
+
|
48
|
+
|
49
|
+
class DiagnosticsXMLTagEnum(StrEnum):
|
50
|
+
@staticmethod
|
51
|
+
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str:
|
52
|
+
return f"diag_{name.lower()}"
|
53
|
+
|
54
|
+
DIAG = auto()
|
55
|
+
DOC = auto()
|
56
|
+
DESC = auto()
|
57
|
+
|
58
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
from typing import List, Self
|
2
|
+
from pydantic import BaseModel, model_validator
|
3
|
+
|
4
|
+
|
5
|
+
class Widget(BaseModel):
|
6
|
+
buttons: List[List[str]] | None = None
|
7
|
+
ibuttons: List[List[str]] | None = None
|
8
|
+
|
9
|
+
@model_validator(mode="after")
|
10
|
+
def check(self) -> Self:
|
11
|
+
if not self.buttons and not self.ibuttons:
|
12
|
+
raise ValueError("Empty widget is not allowed!")
|
13
|
+
if not self.ibuttons:
|
14
|
+
return self
|
15
|
+
for row in self.ibuttons:
|
16
|
+
for btn in row:
|
17
|
+
if ":" in btn:
|
18
|
+
continue
|
19
|
+
raise ValueError(f"Expected buttons like `<callback>:<caption>`, found: {btn}")
|
20
|
+
return self
|
@@ -0,0 +1,24 @@
|
|
1
|
+
agi_med_common/__init__.py,sha256=wsPa9X4l6Jimx2Vc2Js_FHGqHPeyQtqBPf1sA1A3wLg,665
|
2
|
+
agi_med_common/file_storage.py,sha256=4GW0CU0YtVzWmxV6vGjZg0DfyEgjlrgLRsZ7cEP-6Qk,1659
|
3
|
+
agi_med_common/parallel_map.py,sha256=Qx6xe7DqlEUDpSucp5Hm8r9y9Iquwh9JvX7lOqHhnOw,921
|
4
|
+
agi_med_common/utils.py,sha256=5iurKl5d1zZ_cN4yqtc0_FhrwuNBcDurbWilu28_saE,325
|
5
|
+
agi_med_common/validators.py,sha256=vMoPN42XzC8re-zdjekk5_lNQYHuTiAWD56YLvj2Z2w,2824
|
6
|
+
agi_med_common/xml_parser.py,sha256=VvLIX_XCZao9i0qqpTVx8nx0vbFXSe8pEbdJdXnj97g,568
|
7
|
+
agi_med_common/logger/__init__.py,sha256=RW_0VZtbeJ4RsLqUXZUQWl5CtV9g840rU7qRlf5u49E,96
|
8
|
+
agi_med_common/logger/log_level_enum.py,sha256=lWuSMho9I0v_xf1RuwpERx5o8NJXaavjwxSdh8fxMqE,477
|
9
|
+
agi_med_common/logger/logger.py,sha256=-VU69ULbw2-pNpOcxKiMpOeRAPe6H-EsGV9WRTv1SUo,839
|
10
|
+
agi_med_common/models/__init__.py,sha256=KXnXxD2c5v2TVXrc-n7gJipTAyvtMasbocxThINIojs,330
|
11
|
+
agi_med_common/models/_base.py,sha256=qNdH8x3x3mYbo5XgWtR9VpEarxsEvXvzynadUlDvHmU,149
|
12
|
+
agi_med_common/models/enums.py,sha256=RxPPbkW1NcHAGO-gHuzwIvOjv0_ZBsr9b1aq_wk4WFM,1313
|
13
|
+
agi_med_common/models/widget.py,sha256=g7Bobyk_gANghGEhjDjvi4i-YRoHo5Bm1Pr4eF-zf0U,661
|
14
|
+
agi_med_common/models/base_config_models/__init__.py,sha256=KjS_bSCka8BOMsigwcIML-e6eNB2ouMU6gxlhRmzeuY,44
|
15
|
+
agi_med_common/models/base_config_models/gigachat_config.py,sha256=WNSCTO8Fjpxc1v2LRUHfKqo9aeMDpXltTHYBFgTD2N0,422
|
16
|
+
agi_med_common/models/chat_item/__init__.py,sha256=NG1optUYwjnxfpTXntUfTDOA0eKTgdV43TZOcfHasHg,185
|
17
|
+
agi_med_common/models/chat_item/chat_item.py,sha256=xP_uP14qK-u8z0ZUs2HFhhea-IP230UgOmjeqeC_N6Q,1180
|
18
|
+
agi_med_common/models/chat_item/inner_context_item.py,sha256=2wIwDtZwicwhSyXeuOqH8-xONcskeEiw6QhjSnEEwZs,329
|
19
|
+
agi_med_common/models/chat_item/outer_context_item.py,sha256=P2ulGbKnEXBJ50Ou-_p_qKCdO1lB4SUvdSu1ZG1yRdo,1213
|
20
|
+
agi_med_common/models/chat_item/replica_item.py,sha256=5WsOCmZ8LUGEbLoWHdv4lLmqHqtqtV4D4GhghIuErcM,2012
|
21
|
+
agi_med_common-4.2.7.dist-info/METADATA,sha256=AaaAs9_m19XXpXA-slS7aP0vN2D4MlYdoRef1CL8_Z0,546
|
22
|
+
agi_med_common-4.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
agi_med_common-4.2.7.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
24
|
+
agi_med_common-4.2.7.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
from .track_id_enum import TrackIdEnum
|
2
|
-
from .mtrs_label_enum import MTRSLabelEnum
|
3
|
-
from .moderation_label_enum import ModerationLabelEnum
|
4
|
-
|
5
|
-
from .diagnostics_xml_tag_enum import DiagnosticsXMLTagEnum
|
6
|
-
from .mtrs_xml_tag_enum import MTRSXMLTagEnum
|
7
|
-
from .doctor_choice_xml_tag_enum import DoctorChoiceXMLTagEnum
|
8
|
-
|
9
|
-
StateEnum, ActionEnum = str, str
|
@@ -1,11 +0,0 @@
|
|
1
|
-
from enum import StrEnum, auto
|
2
|
-
|
3
|
-
|
4
|
-
class DiagnosticsXMLTagEnum(StrEnum):
|
5
|
-
@staticmethod
|
6
|
-
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str:
|
7
|
-
return f"diag_{name.lower()}"
|
8
|
-
|
9
|
-
DIAG = auto()
|
10
|
-
DOC = auto()
|
11
|
-
DESC = auto()
|
@@ -1,11 +0,0 @@
|
|
1
|
-
from enum import StrEnum, auto
|
2
|
-
|
3
|
-
|
4
|
-
class DoctorChoiceXMLTagEnum(StrEnum):
|
5
|
-
@staticmethod
|
6
|
-
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str:
|
7
|
-
return f"{name.lower()}"
|
8
|
-
|
9
|
-
DIAGNOSTICS = auto()
|
10
|
-
SUMMARIZATION = auto()
|
11
|
-
MTRS = auto()
|
@@ -1,14 +0,0 @@
|
|
1
|
-
from enum import IntEnum, auto
|
2
|
-
|
3
|
-
|
4
|
-
class ModerationLabelEnum(IntEnum):
|
5
|
-
@staticmethod
|
6
|
-
def _generate_next_value_(name, start, count, last_values):
|
7
|
-
return count
|
8
|
-
|
9
|
-
OK = auto()
|
10
|
-
NON_MED = auto()
|
11
|
-
CHILD = auto()
|
12
|
-
ABSURD = auto()
|
13
|
-
GREETING = auto()
|
14
|
-
RECEIPT = auto()
|
@@ -1,11 +0,0 @@
|
|
1
|
-
from enum import StrEnum, auto
|
2
|
-
|
3
|
-
|
4
|
-
class MTRSXMLTagEnum(StrEnum):
|
5
|
-
@staticmethod
|
6
|
-
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str:
|
7
|
-
return f"mtrs_{name.lower()}"
|
8
|
-
|
9
|
-
NAME = auto()
|
10
|
-
LABEL = auto()
|
11
|
-
DESC = auto()
|
@@ -1,18 +0,0 @@
|
|
1
|
-
from enum import StrEnum, auto
|
2
|
-
|
3
|
-
|
4
|
-
class TrackIdEnum(StrEnum):
|
5
|
-
@staticmethod
|
6
|
-
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str:
|
7
|
-
return "".join([word.title() for word in name.lower().split("_")])
|
8
|
-
|
9
|
-
DIAGNOSTIC = auto()
|
10
|
-
DIAGNOSTIC_SBERHEALTH = auto()
|
11
|
-
SECOND_OPINION = auto()
|
12
|
-
MEDICAL_TEST_DECRYPTION = auto()
|
13
|
-
CONSULTATION = auto()
|
14
|
-
DUMMY = auto()
|
15
|
-
COMMON_CONSULTATION = auto()
|
16
|
-
FINANCIER = auto()
|
17
|
-
FINANCIER_GENERIC = auto()
|
18
|
-
MULTIMODAL = auto()
|
@@ -1,29 +0,0 @@
|
|
1
|
-
agi_med_common/__init__.py,sha256=qpgKQvUWXCmAnbgdBIYqL-6NQcq25foavdorFLSzq6w,633
|
2
|
-
agi_med_common/file_storage.py,sha256=4GW0CU0YtVzWmxV6vGjZg0DfyEgjlrgLRsZ7cEP-6Qk,1659
|
3
|
-
agi_med_common/parallel_map.py,sha256=Qx6xe7DqlEUDpSucp5Hm8r9y9Iquwh9JvX7lOqHhnOw,921
|
4
|
-
agi_med_common/utils.py,sha256=5iurKl5d1zZ_cN4yqtc0_FhrwuNBcDurbWilu28_saE,325
|
5
|
-
agi_med_common/validators.py,sha256=vMoPN42XzC8re-zdjekk5_lNQYHuTiAWD56YLvj2Z2w,2824
|
6
|
-
agi_med_common/xml_parser.py,sha256=VvLIX_XCZao9i0qqpTVx8nx0vbFXSe8pEbdJdXnj97g,568
|
7
|
-
agi_med_common/logger/__init__.py,sha256=RW_0VZtbeJ4RsLqUXZUQWl5CtV9g840rU7qRlf5u49E,96
|
8
|
-
agi_med_common/logger/log_level_enum.py,sha256=lWuSMho9I0v_xf1RuwpERx5o8NJXaavjwxSdh8fxMqE,477
|
9
|
-
agi_med_common/logger/logger.py,sha256=-VU69ULbw2-pNpOcxKiMpOeRAPe6H-EsGV9WRTv1SUo,839
|
10
|
-
agi_med_common/models/__init__.py,sha256=D1-GV32Ap2qBzmJZC7RzkdJ3duqRMjzcZ4oUzbCZ66g,343
|
11
|
-
agi_med_common/models/_base.py,sha256=qNdH8x3x3mYbo5XgWtR9VpEarxsEvXvzynadUlDvHmU,149
|
12
|
-
agi_med_common/models/base_config_models/__init__.py,sha256=KjS_bSCka8BOMsigwcIML-e6eNB2ouMU6gxlhRmzeuY,44
|
13
|
-
agi_med_common/models/base_config_models/gigachat_config.py,sha256=WNSCTO8Fjpxc1v2LRUHfKqo9aeMDpXltTHYBFgTD2N0,422
|
14
|
-
agi_med_common/models/chat_item/__init__.py,sha256=NG1optUYwjnxfpTXntUfTDOA0eKTgdV43TZOcfHasHg,185
|
15
|
-
agi_med_common/models/chat_item/chat_item.py,sha256=xP_uP14qK-u8z0ZUs2HFhhea-IP230UgOmjeqeC_N6Q,1180
|
16
|
-
agi_med_common/models/chat_item/inner_context_item.py,sha256=2wIwDtZwicwhSyXeuOqH8-xONcskeEiw6QhjSnEEwZs,329
|
17
|
-
agi_med_common/models/chat_item/outer_context_item.py,sha256=hSv-JMPlgLzH7kQzgjrDNZWSnm18TWHODziQixsqoIo,1269
|
18
|
-
agi_med_common/models/chat_item/replica_item.py,sha256=D1goRTINLa1rUcQcwHOWUSiv_OR1UW0GVn5_TqK3dyk,1672
|
19
|
-
agi_med_common/models/enums/__init__.py,sha256=NFgy8J-bET2GQqUyTaKYLzaLaM-jDR8-7TBTadWKm5o,341
|
20
|
-
agi_med_common/models/enums/diagnostics_xml_tag_enum.py,sha256=aiUJpe5joh5EOcJ5sk1Xs003XkRry2CBL6H-bIEiapA,278
|
21
|
-
agi_med_common/models/enums/doctor_choice_xml_tag_enum.py,sha256=MsSFI0vFHJVujhoj7fNX-fcGVV3jMF_nEDOJnjzh4ac,291
|
22
|
-
agi_med_common/models/enums/moderation_label_enum.py,sha256=lbGG4Pu7cQp57uEyQEptNeYsQszK6yyxJ5AEhq4SGkE,292
|
23
|
-
agi_med_common/models/enums/mtrs_label_enum.py,sha256=6emBndt3SCsQVZZFKQYCV2_iyjjmZEhwejJKJu39ZAw,257
|
24
|
-
agi_med_common/models/enums/mtrs_xml_tag_enum.py,sha256=6OxuRsrx4b2uBjfrBgm4Y789Ly337_mQXL9VPRCpLyg,273
|
25
|
-
agi_med_common/models/enums/track_id_enum.py,sha256=N3KUd97a4xDet_NKZ5URm0qWAAv3ts1l_foOjdlGY4c,532
|
26
|
-
agi_med_common-4.2.5.dist-info/METADATA,sha256=TMhc3NYXrXLxhTV7LxKjpkaY5zkgn-WRpTrn2tVIuhM,546
|
27
|
-
agi_med_common-4.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
28
|
-
agi_med_common-4.2.5.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
29
|
-
agi_med_common-4.2.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|