Home / Function/ test_custom_token_counting() — langchain Function Reference

test_custom_token_counting() — langchain Function Reference

Architecture documentation for the test_custom_token_counting() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a08c7186_0a28_0c71_d003_5e276c6ebd6e["test_custom_token_counting()"]
  aaa4b344_20ed_7fa3_4067_f8f05affc01f["test_chat_models.py"]
  a08c7186_0a28_0c71_d003_5e276c6ebd6e -->|defined in| aaa4b344_20ed_7fa3_4067_f8f05affc01f
  style a08c7186_0a28_0c71_d003_5e276c6ebd6e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/mistralai/tests/unit_tests/test_chat_models.py lines 293–298

def test_custom_token_counting() -> None:
    def token_encoder(text: str) -> list[int]:
        return [1, 2, 3]

    llm = ChatMistralAI(custom_get_token_ids=token_encoder)
    assert llm.get_token_ids("foo") == [1, 2, 3]

Domain

Subdomains

Frequently Asked Questions

What does test_custom_token_counting() do?
test_custom_token_counting() is a function in the langchain codebase, defined in libs/partners/mistralai/tests/unit_tests/test_chat_models.py.
Where is test_custom_token_counting() defined?
test_custom_token_counting() is defined in libs/partners/mistralai/tests/unit_tests/test_chat_models.py at line 293.

Analyze Your Own Codebase

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

Try Supermodel Free