diff --git a/guardrails/guard.py b/guardrails/guard.py index 9f95c451d..b41b45af1 100644 --- a/guardrails/guard.py +++ b/guardrails/guard.py @@ -979,7 +979,12 @@ def __call__( """ instructions = instructions or self._exec_opts.instructions prompt = prompt or self._exec_opts.prompt - msg_history = msg_history or kwargs.get("messages", None) or [] + msg_history = ( + msg_history + or kwargs.get("messages", None) + or self._exec_opts.messages + or [] + ) if prompt is None: if msg_history is not None and not len(msg_history): raise RuntimeError( diff --git a/guardrails/schema/rail_schema.py b/guardrails/schema/rail_schema.py index 2aaa04ec4..2071f6b01 100644 --- a/guardrails/schema/rail_schema.py +++ b/guardrails/schema/rail_schema.py @@ -455,7 +455,7 @@ def rail_string_to_schema(rail_string: str) -> ProcessedSchema: role = message.attrib.get("role") content = message.text extracted_reask_messages.append({"role": role, "content": content}) - processed_schema.exec_opts.messages = extracted_reask_messages + processed_schema.exec_opts.reask_messages = extracted_reask_messages return processed_schema