cohere-ai / cohere-python

Python Library for Accessing the Cohere API
https://docs.cohere.ai
MIT License
278 stars 60 forks source link

Map X-Amzn-Bedrock token counts #537

Closed billytrend-cohere closed 1 month ago

billytrend-cohere commented 1 month ago

The PR introduces changes to the src/cohere/aws_client.py and tests/test_aws_client.py files.

Summary

The changes add token and billing information to the responses from the AWS client. Specifically, the map_token_counts function is introduced to calculate the input and output token counts from the response headers. This information is then added to the response object under the "meta" field.

Changes