From 71c0698ee4e9cc433560e0a0f0ea7e3a76cd99ef Mon Sep 17 00:00:00 2001 From: Naval Chand Date: Tue, 6 Aug 2024 22:58:47 +0530 Subject: [PATCH] Added bedrock 3-5 sonnet cost detials for BedrockAnthropicTokenUsageCallbackHandler (#25104) Thank you for contributing to LangChain! - [ ] **PR title**: "package: description" - Example: "community: Added bedrock 3-5 sonnet cost detials for BedrockAnthropicTokenUsageCallbackHandler" - [ ] **PR message**: ***Delete this entire checklist*** and replace with - **Description:** a description of the change - **Issue:** the issue # it fixes, if applicable - **Dependencies:** any dependencies required for this change - **Twitter handle:** if your PR gets announced, and you'd like a mention, we'll gladly shout you out! - [ ] **Add tests and docs**: If you're adding a new integration, please include 1. a test for the integration, preferably unit tests that do not rely on network access, 2. an example notebook showing its use. It lives in `docs/docs/integrations` directory. - [ ] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. - If you are adding something to community, do not re-import it in langchain. If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17. Co-authored-by: Naval Chand --- .../langchain_community/callbacks/bedrock_anthropic_callback.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/community/langchain_community/callbacks/bedrock_anthropic_callback.py b/libs/community/langchain_community/callbacks/bedrock_anthropic_callback.py index d146bf8fbe0..0c4d4bbd8be 100644 --- a/libs/community/langchain_community/callbacks/bedrock_anthropic_callback.py +++ b/libs/community/langchain_community/callbacks/bedrock_anthropic_callback.py @@ -9,6 +9,7 @@ MODEL_COST_PER_1K_INPUT_TOKENS = { "anthropic.claude-v2": 0.008, "anthropic.claude-v2:1": 0.008, "anthropic.claude-3-sonnet-20240229-v1:0": 0.003, + "anthropic.claude-3-5-sonnet-20240620-v1:0": 0.003, "anthropic.claude-3-haiku-20240307-v1:0": 0.00025, } @@ -17,6 +18,7 @@ MODEL_COST_PER_1K_OUTPUT_TOKENS = { "anthropic.claude-v2": 0.024, "anthropic.claude-v2:1": 0.024, "anthropic.claude-3-sonnet-20240229-v1:0": 0.015, + "anthropic.claude-3-5-sonnet-20240620-v1:0": 0.015, "anthropic.claude-3-haiku-20240307-v1:0": 0.00125, }