Spaces:
Running on Zero
Running on Zero
fix: normalize minicpm xml tool fragments
Browse files
tests/test_model_runtime.py
CHANGED
|
@@ -8,6 +8,7 @@ from hackathon_advisor.model_runtime import (
|
|
| 8 |
render_context,
|
| 9 |
runtime_status,
|
| 10 |
system_prompt,
|
|
|
|
| 11 |
_strip_unused_generation_inputs,
|
| 12 |
)
|
| 13 |
from hackathon_advisor.zerogpu import gpu_task, zero_gpu_duration_seconds, zero_gpu_enabled
|
|
@@ -191,3 +192,9 @@ def test_generation_inputs_drop_token_type_ids() -> None:
|
|
| 191 |
_strip_unused_generation_inputs(inputs)
|
| 192 |
|
| 193 |
assert inputs == {"input_ids": [1], "attention_mask": [1]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
render_context,
|
| 9 |
runtime_status,
|
| 10 |
system_prompt,
|
| 11 |
+
_normalize_xml_tool_output,
|
| 12 |
_strip_unused_generation_inputs,
|
| 13 |
)
|
| 14 |
from hackathon_advisor.zerogpu import gpu_task, zero_gpu_duration_seconds, zero_gpu_enabled
|
|
|
|
| 192 |
_strip_unused_generation_inputs(inputs)
|
| 193 |
|
| 194 |
assert inputs == {"input_ids": [1], "attention_mask": [1]}
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def test_model_xml_fragment_is_normalized() -> None:
|
| 198 |
+
output = 'name="save_idea">{"title":"A","pitch":"B"}'
|
| 199 |
+
|
| 200 |
+
assert _normalize_xml_tool_output(output) == '<function name="save_idea">{"title":"A","pitch":"B"}</function>'
|