Skip to content

Commit 65e128c

Browse files
committed
docs: Update _split_prompt docstring to explain guardrail scanning behavior
1 parent a00cbe3 commit 65e128c

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

scripts/issue_bot/bedrock_client.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,17 @@ def invoke(self, prompt, max_tokens=4096, temperature=0.3, json_schema=None):
9393
return None
9494

9595
def _split_prompt(self, prompt):
96-
"""Split rendered prompt into system prompt and user message.
96+
"""Split rendered prompt into system prompt and user message blocks.
9797
98-
Everything before <user_input> goes in system prompt (exempt from guardrail).
99-
Only <user_input> content (issue title/body/comments) is guarded.
100-
This keeps KB, diffs, and codebase maps out of guardrail scanning.
98+
When guardrail is configured and both text and guardContent blocks are
99+
present in the user message, the guardrail only scans guardContent blocks.
100+
Text blocks are passed through unscanned.
101+
102+
Split at <user_input>:
103+
- Before <user_input> → system prompt (cached, never scanned)
104+
- <user_input> content → guardContent (scanned by guardrail)
105+
106+
If no <user_input> marker, everything goes as guardContent.
101107
"""
102108
marker = "<user_input>"
103109
idx = prompt.find(marker)
@@ -110,5 +116,6 @@ def _split_prompt(self, prompt):
110116
user_data = prompt[idx:].strip()
111117

112118
if self._guardrail_id:
119+
# guardContent is scanned; the system prompt (with KB/diff) is exempt
113120
return system, [{"guardContent": {"text": {"text": user_data}}}]
114121
return system, [{"text": user_data}]

0 commit comments

Comments
 (0)