🚧 feat: Add Bedrock Guardrails Support (#11141)

* feat: Add Bedrock Guardrails support

* Update packages/data-provider/src/schemas.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Prevent user override of guardrails

* refactor: Bedrock initialization and schema to handle guardrailConfig more effectively

- Updated the initializeBedrock function to apply guardrailConfig conditionally, ensuring it is set only when available.
- Removed guardrailConfig from bedrockInputSchema and bedrockInputParser to streamline input handling.
- Excluded guardrailConfig from tConversationSchema to simplify the schema definition.

These changes enhance the clarity and functionality of the Bedrock initialization process.

* test: Add unit tests for Bedrock initialization

- Introduced comprehensive tests for the initializeBedrock function, covering various configurations including environment variables, user-provided credentials, and guardrail configurations.
- Ensured proper handling of proxy settings and session tokens.
- Validated return structure and edge cases for credentials management.

These tests enhance the reliability and maintainability of the Bedrock initialization process.

---------

Co-authored-by: David Neale <david.neale@admiralfinancialservices.co.uk>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
David Neale 2026-01-03 17:41:48 +00:00 committed by GitHub
parent 200098d992
commit 4d6ea3b182
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 368 additions and 2 deletions

View file

@ -427,6 +427,22 @@ endpoints:
forcePrompt: false
modelDisplayLabel: 'Portkey'
iconURL: https://images.crunchbase.com/image/upload/c_pad,f_auto,q_auto:eco,dpr_1/rjqy7ghvjoiu4cd1xjbf
# AWS Bedrock Example
# Note: Bedrock endpoint is configured via environment variables
# bedrock:
# # Guardrail Configuration
# guardrailConfig:
# guardrailIdentifier: "your-guardrail-id"
# guardrailVersion: "1"
#
# # Trace behavior for debugging (optional)
# # - "enabled": Include basic trace information about guardrail assessments
# # - "enabled_full": Include comprehensive trace details (recommended for debugging)
# # - "disabled": No trace information (default)
# # Trace output is logged to application log files for compliance auditing
# trace: "enabled"
# Example modelSpecs configuration showing grouping options
# The 'group' field organizes model specs in the UI selector:
# - If 'group' matches an endpoint name (e.g., "openAI", "groq"), the spec appears nested under that endpoint