| 201 | # ── Test 5: Prompt mode ────────────────────────────────────────────────── |
| 202 | |
| 203 | def test_prompt_mode(): |
| 204 | result = session.tool("generate_object", { |
| 205 | "schema": { |
| 206 | "type": "object", |
| 207 | "required": ["result"], |
| 208 | "properties": { |
| 209 | "result": {"type": "integer"}, |
| 210 | }, |
| 211 | }, |
| 212 | "prompt": "What is 13 * 7? Return the numeric result.", |
| 213 | "schema_name": "math", |
| 214 | "mode": "prompt", |
| 215 | }) |
| 216 | assert result.exit_code == 0, f"Tool failed: {result.output}" |
| 217 | parsed = json.loads(result.output) |
| 218 | assert parsed["object"]["result"] == 91, f"Expected 91, got {parsed['object']['result']}" |
| 219 | print(f" Result: 13*7 = {parsed['object']['result']}") |
| 220 | |
| 221 | run_test("generate_object: prompt mode (math)", test_prompt_mode) |
| 222 | |