agi-med-common 4.2.12__py3-none-any.whl → 4.2.15__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 +2 -4
- agi_med_common/models/__init__.py +1 -2
- agi_med_common/models/chat_item.py +4 -3
- agi_med_common/models/enums.py +0 -3
- agi_med_common/utils.py +7 -5
- {agi_med_common-4.2.12.dist-info → agi_med_common-4.2.15.dist-info}/METADATA +1 -1
- {agi_med_common-4.2.12.dist-info → agi_med_common-4.2.15.dist-info}/RECORD +9 -9
- {agi_med_common-4.2.12.dist-info → agi_med_common-4.2.15.dist-info}/WHEEL +0 -0
- {agi_med_common-4.2.12.dist-info → agi_med_common-4.2.15.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
__version__ = "4.2.
|
1
|
+
__version__ = "4.2.15"
|
2
2
|
|
3
3
|
from .logger import LogLevelEnum, logger_init, log_llm_error
|
4
4
|
from .models import (
|
5
|
-
StateEnum,
|
6
5
|
MTRSLabelEnum,
|
7
|
-
ActionEnum,
|
8
6
|
ModerationLabelEnum,
|
9
7
|
ChatItem,
|
10
8
|
InnerContextItem,
|
@@ -15,7 +13,7 @@ from .models import (
|
|
15
13
|
from .models.widget import Widget
|
16
14
|
from .file_storage import FileStorage, ResourceId
|
17
15
|
from .models import DiagnosticsXMLTagEnum, MTRSXMLTagEnum, DoctorChoiceXMLTagEnum
|
18
|
-
from .utils import make_session_id, read_json, try_parse_json, try_parse_int, pretty_line
|
16
|
+
from .utils import make_session_id, read_json, try_parse_json, try_parse_int, try_parse_float, pretty_line
|
19
17
|
from .validators import ExistingPath, ExistingFile, ExistingDir, StrNotEmpty, SecretStrNotEmpty, Prompt, Message
|
20
18
|
from .xml_parser import XMLParser
|
21
19
|
from .parallel_map import parallel_map
|
@@ -1,7 +1,6 @@
|
|
1
1
|
from ._base import _Base
|
2
2
|
|
3
|
-
from .enums import
|
4
|
-
from .enums import DiagnosticsXMLTagEnum, MTRSXMLTagEnum, DoctorChoiceXMLTagEnum
|
3
|
+
from .enums import MTRSLabelEnum, ModerationLabelEnum, DiagnosticsXMLTagEnum, MTRSXMLTagEnum, DoctorChoiceXMLTagEnum
|
5
4
|
|
6
5
|
from .chat_item import ChatItem, OuterContextItem, InnerContextItem, ReplicaItem, ReplicaItemPair
|
7
6
|
from .base_config_models import GigaChatConfig
|
@@ -4,7 +4,7 @@ from typing import Any
|
|
4
4
|
from pydantic import Field, ConfigDict
|
5
5
|
from agi_med_common.models.widget import Widget
|
6
6
|
|
7
|
-
from .enums import ModerationLabelEnum
|
7
|
+
from .enums import ModerationLabelEnum
|
8
8
|
from ._base import _Base
|
9
9
|
|
10
10
|
|
@@ -34,6 +34,7 @@ class OuterContextItem(_Base):
|
|
34
34
|
client_id: str = Field("", alias="ClientId", examples=["543216789"])
|
35
35
|
track_id: str = Field(default="Consultation", alias="TrackId")
|
36
36
|
entrypoint_key: str = Field("", alias="EntrypointKey", examples=["giga"])
|
37
|
+
language_code: str = Field("ru", alias="LanguageCode", examples=["ru"])
|
37
38
|
|
38
39
|
def create_id(self, short: bool = False, clean: bool = False) -> str:
|
39
40
|
uid, sid, cid = self.user_id, self.session_id, self.client_id
|
@@ -59,8 +60,8 @@ class ReplicaItem(_Base):
|
|
59
60
|
examples=[_EXAMPLE_DATETIME],
|
60
61
|
description=f"Format: {_DATETIME_FORMAT}",
|
61
62
|
)
|
62
|
-
state:
|
63
|
-
action:
|
63
|
+
state: str = Field("EMPTY", alias="State", description="chat manager fsm state", examples=["COLLECTION"])
|
64
|
+
action: str = Field("START", alias="Action", description="chat manager fsm action", examples=["DIAGNOSIS"])
|
64
65
|
moderation: ModerationLabelEnum = Field(
|
65
66
|
ModerationLabelEnum.OK,
|
66
67
|
alias="Moderation",
|
agi_med_common/models/enums.py
CHANGED
agi_med_common/utils.py
CHANGED
@@ -15,11 +15,14 @@ def read_json(path: Path | os.PathLike[str] | str) -> list | dict:
|
|
15
15
|
|
16
16
|
|
17
17
|
def try_parse_json(text: str | None) -> str | None:
|
18
|
+
# taken from agi_med_common
|
19
|
+
if not isinstance(text, str):
|
20
|
+
return None
|
18
21
|
if not text:
|
19
22
|
return None
|
20
|
-
if not
|
23
|
+
if text[0] not in "{[":
|
21
24
|
return None
|
22
|
-
if not
|
25
|
+
if text[-1] not in "}]":
|
23
26
|
return None
|
24
27
|
try:
|
25
28
|
return json.loads(text)
|
@@ -33,13 +36,12 @@ def try_parse_int(text: str) -> int | None:
|
|
33
36
|
except ValueError:
|
34
37
|
return None
|
35
38
|
|
36
|
-
|
37
39
|
def pretty_line(text: str, cut_count: int = 100) -> str:
|
38
40
|
if len(text) > 100:
|
39
41
|
text_cut = text[:cut_count]
|
40
42
|
size = len(text)
|
41
|
-
text_pretty = f
|
43
|
+
text_pretty = f"{text_cut}..(total {size} characters)"
|
42
44
|
else:
|
43
45
|
text_pretty = text
|
44
|
-
text_pretty = text_pretty.replace(
|
46
|
+
text_pretty = text_pretty.replace("\n", "\\n")
|
45
47
|
return text_pretty
|
@@ -1,20 +1,20 @@
|
|
1
|
-
agi_med_common/__init__.py,sha256=
|
1
|
+
agi_med_common/__init__.py,sha256=1MDnHkF-GzakV5vMzftoMrTB5zuOUmdDlu2Zy0g9gsY,708
|
2
2
|
agi_med_common/file_storage.py,sha256=yAP65qT0NbkaasFLhwnNzXOpd5vAetF3wP6Sbf_tbak,1766
|
3
3
|
agi_med_common/parallel_map.py,sha256=Qx6xe7DqlEUDpSucp5Hm8r9y9Iquwh9JvX7lOqHhnOw,921
|
4
|
-
agi_med_common/utils.py,sha256=
|
4
|
+
agi_med_common/utils.py,sha256=4juaxXWRBD8sqJ8mCHeP8O-T9d79ixjNvBEdrgPtLrw,1122
|
5
5
|
agi_med_common/validators.py,sha256=vMoPN42XzC8re-zdjekk5_lNQYHuTiAWD56YLvj2Z2w,2824
|
6
6
|
agi_med_common/xml_parser.py,sha256=VvLIX_XCZao9i0qqpTVx8nx0vbFXSe8pEbdJdXnj97g,568
|
7
7
|
agi_med_common/logger/__init__.py,sha256=RW_0VZtbeJ4RsLqUXZUQWl5CtV9g840rU7qRlf5u49E,96
|
8
8
|
agi_med_common/logger/log_level_enum.py,sha256=lWuSMho9I0v_xf1RuwpERx5o8NJXaavjwxSdh8fxMqE,477
|
9
9
|
agi_med_common/logger/logger.py,sha256=-VU69ULbw2-pNpOcxKiMpOeRAPe6H-EsGV9WRTv1SUo,839
|
10
|
-
agi_med_common/models/__init__.py,sha256=
|
10
|
+
agi_med_common/models/__init__.py,sha256=Kek8n74nuozGZRL-brljKpYyXb1uWFEDu5ufrzrDq5o,289
|
11
11
|
agi_med_common/models/_base.py,sha256=qNdH8x3x3mYbo5XgWtR9VpEarxsEvXvzynadUlDvHmU,149
|
12
|
-
agi_med_common/models/chat_item.py,sha256=
|
13
|
-
agi_med_common/models/enums.py,sha256=
|
12
|
+
agi_med_common/models/chat_item.py,sha256=gvJlRI-EIBMqsA7Cu_dBgjqsc4-aD80G-ONQ6PsyDJE,4416
|
13
|
+
agi_med_common/models/enums.py,sha256=zv8BwaloRMp6TFEzdGsdcxnz97a4jKZ9zOSzWdG2QcY,1278
|
14
14
|
agi_med_common/models/widget.py,sha256=g7Bobyk_gANghGEhjDjvi4i-YRoHo5Bm1Pr4eF-zf0U,661
|
15
15
|
agi_med_common/models/base_config_models/__init__.py,sha256=KjS_bSCka8BOMsigwcIML-e6eNB2ouMU6gxlhRmzeuY,44
|
16
16
|
agi_med_common/models/base_config_models/gigachat_config.py,sha256=WNSCTO8Fjpxc1v2LRUHfKqo9aeMDpXltTHYBFgTD2N0,422
|
17
|
-
agi_med_common-4.2.
|
18
|
-
agi_med_common-4.2.
|
19
|
-
agi_med_common-4.2.
|
20
|
-
agi_med_common-4.2.
|
17
|
+
agi_med_common-4.2.15.dist-info/METADATA,sha256=XmdlGA3cfIpF3ovXIkKnoP0dc_9prF5mg1YC6YlB0Bw,547
|
18
|
+
agi_med_common-4.2.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
19
|
+
agi_med_common-4.2.15.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
20
|
+
agi_med_common-4.2.15.dist-info/RECORD,,
|
File without changes
|
File without changes
|