agi-med-common 5.2.0__py3-none-any.whl → 5.2.2__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/api.py +6 -8
- agi_med_common/models/chat.py +7 -6
- agi_med_common/models/chat_item.py +4 -3
- agi_med_common/models/widget.py +3 -3
- agi_med_common/parallel_map.py +3 -1
- agi_med_common/utils.py +1 -1
- {agi_med_common-5.2.0.dist-info → agi_med_common-5.2.2.dist-info}/METADATA +1 -1
- {agi_med_common-5.2.0.dist-info → agi_med_common-5.2.2.dist-info}/RECORD +11 -11
- {agi_med_common-5.2.0.dist-info → agi_med_common-5.2.2.dist-info}/WHEEL +0 -0
- {agi_med_common-5.2.0.dist-info → agi_med_common-5.2.2.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
agi_med_common/api.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List, Tuple
|
2
|
-
|
3
1
|
from agi_med_common.models.chat import Chat, ChatMessage
|
4
2
|
from agi_med_common.models.tracks import DomainInfo, TrackInfo
|
5
3
|
from pydantic import BaseModel
|
@@ -11,13 +9,13 @@ ResourceId = str
|
|
11
9
|
|
12
10
|
|
13
11
|
class ChatManagerAPI:
|
14
|
-
def get_domains(self, *, client_id: str, language_code: str = "ru") ->
|
12
|
+
def get_domains(self, *, client_id: str, language_code: str = "ru") -> list[DomainInfo]:
|
15
13
|
raise NotImplementedError
|
16
14
|
|
17
|
-
def get_tracks(self, *, client_id: str, language_code: str = "ru") ->
|
15
|
+
def get_tracks(self, *, client_id: str, language_code: str = "ru") -> list[TrackInfo]:
|
18
16
|
raise NotImplementedError
|
19
17
|
|
20
|
-
def get_response(self, *, chat: Chat) ->
|
18
|
+
def get_response(self, *, chat: Chat) -> list[ChatMessage]:
|
21
19
|
raise NotImplementedError
|
22
20
|
|
23
21
|
|
@@ -40,7 +38,7 @@ class ContentInterpreterRemoteAPI:
|
|
40
38
|
|
41
39
|
|
42
40
|
class ClassifierAPI:
|
43
|
-
def get_values(self) ->
|
41
|
+
def get_values(self) -> list[Value]:
|
44
42
|
raise NotImplementedError
|
45
43
|
|
46
44
|
def evaluate(self, *, chat: Chat) -> Value:
|
@@ -55,10 +53,10 @@ class CriticAPI:
|
|
55
53
|
class ContentInterpreterAPI:
|
56
54
|
def interpret(
|
57
55
|
self, *, kind: str, query: str, resource_id: str = "", chat: Chat | None = None
|
58
|
-
) ->
|
56
|
+
) -> tuple[Interpretation, ResourceId | None]:
|
59
57
|
raise NotImplementedError
|
60
58
|
|
61
59
|
|
62
60
|
class TextProcessorAPI:
|
63
|
-
def process(self, text: str, chat: Chat | None = None) -> str:
|
61
|
+
def process(self, *, text: str, chat: Chat | None = None) -> str:
|
64
62
|
raise NotImplementedError
|
agi_med_common/models/chat.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import warnings
|
2
2
|
from copy import deepcopy
|
3
3
|
from datetime import datetime
|
4
|
-
from typing import Any,
|
4
|
+
from typing import Any, Literal, TypeVar
|
5
|
+
from collections.abc import Callable
|
5
6
|
|
6
7
|
from agi_med_common.models.chat_item import ChatItem, ReplicaItem, OuterContextItem
|
7
8
|
from agi_med_common.models.widget import Widget
|
@@ -14,9 +15,9 @@ from .base import Base
|
|
14
15
|
|
15
16
|
_DT_FORMAT: str = "%Y-%m-%d-%H-%M-%S"
|
16
17
|
_EXAMPLE_DT: str = datetime(year=1970, month=1, day=1).strftime(_DT_FORMAT)
|
17
|
-
StrDict =
|
18
|
+
StrDict = dict[str, Any]
|
18
19
|
ContentBase = str | Widget | StrDict
|
19
|
-
Content = ContentBase |
|
20
|
+
Content = ContentBase | list[ContentBase]
|
20
21
|
T = TypeVar("T")
|
21
22
|
|
22
23
|
|
@@ -184,7 +185,7 @@ ChatMessage = TypeUnion[HumanMessage, AIMessage, MiscMessage]
|
|
184
185
|
|
185
186
|
class Chat(Base):
|
186
187
|
context: Context = Field(default_factory=Context)
|
187
|
-
messages:
|
188
|
+
messages: list[ChatMessage] = Field(default_factory=list)
|
188
189
|
|
189
190
|
class Config:
|
190
191
|
extra = Extra.ignore
|
@@ -208,11 +209,11 @@ class Chat(Base):
|
|
208
209
|
def add_message(self, message: ChatMessage):
|
209
210
|
self.messages.append(message)
|
210
211
|
|
211
|
-
def add_messages(self, messages:
|
212
|
+
def add_messages(self, messages: list[ChatMessage]):
|
212
213
|
for message in messages:
|
213
214
|
self.messages.append(message)
|
214
215
|
|
215
|
-
def replace_messages(self, messages:
|
216
|
+
def replace_messages(self, messages: list[ChatMessage]):
|
216
217
|
return self.model_copy(update=dict(messages=messages))
|
217
218
|
|
218
219
|
def get_last_state(self, default: str = "empty") -> str:
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from datetime import datetime
|
2
|
-
from typing import Annotated, Any
|
2
|
+
from typing import Annotated, Any
|
3
|
+
from collections.abc import Callable
|
3
4
|
|
4
5
|
from agi_med_common.models.widget import Widget
|
5
6
|
from pydantic import Field, ConfigDict, BeforeValidator, AfterValidator
|
@@ -126,11 +127,11 @@ class ChatItem(Base):
|
|
126
127
|
def add_replica(self, replica: ReplicaItem):
|
127
128
|
self.inner_context.replicas.append(replica)
|
128
129
|
|
129
|
-
def add_replicas(self, replicas:
|
130
|
+
def add_replicas(self, replicas: list[ReplicaItem]):
|
130
131
|
for replica in replicas:
|
131
132
|
self.inner_context.replicas.append(replica)
|
132
133
|
|
133
|
-
def replace_replicas(self, replicas:
|
134
|
+
def replace_replicas(self, replicas: list[ReplicaItem]):
|
134
135
|
return self.model_copy(update=dict(inner_context=InnerContextItem(replicas=replicas)))
|
135
136
|
|
136
137
|
def get_last_state(self, default: str = "empty") -> str:
|
agi_med_common/models/widget.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Self, Literal
|
2
2
|
|
3
3
|
from pydantic import BaseModel, model_validator
|
4
4
|
|
5
5
|
|
6
6
|
class Widget(BaseModel):
|
7
7
|
type: Literal["widget"] = "widget"
|
8
|
-
buttons:
|
9
|
-
ibuttons:
|
8
|
+
buttons: list[list[str]] | None = None
|
9
|
+
ibuttons: list[list[str]] | None = None
|
10
10
|
|
11
11
|
@model_validator(mode="after")
|
12
12
|
def check(self) -> Self:
|
agi_med_common/parallel_map.py
CHANGED
agi_med_common/utils.py
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
agi_med_common/__init__.py,sha256=
|
2
|
-
agi_med_common/api.py,sha256=
|
1
|
+
agi_med_common/__init__.py,sha256=RTzZYi5dcgt97c2nh9CYdAhXoaH4kb8MQc6HMCzh_L4,828
|
2
|
+
agi_med_common/api.py,sha256=83Ew5SvcypjvAWQ6c1kAcnvHsPxZ8BeBHnVHXLkUJvU,1687
|
3
3
|
agi_med_common/file_storage.py,sha256=lEh9TyzUu8dS9WkaEcshSUxESXQ1i7PAyXqejdambpg,1802
|
4
|
-
agi_med_common/parallel_map.py,sha256=
|
4
|
+
agi_med_common/parallel_map.py,sha256=O6pxgPlHT9OVqqgry1yHy_0bV0U2AwvGJ42iG2e834U,1091
|
5
5
|
agi_med_common/type_union.py,sha256=diwmzcnbqkpGFckPHNw9o8zyQ955mOGNvhTlcBJ0RMI,1905
|
6
|
-
agi_med_common/utils.py,sha256=
|
6
|
+
agi_med_common/utils.py,sha256=9nV01aSqUcudWmDI_Jzvb_8e0LJM3WJ6vsf9Vcv8DB0,1569
|
7
7
|
agi_med_common/validators.py,sha256=vMoPN42XzC8re-zdjekk5_lNQYHuTiAWD56YLvj2Z2w,2824
|
8
8
|
agi_med_common/xml_parser.py,sha256=VvLIX_XCZao9i0qqpTVx8nx0vbFXSe8pEbdJdXnj97g,568
|
9
9
|
agi_med_common/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
agi_med_common/models/base.py,sha256=mKtXV2x51XVj7W-et9tjGcPMDUUUMelW-BywMgFc2p0,411
|
11
|
-
agi_med_common/models/chat.py,sha256=
|
12
|
-
agi_med_common/models/chat_item.py,sha256=
|
11
|
+
agi_med_common/models/chat.py,sha256=1ednqUNnJVRxJ4CWhaACETSazTNkj-rQo3tt3Jc1MB0,12342
|
12
|
+
agi_med_common/models/chat_item.py,sha256=9Z4cfDSc2SQ2OTShOYdnNe4JEJMtdAY8bFCPT1eAyZY,5562
|
13
13
|
agi_med_common/models/enums.py,sha256=J-GNpql9MCnKnWiV9aJRQGI-pAybvV86923RZs99grA,1006
|
14
14
|
agi_med_common/models/tracks.py,sha256=HKDp-BX1p7AlDfSEKfOKCu0TRSK9cD4Dmq1vJt8oRjw,307
|
15
|
-
agi_med_common/models/widget.py,sha256=
|
15
|
+
agi_med_common/models/widget.py,sha256=KXSP3d4yQNeificMfzRxROdByw9IkxwCjkDD0kc7tcQ,704
|
16
16
|
agi_med_common/models/base_config_models/__init__.py,sha256=KjS_bSCka8BOMsigwcIML-e6eNB2ouMU6gxlhRmzeuY,44
|
17
17
|
agi_med_common/models/base_config_models/gigachat_config.py,sha256=QvKTnp0VioXzd3_PUgNBeYx5RDTZT-45j-Ll-wXEI_o,421
|
18
|
-
agi_med_common-5.2.
|
19
|
-
agi_med_common-5.2.
|
20
|
-
agi_med_common-5.2.
|
21
|
-
agi_med_common-5.2.
|
18
|
+
agi_med_common-5.2.2.dist-info/METADATA,sha256=9Kk0ayatnwaQEei0hq5sJE7mmiUnl7aEJA5FWBnPzk0,517
|
19
|
+
agi_med_common-5.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
20
|
+
agi_med_common-5.2.2.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
21
|
+
agi_med_common-5.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|