Home / Class/ InputTokenDetails Class — langchain Architecture

InputTokenDetails Class — langchain Architecture

Architecture documentation for the InputTokenDetails class in ai.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c7d6bd60_8bdd_ab2b_7bf0_8ee67094e40f["InputTokenDetails"]
  98b3055e_a59b_3f72_0c70_bc2d048efeb0["ai.py"]
  c7d6bd60_8bdd_ab2b_7bf0_8ee67094e40f -->|defined in| 98b3055e_a59b_3f72_0c70_bc2d048efeb0

Relationship Graph

Source Code

libs/core/langchain_core/messages/ai.py lines 38–71

class InputTokenDetails(TypedDict, total=False):
    """Breakdown of input token counts.

    Does *not* need to sum to full input token count. Does *not* need to have all keys.

    Example:
        ```python
        {
            "audio": 10,
            "cache_creation": 200,
            "cache_read": 100,
        }
        ```

    May also hold extra provider-specific keys.

    !!! version-added "Added in `langchain-core` 0.3.9"
    """

    audio: int
    """Audio input tokens."""

    cache_creation: int
    """Input tokens that were cached and there was a cache miss.

    Since there was a cache miss, the cache was created from these tokens.
    """

    cache_read: int
    """Input tokens that were cached and there was a cache hit.

    Since there was a cache hit, the tokens were read from the cache. More precisely,
    the model state given these tokens was read from the cache.
    """

Frequently Asked Questions

What is the InputTokenDetails class?
InputTokenDetails is a class in the langchain codebase, defined in libs/core/langchain_core/messages/ai.py.
Where is InputTokenDetails defined?
InputTokenDetails is defined in libs/core/langchain_core/messages/ai.py at line 38.

Analyze Your Own Codebase

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

Try Supermodel Free