aws-samples / dify-aws-tool

MIT No Attribution
33 stars 7 forks source link

Add a built-in tool applyguardrail #9

Closed xina0311 closed 4 months ago

xina0311 commented 4 months ago

Issue #, if available: N/A

Description of changes:

  1. Added new Content Moderation Guardrails functionality using the ApplyGuardrail API from Guardrails for Amazon Bedrock.
  2. Implemented capability to evaluate input prompts and model responses for all Foundation Models (FMs), including those on Amazon Bedrock, custom FMs, and third-party FMs.
  3. Added the following new parameters:
    • guardrail_id: Specifies the ID of the Guardrail already created on Amazon Bedrock
    • guardrail_version: Specifies the published version of the Guardrail
    • source: Indicates the content source (INPUT or OUTPUT)
    • text: Content to be reviewed
  4. Included descriptions and labels in both English and Chinese to support multilingual usage.

This new feature will help organizations achieve centralized governance across all their generative AI applications, enhancing control and consistency in content moderation.

Testing: Basic testing has been performed on the newly added parameters and functionality to ensure proper integration with the ApplyGuardrail API of Amazon Bedrock.

Documentation updates: Relevant documentation has been updated, including parameter descriptions and usage instructions, to reflect the new Content Moderation Guardrails functionality.

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