Home / Function/ test_count_tokens_approximately_respects_count_name_flag() — langchain Function Reference

test_count_tokens_approximately_respects_count_name_flag() — langchain Function Reference

Architecture documentation for the test_count_tokens_approximately_respects_count_name_flag() function in test_utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  dbd2a9ed_85b2_0e16_f3f3_9ecbbe821d7d["test_count_tokens_approximately_respects_count_name_flag()"]
  03f6a5ae_d57a_eb66_626a_b9e082b763ea["test_utils.py"]
  dbd2a9ed_85b2_0e16_f3f3_9ecbbe821d7d -->|defined in| 03f6a5ae_d57a_eb66_626a_b9e082b763ea
  style dbd2a9ed_85b2_0e16_f3f3_9ecbbe821d7d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_utils.py lines 2902–2910

def test_count_tokens_approximately_respects_count_name_flag() -> None:
    """Test that the count_name flag controls whether names are included."""
    message = HumanMessage(content="hello", name="user-name")

    with_name = count_tokens_approximately([message], count_name=True)
    without_name = count_tokens_approximately([message], count_name=False)

    # When count_name is True, the name should contribute to the token count.
    assert with_name > without_name

Domain

Subdomains

Frequently Asked Questions

What does test_count_tokens_approximately_respects_count_name_flag() do?
test_count_tokens_approximately_respects_count_name_flag() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/test_utils.py.
Where is test_count_tokens_approximately_respects_count_name_flag() defined?
test_count_tokens_approximately_respects_count_name_flag() is defined in libs/core/tests/unit_tests/messages/test_utils.py at line 2902.

Analyze Your Own Codebase

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

Try Supermodel Free