agi-med-common 5.0.6__py3-none-any.whl → 5.0.8__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 +12 -5
- {agi_med_common-5.0.6.dist-info → agi_med_common-5.0.8.dist-info}/METADATA +1 -1
- {agi_med_common-5.0.6.dist-info → agi_med_common-5.0.8.dist-info}/RECORD +6 -6
- {agi_med_common-5.0.6.dist-info → agi_med_common-5.0.8.dist-info}/WHEEL +0 -0
- {agi_med_common-5.0.6.dist-info → agi_med_common-5.0.8.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
@@ -102,19 +102,26 @@ class ChatItem(_Base):
|
|
102
102
|
|
103
103
|
|
104
104
|
def _is_moderation_int_error(err):
|
105
|
-
|
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
|
-
|
110
|
-
|
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:
|
115
122
|
return ChatItem.model_validate_json(chat_text)
|
116
123
|
except ValidationError as ex:
|
117
|
-
if
|
124
|
+
if _is_moderation_int_errors(ex):
|
118
125
|
logger.warning("Failed to parse ChatItem, fallback to old version with `Moderation:int`")
|
119
126
|
else:
|
120
127
|
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=xnl1hYNI7Qc6wxXOUEw1lhcJTLSz5wEqCxqxPM-oh1g,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=vBafx01lk946SWu3ugflsUt29b77tw_zRM1bSFA94w4,5033
|
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.8.dist-info/METADATA,sha256=0qxppVD85EYCi6qlayy98aXKmA4DYWLQo5BDeSfxct4,546
|
20
|
+
agi_med_common-5.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
21
|
+
agi_med_common-5.0.8.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
22
|
+
agi_med_common-5.0.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|