diff --git a/libs/core/langchain_core/outputs/chat_generation.py b/libs/core/langchain_core/outputs/chat_generation.py index 1579d95d2c9..d01ae516942 100644 --- a/libs/core/langchain_core/outputs/chat_generation.py +++ b/libs/core/langchain_core/outputs/chat_generation.py @@ -53,7 +53,7 @@ class ChatGeneration(Generation): text = "" if isinstance(self.message.content, str): text = self.message.content - # HACK: Assumes text in content blocks in OpenAI format. + # Assumes text in content blocks in OpenAI format. # Uses first text block. elif isinstance(self.message.content, list): for block in self.message.content: diff --git a/libs/core/pyproject.toml b/libs/core/pyproject.toml index 6117bfe869d..4e206731576 100644 --- a/libs/core/pyproject.toml +++ b/libs/core/pyproject.toml @@ -82,12 +82,15 @@ ignore = [ "C90", # McCabe complexity "COM812", # Messes with the formatter "FA100", # Can't activate since we exclude UP007 for now + "FIX002", # Line contains TODO "ISC001", # Messes with the formatter "PERF203", # Rarely useful "PLR09", # Too many something (arg, statements, etc) "TC001", # Doesn't play well with Pydantic "TC002", # Doesn't play well with Pydantic "TC003", # Doesn't play well with Pydantic + "TD002", # Missing author in TODO + "TD003", # Missing issue link in TODO "UP007", # Doesn't play well with Pydantic in Python 3.9 # TODO rules @@ -99,13 +102,11 @@ ignore = [ "DTZ", "FBT001", "FBT002", - "FIX", "PGH", "PLR", "PYI", "RUF", "SLF", - "TD", ] flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel","langchain_core.load.serializable.Serializable","langchain_core.runnables.base.RunnableSerializable"] flake8-annotations.allow-star-arg-any = true diff --git a/libs/core/tests/unit_tests/runnables/test_runnable.py b/libs/core/tests/unit_tests/runnables/test_runnable.py index 8309ab128a3..71b006d6622 100644 --- a/libs/core/tests/unit_tests/runnables/test_runnable.py +++ b/libs/core/tests/unit_tests/runnables/test_runnable.py @@ -3228,7 +3228,8 @@ def test_map_stream() -> None: {"llm": "i"}, {"chat": _any_id_ai_message_chunk(content="i")}, ] - if not ( # TODO(Rewrite properly) statement above + if not ( + # TODO: Rewrite properly the statement above streamed_chunks[0] == {"llm": "i"} or {"chat": _any_id_ai_message_chunk(content="i")} ):