Skip to content

Commit e76f2ab

Browse files
committed
test
1 parent ad89019 commit e76f2ab

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

  • testcases/company-research-agent/src

testcases/company-research-agent/src/graph.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import json
22
import logging
3-
import sys
4-
from pathlib import Path
53
from typing import Any
64

75
from langchain.agents import create_agent
@@ -14,16 +12,17 @@
1412

1513
logger = logging.getLogger(__name__)
1614

17-
# Monkey-patch to dump raw response to file on failure
15+
# Monkey-patch to surface raw response on failure
1816
_original_postprocess = _NormalizedChat._postprocess_response
19-
_debug_file = Path(__file__).resolve().parent.parent / "debug_response.json"
2017

2118
def _debug_postprocess(self: Any, response: dict[str, Any]) -> Any:
2219
if "choices" not in response:
2320
dump = json.dumps(response, indent=2, default=str)
24-
_debug_file.write_text(dump)
25-
sys.stderr.write(f"\n\n===== DEBUG RAW RESPONSE (no 'choices' key) =====\n{dump}\n=====\n\n")
26-
sys.stderr.flush()
21+
raise ValueError(
22+
f"LLM response missing 'choices' key. "
23+
f"Got keys: {list(response.keys())}. "
24+
f"Full response: {dump}"
25+
)
2726
return _original_postprocess(self, response)
2827

2928
_NormalizedChat._postprocess_response = _debug_postprocess

0 commit comments

Comments
 (0)