langchain/libs/partners/anthropic/langchain_anthropic
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
..
__init__.py anthropic[minor]: package move (#17974) 2024-02-25 21:57:26 -08:00
chat_models.py core, partners: add token usage attribute to AIMessage (#21944) 2024-05-23 14:21:58 -04:00
experimental.py (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 2024-05-03 14:29:36 -04:00
llms.py (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 2024-05-03 14:29:36 -04:00
output_parsers.py core[minor], ...: add tool calls message (#18947) 2024-04-09 18:41:42 -05:00
py.typed