Skip to content

Commit

Permalink
Add additional test in the yaml example
Browse files Browse the repository at this point in the history
  • Loading branch information
naddeoa committed Jan 27, 2024
1 parent e70d3a5 commit d3862dc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/configure_container_yaml/test/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,36 @@ def test_prompt_char_count_134(client: AuthenticatedClient):
assert actual == expected


def test_prompt_char_count_139(client: AuthenticatedClient):
request = LLMValidateRequest(
prompt="?",
response="I'm sorry you feel that way.",
dataset_id="model-139",
)

response = ValidateLLM.sync_detailed(client=client, body=request)

if not isinstance(response.parsed, ValidationResult):
raise Exception(f"Failed to validate data. Status code: {response.status_code}. {response.parsed}")

actual: ValidationResult = response.parsed

expected = ValidationResult(
report=[
ValidationFailure(
id=0,
metric="prompt.char_count",
details="Value 1 is below threshold 2.0",
value=1,
upper_threshold=None,
lower_threshold=2.0,
)
],
)

assert actual == expected


def test_prompt_sentiment_134(client: AuthenticatedClient):
request = LLMValidateRequest(
prompt="This prompt sucks, and this llm sucks, and everything sucks.",
Expand Down

0 comments on commit d3862dc

Please sign in to comment.