From 6ab9bc8b2a4fb20cb8ca27851cca9de8c6590e11 Mon Sep 17 00:00:00 2001 From: Nicholas Chen Date: Tue, 2 Jul 2024 16:58:47 -0400 Subject: [PATCH 1/2] add none checks --- guardrails/run/runner.py | 2 +- guardrails/run/stream_runner.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/guardrails/run/runner.py b/guardrails/run/runner.py index eba815973..e9851f3f9 100644 --- a/guardrails/run/runner.py +++ b/guardrails/run/runner.py @@ -238,7 +238,7 @@ def step( try: # Prepare: run pre-processing, and input validation. - if output: + if output is not None: instructions = None prompt = None msg_history = None diff --git a/guardrails/run/stream_runner.py b/guardrails/run/stream_runner.py index 56e7873eb..6e2a84a11 100644 --- a/guardrails/run/stream_runner.py +++ b/guardrails/run/stream_runner.py @@ -116,7 +116,7 @@ def step( call_log.iterations.push(iteration) # Prepare: run pre-processing, and input validation. - if output: + if output is not None: instructions = None prompt = None msg_history = None From bdf902745bf8402aca5e6663a5d995476ad943a5 Mon Sep 17 00:00:00 2001 From: Nicholas Chen Date: Tue, 2 Jul 2024 17:42:29 -0400 Subject: [PATCH 2/2] add none check to async runners as well --- guardrails/run/async_runner.py | 2 +- guardrails/run/async_stream_runner.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/guardrails/run/async_runner.py b/guardrails/run/async_runner.py index 762cfa0d7..2a06ce279 100644 --- a/guardrails/run/async_runner.py +++ b/guardrails/run/async_runner.py @@ -179,7 +179,7 @@ async def async_step( try: # Prepare: run pre-processing, and input validation. - if output: + if output is not None: instructions = None prompt = None msg_history = None diff --git a/guardrails/run/async_stream_runner.py b/guardrails/run/async_stream_runner.py index fc1fd4018..77e730780 100644 --- a/guardrails/run/async_stream_runner.py +++ b/guardrails/run/async_stream_runner.py @@ -161,7 +161,7 @@ async def async_step( outputs = Outputs() iteration = Iteration(inputs=inputs, outputs=outputs) call_log.iterations.push(iteration) - if output: + if output is not None: instructions = None prompt = None msg_history = None