Skip to content
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

feat(guardrails): add Contextual grounding #660

Merged
merged 5 commits into from
Aug 27, 2024

Conversation

krokoko
Copy link
Collaborator

@krokoko krokoko commented Aug 26, 2024

Fixes #656

  • Update CDK min version to 2.154.1 to support new feature
  • Add contextual grounding support

Pending testing

guardrails.addContextualGroundingPolicyConfig([
      {
        threshold: 0.5,
        filtersConfigType: bedrock.ContextualGroundingFilterConfigType.GROUNDING,
      },
      {
        threshold: 0.9,
        filtersConfigType: bedrock.ContextualGroundingFilterConfigType.RELEVANCE,
      },
    ]);

image

Agent has guardrails attached:

image

When asking a question with a response factually correct:

image

Examples when blocking:

image


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

@krokoko krokoko marked this pull request as ready for review August 26, 2024 16:46
@krokoko krokoko requested a review from a team as a code owner August 26, 2024 16:46
Copy link
Contributor

@laithalsaadoon laithalsaadoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@krokoko krokoko self-assigned this Aug 26, 2024
@krokoko krokoko merged commit af2ef14 into awslabs:main Aug 27, 2024
13 of 15 checks passed
@krokoko krokoko deleted the contextual_grounding branch August 27, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(bedrock): guardrail contextual grounding support
5 participants