-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix guardrail attributes when invoking bedrock #26
Conversation
@3coins This is the PR for guardrails with the new structure. Can you please have a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving from bedrock testing
@brnaba-aws |
Looking forward to get this fix merged for the GA version of Guardrails for Amazon Bedrock.
Is backward compatibility needed for the "Preview" version of Guardrails? |
langchain-aws version used: 0.1.4 Have tried all the below scenarios:
Adding the exception below:
Tried the alternative as below: Got the exception as below: Error Occured: Guardrails must be a dictionary with 'guardrailIdentifier' and 'guardrailVersion' keys. The below option doesn't give any error but eventually has no relevance as the identifier value is None: guardrails={ "trace": False, Please suggest the correct way of passing the guardrail parameter for it to work. PS: I have tested the Guardrail from Bedrock Console and it works like a charm. |
@MaverickScientist Which version of boto3 do you use? It seems like the version you have is not the latest. If you use a lambda, verify the boto3 version and if it is not a version that supports guardrails attributes, package your lambda with the latest version of boto3. |
Moving to boto 1.34.108 fixed it. |
The guardrails attributes were changed in #26 . However, the docstring had the old parameter keys. It looks like this causes the example on https://api.python.langchain.com/en/latest/chat_models/langchain_aws.chat_models.bedrock.ChatBedrock.html#langchain_aws.chat_models.bedrock.ChatBedrock.guardrails to be wrong. ![image](https://github.com/user-attachments/assets/3f567897-345e-4ec0-b9ff-c48ae70a6a78)
Fixed bedrock attributes when using guardrails. See example of usage: