Download python_lora_dataset_builder/tests/test_nim_schema.py from api-relay/sadASDasd: direct link, hf CLI and curl.
- Browser
- Download file 651 Bytes
-
https://huggingface.co/datasets/api-relay/sadASDasd/resolve/main/python_lora_dataset_builder/tests/test_nim_schema.py
- Command line
-
hf download hf://datasets/api-relay/sadASDasd/python_lora_dataset_builder/tests/test_nim_schema.py
-
curl -L -o test_nim_schema.py https://huggingface.co/datasets/api-relay/sadASDasd/resolve/main/python_lora_dataset_builder/tests/test_nim_schema.py
651 Bytes
| from pipeline.nim_schema import validate_nim_response | |
| TOPICS = {"functions", "comprehensions"} | |
| def good(): | |
| return { | |
| "valid": True, | |
| "scores": {"correctness": 95, "instruction_alignment": 94, "quality": 90, "training_value": 92, "scope_fit": 95}, | |
| "overall_score": 93, | |
| "dominant_topic": "functions", | |
| "secondary_topics": [], | |
| "summary": "Defines a function.", | |
| "issues": [], | |
| } | |
| def test_valid_schema(): | |
| assert validate_nim_response(good(), TOPICS)[0] | |
| def test_unknown_topic(): | |
| x = good() | |
| x["dominant_topic"] = "invented_topic" | |
| assert not validate_nim_response(x, TOPICS)[0] | |