Home / Function/ test_bulk_message_implementation_only() — langchain Function Reference

test_bulk_message_implementation_only() — langchain Function Reference

Architecture documentation for the test_bulk_message_implementation_only() function in test_chat_history.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0df9868c_e8ae_6e6a_0621_05c379354334["test_bulk_message_implementation_only()"]
  bb44d82a_7f9d_8d19_baa4_96f8844d68a3["test_chat_history.py"]
  0df9868c_e8ae_6e6a_0621_05c379354334 -->|defined in| bb44d82a_7f9d_8d19_baa4_96f8844d68a3
  7a3e1ff0_9d2e_5680_8a98_060fc7fcba81["add_messages()"]
  0df9868c_e8ae_6e6a_0621_05c379354334 -->|calls| 7a3e1ff0_9d2e_5680_8a98_060fc7fcba81
  fdc9b751_6f24_304f_2bef_9245cfd574b0["add_message()"]
  0df9868c_e8ae_6e6a_0621_05c379354334 -->|calls| fdc9b751_6f24_304f_2bef_9245cfd574b0
  a586e127_e8cf_b8e1_7d81_19a8bdc9ae78["clear()"]
  0df9868c_e8ae_6e6a_0621_05c379354334 -->|calls| a586e127_e8cf_b8e1_7d81_19a8bdc9ae78
  style 0df9868c_e8ae_6e6a_0621_05c379354334 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/chat_history/test_chat_history.py lines 42–74

def test_bulk_message_implementation_only() -> None:
    """Test that SampleChatHistory works as expected."""
    store: list[BaseMessage] = []

    class BulkAddHistory(BaseChatMessageHistory):
        def __init__(self, *, store: list[BaseMessage]) -> None:
            self.store = store

        def add_messages(self, message: Sequence[BaseMessage]) -> None:
            """Add a message to the store."""
            self.store.extend(message)

        def clear(self) -> None:
            """Clear the store."""
            raise NotImplementedError

    chat_history = BulkAddHistory(store=store)
    chat_history.add_message(HumanMessage(content="Hello"))
    assert len(store) == 1
    assert store[0] == HumanMessage(content="Hello")
    chat_history.add_message(HumanMessage(content="World"))
    assert len(store) == 2
    assert store[1] == HumanMessage(content="World")

    chat_history.add_messages(
        [
            HumanMessage(content="Hello"),
            HumanMessage(content="World"),
        ]
    )
    assert len(store) == 4
    assert store[2] == HumanMessage(content="Hello")
    assert store[3] == HumanMessage(content="World")

Domain

Subdomains

Frequently Asked Questions

What does test_bulk_message_implementation_only() do?
test_bulk_message_implementation_only() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/chat_history/test_chat_history.py.
Where is test_bulk_message_implementation_only() defined?
test_bulk_message_implementation_only() is defined in libs/core/tests/unit_tests/chat_history/test_chat_history.py at line 42.
What does test_bulk_message_implementation_only() call?
test_bulk_message_implementation_only() calls 3 function(s): add_message, add_messages, clear.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free