agi-med-common 3.5.4__tar.gz → 3.5.6__tar.gz
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-3.5.4 → agi_med_common-3.5.6}/PKG-INFO +1 -1
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/__init__.py +2 -2
- agi_med_common-3.5.6/src/agi_med_common/file_storage.py +39 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/chat_item/replica_item.py +2 -1
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/track_id_enum.py +1 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/utils.py +0 -4
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common.egg-info/PKG-INFO +1 -1
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common.egg-info/SOURCES.txt +1 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/README.md +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/pyproject.toml +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/requirements.txt +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/setup.cfg +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/logger/__init__.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/logger/log_level_enum.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/logger/logger.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/__init__.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/_base.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/base_config_models/__init__.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/base_config_models/gigachat_config.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/chat_item/__init__.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/chat_item/chat_item.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/chat_item/inner_context_item.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/chat_item/outer_context_item.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/__init__.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/action_enum.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/diagnostics_xml_tag_enum.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/doctor_choice_xml_tag_enum.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/moderation_label_enum.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/mtrs_label_enum.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/mtrs_xml_tag_enum.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/state_enum.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/validators.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/xml_parser.py +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common.egg-info/dependency_links.txt +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common.egg-info/requires.txt +0 -0
- {agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common.egg-info/top_level.txt +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "3.5.
|
1
|
+
__version__ = "3.5.6"
|
2
2
|
|
3
3
|
from .logger import LogLevelEnum, logger_init
|
4
4
|
from .models import (
|
@@ -16,6 +16,6 @@ from .models import (
|
|
16
16
|
|
17
17
|
from .models import DiagnosticsXMLTagEnum, MTRSXMLTagEnum, DoctorChoiceXMLTagEnum
|
18
18
|
|
19
|
-
from .utils import make_session_id, read_json
|
19
|
+
from .utils import make_session_id, read_json
|
20
20
|
from .validators import is_file_exist, validate_prompt
|
21
21
|
from .xml_parser import XMLParser
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import string
|
2
|
+
from hashlib import md5
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
ResourceId = str
|
6
|
+
ASCII_DIGITS = set(string.ascii_lowercase + string.digits)
|
7
|
+
|
8
|
+
|
9
|
+
def _validate_exist(files_dir):
|
10
|
+
if not files_dir.exists():
|
11
|
+
err = f"Failed to access file-storage directory: {files_dir}"
|
12
|
+
raise OSError(err)
|
13
|
+
|
14
|
+
|
15
|
+
def _validate_dtype(dtype: str):
|
16
|
+
if all(map(ASCII_DIGITS.__contains__, dtype)):
|
17
|
+
return
|
18
|
+
raise ValueError(f'Bad dtype: {dtype}')
|
19
|
+
|
20
|
+
|
21
|
+
class FileStorage:
|
22
|
+
def __init__(self, files_dir):
|
23
|
+
self.files_dir = Path(files_dir)
|
24
|
+
self.files_dir.mkdir(exist_ok=True)
|
25
|
+
_validate_exist(self.files_dir)
|
26
|
+
|
27
|
+
def upload(self, content: bytes, dtype: str) -> ResourceId | None:
|
28
|
+
_validate_dtype(dtype)
|
29
|
+
fname_hash = md5(content).hexdigest()
|
30
|
+
fname = f'{fname_hash}.{dtype}'
|
31
|
+
fpath = self.files_dir / fname
|
32
|
+
fpath.write_bytes(content)
|
33
|
+
return str(fpath)
|
34
|
+
|
35
|
+
def download(self, rid: ResourceId) -> bytes:
|
36
|
+
return Path(rid).read_bytes()
|
37
|
+
|
38
|
+
def is_valid(self, rid: ResourceId) -> bytes:
|
39
|
+
return Path(rid).exists() and Path(rid).is_file()
|
{agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/chat_item/replica_item.py
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
from datetime import datetime
|
2
|
-
from typing import Any
|
2
|
+
from typing import Any, Optional
|
3
3
|
|
4
4
|
from pydantic import Field
|
5
5
|
|
@@ -12,6 +12,7 @@ _EXAMPLE_DATETIME: str = datetime(1970, 1, 1, 0, 0, 0).strftime(_DATETIME_FORMAT
|
|
12
12
|
|
13
13
|
class ReplicaItem(_Base):
|
14
14
|
body: str = Field("", alias="Body", examples=["Привет"])
|
15
|
+
resource_id: Optional[str] = Field(None, alias="ResourceId", examples=["<link-id>"])
|
15
16
|
role: bool = Field(False, alias="Role", description="True = ai, False = client", examples=[False])
|
16
17
|
date_time: str = Field(
|
17
18
|
_EXAMPLE_DATETIME,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/chat_item/__init__.py
RENAMED
File without changes
|
{agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/chat_item/chat_item.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/action_enum.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/mtrs_label_enum.py
RENAMED
File without changes
|
{agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common/models/enums/mtrs_xml_tag_enum.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{agi_med_common-3.5.4 → agi_med_common-3.5.6}/src/agi_med_common.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|