Spaces:
Sleeping
Sleeping
Download tests/test_inference_parser.py from Madhav189/multi-agent-env: direct link, hf CLI and curl.
- Browser
- Download file 955 Bytes
-
https://huggingface.co/spaces/Madhav189/multi-agent-env/resolve/main/tests/test_inference_parser.py
- Command line
-
hf download hf://spaces/Madhav189/multi-agent-env/tests/test_inference_parser.py
-
curl -L -o test_inference_parser.py https://huggingface.co/spaces/Madhav189/multi-agent-env/resolve/main/tests/test_inference_parser.py
955 Bytes
| from __future__ import annotations | |
| from inference import safe_parse_action | |
| def test_safe_parse_action_uses_valid_example_for_placeholder_service() -> None: | |
| action = safe_parse_action( | |
| '{"action_type":"isolate_service","target_service":"service"}', | |
| allowed_actions=["isolate_service(service)", "restart_service(service)"], | |
| valid_action_example={"action_type": "isolate_service", "target_service": "auth_service"}, | |
| ) | |
| assert action.action_type == "isolate_service" | |
| assert action.target_service == "auth_service" | |
| def test_safe_parse_action_salvages_followup_agent_from_example() -> None: | |
| action = safe_parse_action( | |
| "please request_followup(agent)", | |
| allowed_actions=["request_followup(agent)"], | |
| valid_action_example={"action_type": "request_followup", "target_agent": "security"}, | |
| ) | |
| assert action.action_type == "request_followup" | |
| assert action.target_agent == "security" | |