Skip to content

Commit c9fc5aa

Browse files
authored
Use correct image for VLLM CPU runtime (#650)
* fix: use right vllm cpu image for disconnected * fix: guardrails tests return empty now if no detections * fix: guardrails fix
1 parent 86fdfac commit c9fc5aa

4 files changed

Lines changed: 33 additions & 19 deletions

File tree

tests/model_explainability/guardrails/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def vllm_runtime(
129129
template_name=RuntimeTemplates.VLLM_CUDA,
130130
deployment_type=KServeDeploymentType.RAW_DEPLOYMENT,
131131
runtime_image="quay.io/rh-aiservices-bu/vllm-cpu-openai-ubi9"
132-
"@sha256:d680ff8becb6bbaf83dfee7b2d9b8a2beb130db7fd5aa7f9a6d8286a58cebbfd",
132+
"@sha256:ada6b3ba98829eb81ae4f89364d9b431c0222671eafb9a04aa16f31628536af2",
133133
containers={
134134
"kserve-container": {
135135
"args": [

tests/model_explainability/guardrails/test_guardrails.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def test_guardrails_builtin_detectors_unsuitable_output(
114114
url=f"https://{guardrails_orchestrator_route.host}{PII_ENDPOINT}{OpenAIEnpoints.CHAT_COMPLETIONS}",
115115
headers=get_auth_headers(token=current_client_token),
116116
json=get_chat_payload(
117-
content="Hi, write three and only three examples of email adresses "
117+
content="Hi, write three and only three examples of email addresses "
118118
"that I can use to create an account for an online service."
119119
"Don't provide any additional explanation."
120120
),

tests/model_explainability/guardrails/utils.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,24 +146,25 @@ def verify_builtin_detector_unsuitable_output_response(
146146

147147
unsuitable_output_warning = "UNSUITABLE_OUTPUT"
148148
warnings = response_data.get("warnings", [])
149-
if len(warnings) != 1:
150-
errors.append(f"Expected 1 warning in response, got {len(warnings)}")
151-
elif warnings[0]["type"] != unsuitable_output_warning:
152-
errors.append(f"Expected warning type {unsuitable_output_warning}, got {warnings[0]['type']}")
153-
154-
output_detections = response_data.get("detections", {}).get("output", [])
155-
156-
if len(output_detections) < 1:
157-
errors.append(f"Expected at least one output detection, but got {len(output_detections)}.")
158-
else:
159-
errors.extend(
160-
verify_detection(
161-
detections_list=output_detections,
162-
detector_id=detector_id,
163-
detection_name=detection_name,
164-
detection_type=detection_type,
149+
if warnings is not None:
150+
if len(warnings) != 1:
151+
errors.append(f"Expected 1 warning in response, got {len(warnings)}")
152+
elif warnings[0]["type"] != unsuitable_output_warning:
153+
errors.append(f"Expected warning type {unsuitable_output_warning}, got {warnings[0]['type']}")
154+
output_detections = response_data.get("detections", {})
155+
if output_detections is not None:
156+
output_detections = output_detections.get("output", [])
157+
if len(output_detections) < 1:
158+
errors.append(f"Expected at least one output detection, but got {len(output_detections)}.")
159+
else:
160+
errors.extend(
161+
verify_detection(
162+
detections_list=output_detections,
163+
detector_id=detector_id,
164+
detection_name=detection_name,
165+
detection_type=detection_type,
166+
)
165167
)
166-
)
167168

168169
assert_no_errors(errors=errors, failure_message_prefix="Unsuitable output detection verification failed")
169170

tests/model_explainability/lm_eval/conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ def lmeval_minio_copy_pod(
325325
"command": ["/bin/sh", "-c"],
326326
"args": ["cp -r /mnt/data /shared"],
327327
"volumeMounts": [{"name": "shared-data", "mountPath": "/shared"}],
328+
"securityContext": {
329+
"allowPrivilegeEscalation": False,
330+
"capabilities": {"drop": ["ALL"]},
331+
"runAsNonRoot": True,
332+
"seccompProfile": {"type": "RuntimeDefault"},
333+
},
328334
}
329335
],
330336
containers=[
@@ -338,7 +344,14 @@ def lmeval_minio_copy_pod(
338344
"mc mb --ignore-existing myminio/models &&\n"
339345
"mc cp --recursive /shared/data/ myminio/models"
340346
],
347+
"env": [{"name": "MC_CONFIG_DIR", "value": "/tmp/.mc"}],
341348
"volumeMounts": [{"name": "shared-data", "mountPath": "/shared"}],
349+
"securityContext": {
350+
"allowPrivilegeEscalation": False,
351+
"capabilities": {"drop": ["ALL"]},
352+
"runAsNonRoot": True,
353+
"seccompProfile": {"type": "RuntimeDefault"},
354+
},
342355
}
343356
],
344357
wait_for_resource=True,

0 commit comments

Comments
 (0)