langchain/libs/core/tests
ccurme fbfed65fb1
core, partners: add token usage attribute to AIMessage (#21944)
```python
class UsageMetadata(TypedDict):
    """Usage metadata for a message, such as token counts.

    Attributes:
        input_tokens: (int) count of input (or prompt) tokens
        output_tokens: (int) count of output (or completion) tokens
        total_tokens: (int) total token count
    """

    input_tokens: int
    output_tokens: int
    total_tokens: int
```
```python
class AIMessage(BaseMessage):
    ...
    usage_metadata: Optional[UsageMetadata] = None
    """If provided, token usage information associated with the message."""
    ...
```
2024-05-23 14:21:58 -04:00
..
integration_tests core[patch], langchain[patch]: fix required deps (#14373) 2023-12-07 14:24:58 -08:00
unit_tests core, partners: add token usage attribute to AIMessage (#21944) 2024-05-23 14:21:58 -04:00
__init__.py Separate out langchain_core package (#13577) 2023-11-20 13:09:30 -08:00