agi-med-common 5.0.5__py3-none-any.whl → 5.0.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 +1 -1
- agi_med_common/models/chat_item.py +6 -5
- {agi_med_common-5.0.5.dist-info → agi_med_common-5.0.7.dist-info}/METADATA +1 -1
- {agi_med_common-5.0.5.dist-info → agi_med_common-5.0.7.dist-info}/RECORD +6 -6
- {agi_med_common-5.0.5.dist-info → agi_med_common-5.0.7.dist-info}/WHEEL +0 -0
- {agi_med_common-5.0.5.dist-info → agi_med_common-5.0.7.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
@@ -101,19 +101,20 @@ class ChatItem(_Base):
|
|
101
101
|
return _parse_chat(chat_text)
|
102
102
|
|
103
103
|
|
104
|
-
def _is_moderation_int_error(
|
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'
|
106
|
+
|
107
|
+
def _is_moderation_int_errors(ex):
|
105
108
|
errs = ex.errors()
|
106
109
|
if len(errs) != 1:
|
107
110
|
return False
|
108
|
-
|
109
|
-
if err['type'] == 'string_type' and err['loc'] == ('InnerContext', 'Replicas', 0, 'Moderation') and err['msg'] == 'Input should be a valid string':
|
110
|
-
return True
|
111
|
+
return all(map(_is_moderation_int_errors, errs))
|
111
112
|
|
112
113
|
def _parse_chat(chat_text: str) -> ChatItem:
|
113
114
|
try:
|
114
115
|
return ChatItem.model_validate_json(chat_text)
|
115
116
|
except ValidationError as ex:
|
116
|
-
if
|
117
|
+
if _is_moderation_int_errors(ex):
|
117
118
|
logger.warning("Failed to parse ChatItem, fallback to old version with `Moderation:int`")
|
118
119
|
else:
|
119
120
|
logger.error(f"Failed to parse: {ex}")
|
@@ -1,4 +1,4 @@
|
|
1
|
-
agi_med_common/__init__.py,sha256
|
1
|
+
agi_med_common/__init__.py,sha256=-o-054eRs1ygOgr24lN-dDDNJLWYQWeatshezu1RfKI,759
|
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
|
@@ -10,13 +10,13 @@ agi_med_common/logger/log_level_enum.py,sha256=lWuSMho9I0v_xf1RuwpERx5o8NJXaavjw
|
|
10
10
|
agi_med_common/logger/logger.py,sha256=-VU69ULbw2-pNpOcxKiMpOeRAPe6H-EsGV9WRTv1SUo,839
|
11
11
|
agi_med_common/models/__init__.py,sha256=UbZmFKH94-AsvLUeg2y2odJ6WMjumI0grOJWOWL-aVg,292
|
12
12
|
agi_med_common/models/_base.py,sha256=qNdH8x3x3mYbo5XgWtR9VpEarxsEvXvzynadUlDvHmU,149
|
13
|
-
agi_med_common/models/chat_item.py,sha256=
|
13
|
+
agi_med_common/models/chat_item.py,sha256=KZHQWT3y8AjZ44YydFKKBADG0w61YRCpSYhgjKUUUZ0,4915
|
14
14
|
agi_med_common/models/enums.py,sha256=J-GNpql9MCnKnWiV9aJRQGI-pAybvV86923RZs99grA,1006
|
15
15
|
agi_med_common/models/tracks.py,sha256=UP-jeWqDiCK6dyoMDfs7hemgl_xsJKee_DApjBf-XYc,311
|
16
16
|
agi_med_common/models/widget.py,sha256=g7Bobyk_gANghGEhjDjvi4i-YRoHo5Bm1Pr4eF-zf0U,661
|
17
17
|
agi_med_common/models/base_config_models/__init__.py,sha256=KjS_bSCka8BOMsigwcIML-e6eNB2ouMU6gxlhRmzeuY,44
|
18
18
|
agi_med_common/models/base_config_models/gigachat_config.py,sha256=WNSCTO8Fjpxc1v2LRUHfKqo9aeMDpXltTHYBFgTD2N0,422
|
19
|
-
agi_med_common-5.0.
|
20
|
-
agi_med_common-5.0.
|
21
|
-
agi_med_common-5.0.
|
22
|
-
agi_med_common-5.0.
|
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,,
|
File without changes
|
File without changes
|