From 64abd06a6e48792cb6c0fcbad2adc1b07fca71fa Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Fri, 20 Sep 2024 12:05:52 -0400 Subject: [PATCH 1/3] touch file --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 079839741..860fa6a0d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,6 +134,7 @@ shiny = "shiny._main:main" [project.entry-points.pytest11] shiny-test = "shiny.pytest._pytest" + [tool.pytest.ini_options] testpaths = ["tests"] From ffdea07a10da6dc11d52d5a65657108ee882ff14 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Fri, 20 Sep 2024 12:22:44 -0400 Subject: [PATCH 2/3] Use langchain's Sequence object to avoid incorrect comparisons between our Sequence object and theirs Problematic change: https://github.com/langchain-ai/langchain/commit/a47b33284152d85d2233f069f993f9c0ef4da0d7#diff-639e6297e1db3729c228f5172ad900f6b5385c04ffef072fba2c4acd76de7e8dR4 --- tests/pytest/test_chat.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/pytest/test_chat.py b/tests/pytest/test_chat.py index 615912a5e..c4d9d3e14 100644 --- a/tests/pytest/test_chat.py +++ b/tests/pytest/test_chat.py @@ -2,7 +2,7 @@ import sys from datetime import datetime -from typing import Sequence, Union, cast, get_args, get_origin +from typing import Union, cast, get_args, get_origin import pytest @@ -390,6 +390,9 @@ def test_as_google_message(): def test_as_langchain_message(): from langchain_core.language_models.base import LanguageModelInput + from langchain_core.language_models.base import ( + Sequence as LangchainSequence, # pyright: ignore[reportPrivateImportUsage] + ) from langchain_core.language_models.chat_models import BaseChatModel from langchain_core.messages import ( AIMessage, @@ -404,7 +407,12 @@ def test_as_langchain_message(): assert BaseChatModel.invoke.__annotations__["input"] == "LanguageModelInput" assert BaseChatModel.stream.__annotations__["input"] == "LanguageModelInput" - assert is_type_in_union(Sequence[MessageLikeRepresentation], LanguageModelInput) + assert is_type_in_union( + # Use `LangchainSequence` instead of `Sequence` to avoid incorrect comparison + # between `typing.Sequence` and `collections.abc.Sequence` + LangchainSequence[MessageLikeRepresentation], + LanguageModelInput, + ) assert is_type_in_union(BaseMessage, MessageLikeRepresentation) assert issubclass(AIMessage, BaseMessage) From 8c320bada5c1f88865afec515d409b360ad19d50 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Fri, 20 Sep 2024 12:24:57 -0400 Subject: [PATCH 3/3] Discard changes to pyproject.toml --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 860fa6a0d..079839741 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,7 +134,6 @@ shiny = "shiny._main:main" [project.entry-points.pytest11] shiny-test = "shiny.pytest._pytest" - [tool.pytest.ini_options] testpaths = ["tests"]