Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-farmer committed Dec 3, 2024
1 parent 9a27307 commit f8f36eb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libs/aws/langchain_aws/chat_models/bedrock_converse.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ class Joke(BaseModel):
"""Which types of tool_choice values the model supports.
Inferred if not specified. Inferred as ('auto', 'any', 'tool') if a 'claude-3'
model is used, ('auto', 'any') if a 'mistral-large' model is used, ('auto') if a 'nova' model is used,
empty otherwise.
model is used, ('auto', 'any') if a 'mistral-large' model is used,
('auto') if a 'nova' model is used, empty otherwise.
"""

model_config = ConfigDict(
Expand All @@ -407,7 +407,8 @@ def set_disable_streaming(cls, values: Dict) -> Any:
model_parts[-2] if len(model_parts) > 1 else model_parts[0]
)

# As of 12/03/24 Anthropic, Cohere and Amazon Nova models support streamed tool calling
# As of 12/03/24:
# Anthropic, Cohere and Amazon Nova models support streamed tool calling
if "disable_streaming" not in values:
values["disable_streaming"] = (
False
Expand All @@ -421,15 +422,16 @@ def set_disable_streaming(cls, values: Dict) -> Any:
def validate_environment(self) -> Self:
"""Validate that AWS credentials to and python package exists in environment."""

# As of 12/03/24 only claude-3, mistral-large, and nova models support tool choice:
# As of 12/03/24:
# only claude-3, mistral-large, and nova models support tool choice:
# https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolChoice.html
if self.supports_tool_choice_values is None:
if "claude-3" in self.model_id:
self.supports_tool_choice_values = ("auto", "any", "tool")
elif "mistral-large" in self.model_id:
self.supports_tool_choice_values = ("auto", "any")
elif "nova" in self.model_id:
self.supports_tool_choice_values = ("auto", "")
self.supports_tool_choice_values = ["auto"]
else:
self.supports_tool_choice_values = ()

Expand Down

0 comments on commit f8f36eb

Please sign in to comment.