diff --git a/libs/core/langchain_core/messages/utils.py b/libs/core/langchain_core/messages/utils.py index f78d877e595..8059280044f 100644 --- a/libs/core/langchain_core/messages/utils.py +++ b/libs/core/langchain_core/messages/utils.py @@ -29,7 +29,7 @@ from typing import ( overload, ) -from pydantic import Discriminator, Field +from pydantic import Discriminator, Field, Tag from typing_extensions import Annotated from langchain_core.messages.ai import AIMessage, AIMessageChunk @@ -49,22 +49,26 @@ if TYPE_CHECKING: from langchain_core.runnables.base import Runnable +def _get_type(v: Any) -> str: + return v.type + + AnyMessage = Annotated[ Union[ - AIMessage, - HumanMessage, - ChatMessage, - SystemMessage, - FunctionMessage, - ToolMessage, - AIMessageChunk, - HumanMessageChunk, - ChatMessageChunk, - SystemMessageChunk, - FunctionMessageChunk, - ToolMessageChunk, + Annotated[AIMessage, Tag(tag="ai")], + Annotated[HumanMessage, Tag(tag="human")], + Annotated[ChatMessage, Tag(tag="chat")], + Annotated[SystemMessage, Tag(tag="system")], + Annotated[FunctionMessage, Tag(tag="function")], + Annotated[ToolMessage, Tag(tag="tool")], + Annotated[AIMessageChunk, Tag(tag="AIMessageChunk")], + Annotated[HumanMessageChunk, Tag(tag="HumanMessageChunk")], + Annotated[ChatMessageChunk, Tag(tag="ChatMessageChunk")], + Annotated[SystemMessageChunk, Tag(tag="SystemMessageChunk")], + Annotated[FunctionMessageChunk, Tag(tag="FunctionMessageChunk")], + Annotated[ToolMessageChunk, Tag(tag="ToolMessageChunk")], ], - Field(discriminator=Discriminator("type")), + Field(discriminator=Discriminator(_get_type)), ] diff --git a/libs/core/poetry.lock b/libs/core/poetry.lock index 40ba83b9c64..c31d1a76e3f 100644 --- a/libs/core/poetry.lock +++ b/libs/core/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "annotated-types" @@ -278,37 +278,6 @@ files = [ {file = "cffi-1.17.1-cp312-cp312-win32.whl", hash = "sha256:a08d7e755f8ed21095a310a693525137cfe756ce62d066e53f502a83dc550f65"}, {file = "cffi-1.17.1-cp312-cp312-win_amd64.whl", hash = "sha256:51392eae71afec0d0c8fb1a53b204dbb3bcabcb3c9b807eedf3e1e6ccf2de903"}, {file = "cffi-1.17.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f3a2b4222ce6b60e2e8b337bb9596923045681d71e5a082783484d845390938e"}, - {file = "cffi-1.17.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0984a4925a435b1da406122d4d7968dd861c1385afe3b45ba82b750f229811e2"}, - {file = "cffi-1.17.1-cp313-cp313-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d01b12eeeb4427d3110de311e1774046ad344f5b1a7403101878976ecd7a10f3"}, - {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:706510fe141c86a69c8ddc029c7910003a17353970cff3b904ff0686a5927683"}, - {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:de55b766c7aa2e2a3092c51e0483d700341182f08e67c63630d5b6f200bb28e5"}, - {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c59d6e989d07460165cc5ad3c61f9fd8f1b4796eacbd81cee78957842b834af4"}, - {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd398dbc6773384a17fe0d3e7eeb8d1a21c2200473ee6806bb5e6a8e62bb73dd"}, - {file = "cffi-1.17.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:3edc8d958eb099c634dace3c7e16560ae474aa3803a5df240542b305d14e14ed"}, - {file = "cffi-1.17.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:72e72408cad3d5419375fc87d289076ee319835bdfa2caad331e377589aebba9"}, - {file = "cffi-1.17.1-cp313-cp313-win32.whl", hash = "sha256:e03eab0a8677fa80d646b5ddece1cbeaf556c313dcfac435ba11f107ba117b5d"}, - {file = "cffi-1.17.1-cp313-cp313-win_amd64.whl", hash = "sha256:f6a16c31041f09ead72d69f583767292f750d24913dadacf5756b966aacb3f1a"}, - {file = "cffi-1.17.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:636062ea65bd0195bc012fea9321aca499c0504409f413dc88af450b57ffd03b"}, - {file = "cffi-1.17.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c7eac2ef9b63c79431bc4b25f1cd649d7f061a28808cbc6c47b534bd789ef964"}, - {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e221cf152cff04059d011ee126477f0d9588303eb57e88923578ace7baad17f9"}, - {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:31000ec67d4221a71bd3f67df918b1f88f676f1c3b535a7eb473255fdc0b83fc"}, - {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6f17be4345073b0a7b8ea599688f692ac3ef23ce28e5df79c04de519dbc4912c"}, - {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e2b1fac190ae3ebfe37b979cc1ce69c81f4e4fe5746bb401dca63a9062cdaf1"}, - {file = "cffi-1.17.1-cp38-cp38-win32.whl", hash = "sha256:7596d6620d3fa590f677e9ee430df2958d2d6d6de2feeae5b20e82c00b76fbf8"}, - {file = "cffi-1.17.1-cp38-cp38-win_amd64.whl", hash = "sha256:78122be759c3f8a014ce010908ae03364d00a1f81ab5c7f4a7a5120607ea56e1"}, - {file = "cffi-1.17.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b2ab587605f4ba0bf81dc0cb08a41bd1c0a5906bd59243d56bad7668a6fc6c16"}, - {file = "cffi-1.17.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:28b16024becceed8c6dfbc75629e27788d8a3f9030691a1dbf9821a128b22c36"}, - {file = "cffi-1.17.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1d599671f396c4723d016dbddb72fe8e0397082b0a77a4fab8028923bec050e8"}, - {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca74b8dbe6e8e8263c0ffd60277de77dcee6c837a3d0881d8c1ead7268c9e576"}, - {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f7f5baafcc48261359e14bcd6d9bff6d4b28d9103847c9e136694cb0501aef87"}, - {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:98e3969bcff97cae1b2def8ba499ea3d6f31ddfdb7635374834cf89a1a08ecf0"}, - {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdf5ce3acdfd1661132f2a9c19cac174758dc2352bfe37d98aa7512c6b7178b3"}, - {file = "cffi-1.17.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:9755e4345d1ec879e3849e62222a18c7174d65a6a92d5b346b1863912168b595"}, - {file = "cffi-1.17.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:f1e22e8c4419538cb197e4dd60acc919d7696e5ef98ee4da4e01d3f8cfa4cc5a"}, - {file = "cffi-1.17.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:c03e868a0b3bc35839ba98e74211ed2b05d2119be4e8a0f224fba9384f1fe02e"}, - {file = "cffi-1.17.1-cp39-cp39-win32.whl", hash = "sha256:e31ae45bc2e29f6b2abd0de1cc3b9d5205aa847cafaecb8af1476a609a2f6eb7"}, - {file = "cffi-1.17.1-cp39-cp39-win_amd64.whl", hash = "sha256:d016c76bdd850f3c626af19b0542c9677ba156e4ee4fccfdd7848803533ef662"}, - {file = "cffi-1.17.1.tar.gz", hash = "sha256:1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824"}, ] [package.dependencies] @@ -3070,4 +3039,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "f6f4881a490558c029e567af38ee5c6f3c2e050e96edd6fc3e841a75901a9225" +content-hash = "0e0eec209d5652d6476b0d71393415eea2917f38235ad6e0b09ffd97f5b2ce87" diff --git a/libs/core/pyproject.toml b/libs/core/pyproject.toml index c3a06e70a0d..ac38bfad986 100644 --- a/libs/core/pyproject.toml +++ b/libs/core/pyproject.toml @@ -37,7 +37,7 @@ jsonpatch = "^1.33" PyYAML = ">=5.3" packaging = ">=23.2,<25" typing-extensions = ">=4.7" -pydantic = "^2.9" +pydantic = "^2.7.4" [tool.poetry.extras] diff --git a/libs/core/tests/unit_tests/prompts/__snapshots__/test_chat.ambr b/libs/core/tests/unit_tests/prompts/__snapshots__/test_chat.ambr index 7c3c2ffb456..11cec3e3b2e 100644 --- a/libs/core/tests/unit_tests/prompts/__snapshots__/test_chat.ambr +++ b/libs/core/tests/unit_tests/prompts/__snapshots__/test_chat.ambr @@ -1349,23 +1349,6 @@ 'history': dict({ 'default': None, 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/$defs/AIMessageChunk', - 'ChatMessageChunk': '#/$defs/ChatMessageChunk', - 'FunctionMessageChunk': '#/$defs/FunctionMessageChunk', - 'HumanMessageChunk': '#/$defs/HumanMessageChunk', - 'SystemMessageChunk': '#/$defs/SystemMessageChunk', - 'ToolMessageChunk': '#/$defs/ToolMessageChunk', - 'ai': '#/$defs/AIMessage', - 'chat': '#/$defs/ChatMessage', - 'function': '#/$defs/FunctionMessage', - 'human': '#/$defs/HumanMessage', - 'system': '#/$defs/SystemMessage', - 'tool': '#/$defs/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/$defs/AIMessage', @@ -2769,23 +2752,6 @@ 'properties': dict({ 'history': dict({ 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/$defs/AIMessageChunk', - 'ChatMessageChunk': '#/$defs/ChatMessageChunk', - 'FunctionMessageChunk': '#/$defs/FunctionMessageChunk', - 'HumanMessageChunk': '#/$defs/HumanMessageChunk', - 'SystemMessageChunk': '#/$defs/SystemMessageChunk', - 'ToolMessageChunk': '#/$defs/ToolMessageChunk', - 'ai': '#/$defs/AIMessage', - 'chat': '#/$defs/ChatMessage', - 'function': '#/$defs/FunctionMessage', - 'human': '#/$defs/HumanMessage', - 'system': '#/$defs/SystemMessage', - 'tool': '#/$defs/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/$defs/AIMessage', diff --git a/libs/core/tests/unit_tests/runnables/__snapshots__/test_graph.ambr b/libs/core/tests/unit_tests/runnables/__snapshots__/test_graph.ambr index 34929ad3abd..bf14546547a 100644 --- a/libs/core/tests/unit_tests/runnables/__snapshots__/test_graph.ambr +++ b/libs/core/tests/unit_tests/runnables/__snapshots__/test_graph.ambr @@ -1710,23 +1710,6 @@ 'type': 'string', }), dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/$defs/AIMessageChunk', - 'ChatMessageChunk': '#/$defs/ChatMessageChunk', - 'FunctionMessageChunk': '#/$defs/FunctionMessageChunk', - 'HumanMessageChunk': '#/$defs/HumanMessageChunk', - 'SystemMessageChunk': '#/$defs/SystemMessageChunk', - 'ToolMessageChunk': '#/$defs/ToolMessageChunk', - 'ai': '#/$defs/AIMessage', - 'chat': '#/$defs/ChatMessage', - 'function': '#/$defs/FunctionMessage', - 'human': '#/$defs/HumanMessage', - 'system': '#/$defs/SystemMessage', - 'tool': '#/$defs/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/$defs/AIMessage', diff --git a/libs/core/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr b/libs/core/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr index bee55716e86..23bc73ab3a8 100644 --- a/libs/core/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr +++ b/libs/core/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr @@ -6855,23 +6855,6 @@ 'properties': dict({ 'history': dict({ 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/$defs/AIMessageChunk', - 'ChatMessageChunk': '#/$defs/ChatMessageChunk', - 'FunctionMessageChunk': '#/$defs/FunctionMessageChunk', - 'HumanMessageChunk': '#/$defs/HumanMessageChunk', - 'SystemMessageChunk': '#/$defs/SystemMessageChunk', - 'ToolMessageChunk': '#/$defs/ToolMessageChunk', - 'ai': '#/$defs/AIMessage', - 'chat': '#/$defs/ChatMessage', - 'function': '#/$defs/FunctionMessage', - 'human': '#/$defs/HumanMessage', - 'system': '#/$defs/SystemMessage', - 'tool': '#/$defs/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/$defs/AIMessage', @@ -7320,23 +7303,6 @@ 'properties': dict({ 'messages': dict({ 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/$defs/AIMessageChunk', - 'ChatMessageChunk': '#/$defs/ChatMessageChunk', - 'FunctionMessageChunk': '#/$defs/FunctionMessageChunk', - 'HumanMessageChunk': '#/$defs/HumanMessageChunk', - 'SystemMessageChunk': '#/$defs/SystemMessageChunk', - 'ToolMessageChunk': '#/$defs/ToolMessageChunk', - 'ai': '#/$defs/AIMessage', - 'chat': '#/$defs/ChatMessage', - 'function': '#/$defs/FunctionMessage', - 'human': '#/$defs/HumanMessage', - 'system': '#/$defs/SystemMessage', - 'tool': '#/$defs/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/$defs/AIMessage', @@ -8399,23 +8365,6 @@ }), dict({ 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/definitions/AIMessageChunk', - 'ChatMessageChunk': '#/definitions/ChatMessageChunk', - 'FunctionMessageChunk': '#/definitions/FunctionMessageChunk', - 'HumanMessageChunk': '#/definitions/HumanMessageChunk', - 'SystemMessageChunk': '#/definitions/SystemMessageChunk', - 'ToolMessageChunk': '#/definitions/ToolMessageChunk', - 'ai': '#/definitions/AIMessage', - 'chat': '#/definitions/ChatMessage', - 'function': '#/definitions/FunctionMessage', - 'human': '#/definitions/HumanMessage', - 'system': '#/definitions/SystemMessage', - 'tool': '#/definitions/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/definitions/AIMessage', @@ -8854,23 +8803,6 @@ 'properties': dict({ 'messages': dict({ 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/definitions/AIMessageChunk', - 'ChatMessageChunk': '#/definitions/ChatMessageChunk', - 'FunctionMessageChunk': '#/definitions/FunctionMessageChunk', - 'HumanMessageChunk': '#/definitions/HumanMessageChunk', - 'SystemMessageChunk': '#/definitions/SystemMessageChunk', - 'ToolMessageChunk': '#/definitions/ToolMessageChunk', - 'ai': '#/definitions/AIMessage', - 'chat': '#/definitions/ChatMessage', - 'function': '#/definitions/FunctionMessage', - 'human': '#/definitions/HumanMessage', - 'system': '#/definitions/SystemMessage', - 'tool': '#/definitions/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/definitions/AIMessage', @@ -11253,23 +11185,6 @@ 'type': 'object', }), }), - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/definitions/AIMessageChunk', - 'ChatMessageChunk': '#/definitions/ChatMessageChunk', - 'FunctionMessageChunk': '#/definitions/FunctionMessageChunk', - 'HumanMessageChunk': '#/definitions/HumanMessageChunk', - 'SystemMessageChunk': '#/definitions/SystemMessageChunk', - 'ToolMessageChunk': '#/definitions/ToolMessageChunk', - 'ai': '#/definitions/AIMessage', - 'chat': '#/definitions/ChatMessage', - 'function': '#/definitions/FunctionMessage', - 'human': '#/definitions/HumanMessage', - 'system': '#/definitions/SystemMessage', - 'tool': '#/definitions/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/definitions/AIMessage', @@ -11325,23 +11240,6 @@ }), dict({ 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/definitions/AIMessageChunk', - 'ChatMessageChunk': '#/definitions/ChatMessageChunk', - 'FunctionMessageChunk': '#/definitions/FunctionMessageChunk', - 'HumanMessageChunk': '#/definitions/HumanMessageChunk', - 'SystemMessageChunk': '#/definitions/SystemMessageChunk', - 'ToolMessageChunk': '#/definitions/ToolMessageChunk', - 'ai': '#/definitions/AIMessage', - 'chat': '#/definitions/ChatMessage', - 'function': '#/definitions/FunctionMessage', - 'human': '#/definitions/HumanMessage', - 'system': '#/definitions/SystemMessage', - 'tool': '#/definitions/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/definitions/AIMessage', @@ -11780,23 +11678,6 @@ 'properties': dict({ 'messages': dict({ 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/definitions/AIMessageChunk', - 'ChatMessageChunk': '#/definitions/ChatMessageChunk', - 'FunctionMessageChunk': '#/definitions/FunctionMessageChunk', - 'HumanMessageChunk': '#/definitions/HumanMessageChunk', - 'SystemMessageChunk': '#/definitions/SystemMessageChunk', - 'ToolMessageChunk': '#/definitions/ToolMessageChunk', - 'ai': '#/definitions/AIMessage', - 'chat': '#/definitions/ChatMessage', - 'function': '#/definitions/FunctionMessage', - 'human': '#/definitions/HumanMessage', - 'system': '#/definitions/SystemMessage', - 'tool': '#/definitions/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/definitions/AIMessage', @@ -12842,23 +12723,6 @@ 'type': 'string', }), dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/definitions/AIMessageChunk', - 'ChatMessageChunk': '#/definitions/ChatMessageChunk', - 'FunctionMessageChunk': '#/definitions/FunctionMessageChunk', - 'HumanMessageChunk': '#/definitions/HumanMessageChunk', - 'SystemMessageChunk': '#/definitions/SystemMessageChunk', - 'ToolMessageChunk': '#/definitions/ToolMessageChunk', - 'ai': '#/definitions/AIMessage', - 'chat': '#/definitions/ChatMessage', - 'function': '#/definitions/FunctionMessage', - 'human': '#/definitions/HumanMessage', - 'system': '#/definitions/SystemMessage', - 'tool': '#/definitions/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/definitions/AIMessage', @@ -14642,23 +14506,6 @@ 'properties': dict({ 'messages': dict({ 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/definitions/AIMessageChunk', - 'ChatMessageChunk': '#/definitions/ChatMessageChunk', - 'FunctionMessageChunk': '#/definitions/FunctionMessageChunk', - 'HumanMessageChunk': '#/definitions/HumanMessageChunk', - 'SystemMessageChunk': '#/definitions/SystemMessageChunk', - 'ToolMessageChunk': '#/definitions/ToolMessageChunk', - 'ai': '#/definitions/AIMessage', - 'chat': '#/definitions/ChatMessage', - 'function': '#/definitions/FunctionMessage', - 'human': '#/definitions/HumanMessage', - 'system': '#/definitions/SystemMessage', - 'tool': '#/definitions/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/definitions/AIMessage', @@ -16118,23 +15965,6 @@ 'properties': dict({ 'messages': dict({ 'items': dict({ - 'discriminator': dict({ - 'mapping': dict({ - 'AIMessageChunk': '#/definitions/AIMessageChunk', - 'ChatMessageChunk': '#/definitions/ChatMessageChunk', - 'FunctionMessageChunk': '#/definitions/FunctionMessageChunk', - 'HumanMessageChunk': '#/definitions/HumanMessageChunk', - 'SystemMessageChunk': '#/definitions/SystemMessageChunk', - 'ToolMessageChunk': '#/definitions/ToolMessageChunk', - 'ai': '#/definitions/AIMessage', - 'chat': '#/definitions/ChatMessage', - 'function': '#/definitions/FunctionMessage', - 'human': '#/definitions/HumanMessage', - 'system': '#/definitions/SystemMessage', - 'tool': '#/definitions/ToolMessage', - }), - 'propertyName': 'type', - }), 'oneOf': list([ dict({ '$ref': '#/definitions/AIMessage',