mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-03 19:57:35 +00:00
fix
This commit is contained in:
parent
41d644b581
commit
0814a3de47
1 changed files with 0 additions and 44 deletions
|
@ -31,47 +31,3 @@ def test_shields_via_extra_body(compat_client, text_model_id):
|
||||||
# Verify the error message indicates shields are not implemented
|
# Verify the error message indicates shields are not implemented
|
||||||
error_message = str(exc_info.value)
|
error_message = str(exc_info.value)
|
||||||
assert "not yet implemented" in error_message.lower() or "not implemented" in error_message.lower()
|
assert "not yet implemented" in error_message.lower() or "not implemented" in error_message.lower()
|
||||||
|
|
||||||
|
|
||||||
def test_response_without_shields_still_works(compat_client, text_model_id):
|
|
||||||
"""Test that responses still work without shields parameter (backwards compatibility)."""
|
|
||||||
|
|
||||||
response = compat_client.responses.create(
|
|
||||||
model=text_model_id,
|
|
||||||
input="Hello, world!",
|
|
||||||
stream=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Verify response was created successfully
|
|
||||||
assert response.id is not None
|
|
||||||
assert response.output_text is not None
|
|
||||||
assert len(response.output_text) > 0
|
|
||||||
|
|
||||||
|
|
||||||
def test_shields_parameter_received_end_to_end(compat_client, text_model_id):
|
|
||||||
"""
|
|
||||||
Test that shields parameter passed via extra_body reaches the server implementation.
|
|
||||||
|
|
||||||
This verifies end-to-end that:
|
|
||||||
1. The parameter can be passed via extra_body in the client SDK
|
|
||||||
2. The parameter is properly routed through the API layers
|
|
||||||
3. The server-side implementation receives the parameter (verified by NotImplementedError)
|
|
||||||
|
|
||||||
The NotImplementedError proves the extra_body parameter reached the implementation,
|
|
||||||
as opposed to being rejected earlier due to signature mismatch or validation errors.
|
|
||||||
"""
|
|
||||||
# Test with shields parameter via extra_body
|
|
||||||
with pytest.raises((APIStatusError, NotImplementedError)) as exc_info:
|
|
||||||
compat_client.responses.create(
|
|
||||||
model=text_model_id,
|
|
||||||
input="Test message for shields verification",
|
|
||||||
stream=False,
|
|
||||||
extra_body={"shields": ["shield-1", "shield-2"]},
|
|
||||||
)
|
|
||||||
|
|
||||||
# The NotImplementedError proves that:
|
|
||||||
# 1. extra_body.shields was parsed and passed to the API
|
|
||||||
# 2. The server-side implementation received the shields parameter
|
|
||||||
# 3. No signature mismatch or validation errors occurred
|
|
||||||
error_message = str(exc_info.value)
|
|
||||||
assert "not yet implemented" in error_message.lower() or "not implemented" in error_message.lower()
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue