From 8a3a9c89687cfc337b97c24919e6cf029362f380 Mon Sep 17 00:00:00 2001 From: Bagatur <22008038+baskaryan@users.noreply.github.com> Date: Thu, 5 Sep 2024 20:49:05 -0400 Subject: [PATCH] core[patch]: concrete prompt value test (#26128) --- .../tests/unit_tests/test_prompt_values.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 libs/core/tests/unit_tests/test_prompt_values.py diff --git a/libs/core/tests/unit_tests/test_prompt_values.py b/libs/core/tests/unit_tests/test_prompt_values.py new file mode 100644 index 00000000000..625cd51202b --- /dev/null +++ b/libs/core/tests/unit_tests/test_prompt_values.py @@ -0,0 +1,28 @@ +import pytest + +from langchain_core.messages import ( + AIMessage, + AIMessageChunk, + HumanMessage, + HumanMessageChunk, + SystemMessage, + SystemMessageChunk, + ToolMessage, + ToolMessageChunk, +) +from langchain_core.prompt_values import ChatPromptValueConcrete + + +@pytest.mark.xfail(reason="Broken union type.") +def test_chat_prompt_value_concrete() -> None: + messages: list = [ + AIMessage("foo"), + HumanMessage("foo"), + SystemMessage("foo"), + ToolMessage("foo", tool_call_id="foo"), + AIMessageChunk(content="foo"), + HumanMessageChunk(content="foo"), + SystemMessageChunk(content="foo"), + ToolMessageChunk(content="foo", tool_call_id="foo"), + ] + assert ChatPromptValueConcrete(messages=messages).messages == messages