Skip to content

Commit

Permalink
Merge branch 'client-helper' of https://github.com/michaelnchin/langc…
Browse files Browse the repository at this point in the history
…hain-aws into client-helper
  • Loading branch information
michaelnchin committed Feb 14, 2025
2 parents ab2a3f4 + a0290e9 commit bf43806
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions libs/aws/langchain_aws/chat_models/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,11 +641,11 @@ def get_token_ids(self, text: str) -> List[int]:
return get_token_ids_anthropic(text)
else:
warnings.warn(
"Falling back to default token method due to missing or incompatible `anthropic` installation "
"(needs <=0.38.0).\n\nIf using `anthropic>0.38.0`, it is recommended to provide the model "
"class with a custom_get_token_ids method implementing a more accurate tokenizer for Anthropic. "
"For get_num_tokens, as another alternative, you can implement your own token counter method "
"using the ChatAnthropic or AnthropicLLM classes."
f"Falling back to default token method due to missing or incompatible `anthropic` installation "
f"(needs <=0.38.0).\n\nIf using `anthropic>0.38.0`, it is recommended to provide the model "
f"class with a custom_get_token_ids method implementing a more accurate tokenizer for Anthropic. "
f"For get_num_tokens, as another alternative, you can implement your own token counter method "
f"using the ChatAnthropic or AnthropicLLM classes."
)
return super().get_token_ids(text)

Expand Down Expand Up @@ -873,6 +873,7 @@ def _as_converse(self) -> ChatBedrockConverse:
if self.temperature is not None:
kwargs["temperature"] = self.temperature
return ChatBedrockConverse(
client=self.client,
model=self.model_id,
region_name=self.region_name,
credentials_profile_name=self.credentials_profile_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def chat_model_class(self) -> Type[BaseChatModel]:
@property
def chat_model_params(self) -> dict:
return {
"client": None,
"model": "anthropic.claude-3-sonnet-20240229-v1:0",
"region_name": "us-west-1",
}
Expand Down

0 comments on commit bf43806

Please sign in to comment.