Skip to content

Commit

Permalink
Fix model_id validation in ChatBedrock (#300)
Browse files Browse the repository at this point in the history
Fixed a minor regression in v0.2.9. Runs of `ChatBedrock` with missing
or NoneType `model_id` get caught in the new `beta_use_converse_api`
parameter check, which throws an ambiguous TypeError.

This change restores the original behavior where ValidationError is
thrown for absent `model_id`.

---------

Co-authored-by: Piyush Jain <[email protected]>
  • Loading branch information
michaelnchin and 3coins authored Dec 18, 2024
1 parent e02b396 commit 175d2d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/aws/langchain_aws/chat_models/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def get_lc_namespace(cls) -> List[str]:
def set_beta_use_converse_api(cls, values: Dict) -> Any:
model_id = values.get("model_id", values.get("model"))

if "beta_use_converse_api" not in values:
if model_id and "beta_use_converse_api" not in values:
values["beta_use_converse_api"] = "nova" in model_id
return values

Expand Down

0 comments on commit 175d2d0

Please sign in to comment.