mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-15 14:08:00 +00:00
minor change
This commit is contained in:
parent
3eef4c6d0f
commit
a64451ad42
2 changed files with 8 additions and 8 deletions
|
@ -166,7 +166,8 @@ def test_unsafe_input_with_code_scanner_run_moderation(client_with_models, code_
|
|||
if not code_safety_enabled:
|
||||
pytest.skip(f"Testing code scanner shields is not supported for model_providers {model_providers}")
|
||||
|
||||
insecure_code = """
|
||||
insecure_code = [
|
||||
"""
|
||||
Here is an example of code that hashes a password using MD5:
|
||||
|
||||
```
|
||||
|
@ -176,6 +177,7 @@ def test_unsafe_input_with_code_scanner_run_moderation(client_with_models, code_
|
|||
print("Insecure hashed password:", hashed_password)
|
||||
```
|
||||
"""
|
||||
] * 2
|
||||
moderation_object = client_with_models.moderations.create(
|
||||
input=insecure_code,
|
||||
model=code_scanner_shield_id,
|
||||
|
@ -191,7 +193,8 @@ def test_safe_input_with_code_scanner_run_moderation(client_with_models, code_sc
|
|||
if not code_safety_enabled:
|
||||
pytest.skip(f"Testing code scanner shields is not supported for model_providers {model_providers}")
|
||||
|
||||
secure_code = """
|
||||
secure_code = [
|
||||
"""
|
||||
Extract the first 5 characters from a string:
|
||||
```
|
||||
text = "Hello World"
|
||||
|
@ -203,10 +206,12 @@ def test_safe_input_with_code_scanner_run_moderation(client_with_models, code_sc
|
|||
return text[:5] if text else ""
|
||||
```
|
||||
"""
|
||||
] * 2
|
||||
moderation_object = client_with_models.moderations.create(
|
||||
input=secure_code,
|
||||
model=code_scanner_shield_id,
|
||||
)
|
||||
|
||||
assert moderation_object.results[0].flagged is False, "Code scanner should not have flagged the code as insecure"
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue