Skip to content

Commit

Permalink
Fix ChatBedrock docs for guardrails (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
roberttstephens authored Oct 22, 2024
1 parent ee32da0 commit dd76e34
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions libs/aws/langchain_aws/llms/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,19 +579,20 @@ class BedrockBase(BaseLanguageModel, ABC):
"""
An optional dictionary to configure guardrails for Bedrock.
This field 'guardrails' consists of two keys: 'id' and 'version',
which should be strings, but are initialized to None. It's used to
determine if specific guardrails are enabled and properly set.
This field 'guardrails' consists of two keys: 'guardrailId' and
'guardrailVersion', which should be strings, but are initialized to None.
It's used to determine if specific guardrails are enabled and properly set.
Type:
Optional[Mapping[str, str]]: A mapping with 'id' and 'version' keys.
Optional[Mapping[str, str]]: A mapping with 'guardrailId' and
'guardrailVersion' keys.
Example:
llm = BedrockLLM(model_id="<model_id>", client=<bedrock_client>,
model_kwargs={},
guardrails={
"id": "<guardrail_id>",
"version": "<guardrail_version>"})
"guardrailId": "<guardrail_id>",
"guardrailVersion": "<guardrail_version>"})
To enable tracing for guardrails, set the 'trace' key to True and pass a callback handler to the
'run_manager' parameter of the 'generate', '_call' methods.
Expand All @@ -600,8 +601,8 @@ class BedrockBase(BaseLanguageModel, ABC):
llm = BedrockLLM(model_id="<model_id>", client=<bedrock_client>,
model_kwargs={},
guardrails={
"id": "<guardrail_id>",
"version": "<guardrail_version>",
"guardrailId": "<guardrail_id>",
"guardrailVersion": "<guardrail_version>",
"trace": True},
callbacks=[BedrockAsyncCallbackHandler()])
Expand Down

0 comments on commit dd76e34

Please sign in to comment.