mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-02 00:34:44 +00:00
chore: simplify true/false evaluation of input/output shields
This code was unnecessarily verbose when calculating has_input_shield and has_output_shield values, and was simplified to take advantage of Python's intrinsic treatment of empty lists and None values as false. Signed-off-by: Ben Browning <bbrownin@redhat.com>
This commit is contained in:
parent
b3493ee94f
commit
18c2494259
1 changed files with 2 additions and 2 deletions
|
@ -698,8 +698,8 @@ def test_multi_tool_calls(llama_stack_client, agent_config):
|
||||||
)
|
)
|
||||||
steps = response.steps
|
steps = response.steps
|
||||||
|
|
||||||
has_input_shield = True if agent_config.get("input_shields", None) else False
|
has_input_shield = agent_config.get("input_shields")
|
||||||
has_output_shield = True if agent_config.get("output_shields", None) else False
|
has_output_shield = agent_config.get("output_shields")
|
||||||
assert len(steps) == 3 + (2 if has_input_shield else 0) + (2 if has_output_shield else 0)
|
assert len(steps) == 3 + (2 if has_input_shield else 0) + (2 if has_output_shield else 0)
|
||||||
if has_input_shield:
|
if has_input_shield:
|
||||||
assert steps[0].step_type == "shield_call"
|
assert steps[0].step_type == "shield_call"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue