Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

docs - Bedrock Guardrails

Ishaan Jaff7cac1b0dce39
diff --git a/docs/my-website/docs/providers/bedrock.md b/docs/my-website/docs/providers/bedrock.md
index 2b2b8ca814d..08a4d4862d5 100644
--- a/docs/my-website/docs/providers/bedrock.md
+++ b/docs/my-website/docs/providers/bedrock.md
@@ -360,6 +360,37 @@ resp = litellm.completion(
print(f"\nResponse: {resp}")
```
+
+## Usage - Bedrock Guardrails
+
+Example of using [Bedrock Guardrails with LiteLLM](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-use-converse-api.html)
+
+```python
+from litellm import completion
+
+# set env
+os.environ["AWS_ACCESS_KEY_ID"] = ""
+os.environ["AWS_SECRET_ACCESS_KEY"] = ""
+os.environ["AWS_REGION_NAME"] = ""
+
+response = completion(
+ model="anthropic.claude-v2",
+ messages=[
+ {
+ "content": "where do i buy coffee from? ",
+ "role": "user",
+ }
+ ],
+ max_tokens=10,
+ guardrailConfig={
+ "guardrailIdentifier": "ff6ujrregl1q", # The identifier (ID) for the guardrail.
+ "guardrailVersion": "DRAFT", # The version of the guardrail.
+ "trace": "disabled", # The trace behavior for the guardrail. Can either be "disabled" or "enabled"
+ },
+)
+```
+
+
## Usage - "Assistant Pre-fill"
If you're using Anthropic's Claude with Bedrock, you can "put words in Claude's mouth" by including an `assistant` role message as the last item in the `messages` array.