agi-med-common 5.0.7__py3-none-any.whl → 5.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.
@@ -1,4 +1,4 @@
1
- __version__ = "5.0.7"
1
+ __version__ = "5.0.9"
2
2
 
3
3
  from .logger import LogLevelEnum, logger_init, log_llm_error
4
4
  from .models import (
@@ -17,3 +17,5 @@ from .xml_parser import XMLParser
17
17
  from .parallel_map import parallel_map
18
18
  from .models.tracks import TrackInfo, DomainInfo
19
19
  from .api.chat_manager_api import ChatManagerAPI
20
+ from .api.content_interpreter_api import ContentInterpreterRequest, ContentInterpreterResponse, ContentInterpreterAPI
21
+ from .api.content_interpreter_remote_api import ContentInterpreterRemoteRequest, ContentInterpreterRemoteResponse, ContentInterpreterRemoteAPI
@@ -0,0 +1,19 @@
1
+ from agi_med_common.models import ChatItem
2
+ from pydantic import BaseModel
3
+
4
+
5
+ class ContentInterpreterRequest(BaseModel):
6
+ kind: str
7
+ query: str
8
+ resource_id: str
9
+ chat: ChatItem | None = None
10
+
11
+
12
+ class ContentInterpreterResponse(BaseModel):
13
+ interpretation: str
14
+ resource_id: str
15
+
16
+
17
+ class ContentInterpreterAPI:
18
+ def interpret(self, request: ContentInterpreterRequest) -> ContentInterpreterResponse:
19
+ raise NotImplementedError
@@ -0,0 +1,21 @@
1
+ from agi_med_common.models import ChatItem
2
+ from pydantic import BaseModel
3
+
4
+
5
+ class ContentInterpreterRemoteRequest(BaseModel):
6
+ kind: str
7
+ query: str
8
+ resource_fname: str
9
+ resource: bytes
10
+ chat: ChatItem | None = None
11
+
12
+
13
+ class ContentInterpreterRemoteResponse(BaseModel):
14
+ interpretation: str
15
+ resource_fname: str
16
+ resource: bytes
17
+
18
+
19
+ class ContentInterpreterRemoteAPI:
20
+ def interpret_remote(self, request: ContentInterpreterRemoteRequest) -> ContentInterpreterRemoteResponse:
21
+ raise NotImplementedError
@@ -102,13 +102,20 @@ class ChatItem(_Base):
102
102
 
103
103
 
104
104
  def _is_moderation_int_error(err):
105
- return err['type'] == 'string_type' and err['loc'] == ('InnerContext', 'Replicas', 0, 'Moderation') and err['msg'] == 'Input should be a valid string'
105
+ # fmt: off
106
+ if err['type'] != 'string_type': return False
107
+ if err['loc'][0] != 'InnerContext': return False
108
+ if err['loc'][1] != 'Replicas': return False
109
+ if err['loc'][3] != 'Moderation': return False
110
+ if err['msg'] != 'Input should be a valid string': return False
111
+ # fmt: on
112
+ return True
113
+
106
114
 
107
115
  def _is_moderation_int_errors(ex):
108
116
  errs = ex.errors()
109
- if len(errs) != 1:
110
- return False
111
- return all(map(_is_moderation_int_errors, errs))
117
+ return all(map(_is_moderation_int_error, errs))
118
+
112
119
 
113
120
  def _parse_chat(chat_text: str) -> ChatItem:
114
121
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agi_med_common
3
- Version: 5.0.7
3
+ Version: 5.0.9
4
4
  Summary: Сommon for agi-med team
5
5
  Author: AGI-MED-TEAM
6
6
  Requires-Python: >=3.11
@@ -1,22 +1,24 @@
1
- agi_med_common/__init__.py,sha256=-o-054eRs1ygOgr24lN-dDDNJLWYQWeatshezu1RfKI,759
1
+ agi_med_common/__init__.py,sha256=ew-53A0rQ4hJLrduWvJ9sa9k3Yg2CIIddu7SLWJ0Im8,1020
2
2
  agi_med_common/file_storage.py,sha256=T0Hbs4W-pWO6HdWcmlVqABrQHYdq7lLZH4_Vu-YNVbw,1802
3
3
  agi_med_common/parallel_map.py,sha256=Qx6xe7DqlEUDpSucp5Hm8r9y9Iquwh9JvX7lOqHhnOw,921
4
4
  agi_med_common/utils.py,sha256=rBNAECUrvvyf-UZ650IpTfHvx5I8lYSnsB8QPBKti48,1276
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/api/chat_manager_api.py,sha256=e-LJSmnWCFW1Wj5R3uavlKaq9p5VBoErqP_Tif2Qo-4,483
8
+ agi_med_common/api/content_interpreter_api.py,sha256=U6J-AO7NiaqSaKPeSwrcPVlRyAWd71yQ6gxFDLpHPjs,451
9
+ agi_med_common/api/content_interpreter_remote_api.py,sha256=fl_Z3TLGh_fNtDKdng2pIQtjAkYrI_8TdA7FejKcHlY,534
8
10
  agi_med_common/logger/__init__.py,sha256=RW_0VZtbeJ4RsLqUXZUQWl5CtV9g840rU7qRlf5u49E,96
9
11
  agi_med_common/logger/log_level_enum.py,sha256=lWuSMho9I0v_xf1RuwpERx5o8NJXaavjwxSdh8fxMqE,477
10
12
  agi_med_common/logger/logger.py,sha256=-VU69ULbw2-pNpOcxKiMpOeRAPe6H-EsGV9WRTv1SUo,839
11
13
  agi_med_common/models/__init__.py,sha256=UbZmFKH94-AsvLUeg2y2odJ6WMjumI0grOJWOWL-aVg,292
12
14
  agi_med_common/models/_base.py,sha256=qNdH8x3x3mYbo5XgWtR9VpEarxsEvXvzynadUlDvHmU,149
13
- agi_med_common/models/chat_item.py,sha256=KZHQWT3y8AjZ44YydFKKBADG0w61YRCpSYhgjKUUUZ0,4915
15
+ agi_med_common/models/chat_item.py,sha256=vBafx01lk946SWu3ugflsUt29b77tw_zRM1bSFA94w4,5033
14
16
  agi_med_common/models/enums.py,sha256=J-GNpql9MCnKnWiV9aJRQGI-pAybvV86923RZs99grA,1006
15
17
  agi_med_common/models/tracks.py,sha256=UP-jeWqDiCK6dyoMDfs7hemgl_xsJKee_DApjBf-XYc,311
16
18
  agi_med_common/models/widget.py,sha256=g7Bobyk_gANghGEhjDjvi4i-YRoHo5Bm1Pr4eF-zf0U,661
17
19
  agi_med_common/models/base_config_models/__init__.py,sha256=KjS_bSCka8BOMsigwcIML-e6eNB2ouMU6gxlhRmzeuY,44
18
20
  agi_med_common/models/base_config_models/gigachat_config.py,sha256=WNSCTO8Fjpxc1v2LRUHfKqo9aeMDpXltTHYBFgTD2N0,422
19
- agi_med_common-5.0.7.dist-info/METADATA,sha256=fkXwfFHsbYezNF5IL8EL7d_yMCEtqupJlifgWZuJcx4,546
20
- agi_med_common-5.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- agi_med_common-5.0.7.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
22
- agi_med_common-5.0.7.dist-info/RECORD,,
21
+ agi_med_common-5.0.9.dist-info/METADATA,sha256=nvBQFXXvqTb026uHrY3mG9upNwEhrfL-v7Lj3BZBHMo,546
22
+ agi_med_common-5.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ agi_med_common-5.0.9.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
24
+ agi_med_common-5.0.9.dist-info/RECORD,,