Skip to content

Commit 80fc455

Browse files
authoredOct 17, 2024
Merge pull request #1125 from guardrails-ai/bug/rail_msg_history_messages
fix: enable the messages tag in RAIL
2 parents 7d78643 + d889ca0 commit 80fc455

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
 

‎guardrails/guard.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,12 @@ def __call__(
979979
"""
980980
instructions = instructions or self._exec_opts.instructions
981981
prompt = prompt or self._exec_opts.prompt
982-
msg_history = msg_history or kwargs.get("messages", None) or []
982+
msg_history = (
983+
msg_history
984+
or kwargs.get("messages", None)
985+
or self._exec_opts.messages
986+
or []
987+
)
983988
if prompt is None:
984989
if msg_history is not None and not len(msg_history):
985990
raise RuntimeError(

‎guardrails/schema/rail_schema.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def rail_string_to_schema(rail_string: str) -> ProcessedSchema:
455455
role = message.attrib.get("role")
456456
content = message.text
457457
extracted_reask_messages.append({"role": role, "content": content})
458-
processed_schema.exec_opts.messages = extracted_reask_messages
458+
processed_schema.exec_opts.reask_messages = extracted_reask_messages
459459

460460
return processed_schema
461461

0 commit comments

Comments
 (0)
Please sign in to comment.