Skip to content

Commit 0703719

Browse files
committed
test
1 parent 1868a76 commit 0703719

File tree

1 file changed

+17
-0
lines changed
  • testcases/company-research-agent/src

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1+
import logging
2+
from typing import Any
3+
14
from langchain.agents import create_agent
25
from langchain_community.tools import DuckDuckGoSearchResults
36
from langgraph.graph import END, START, MessagesState, StateGraph
47
from pydantic import BaseModel
8+
from uipath_langchain_client.clients.normalized.chat_models import UiPathChat as _NormalizedChat
59

610
from uipath_langchain.chat import UiPathChat
711

12+
logger = logging.getLogger(__name__)
13+
14+
# Monkey-patch to log raw response on failure
15+
_original_postprocess = _NormalizedChat._postprocess_response
16+
17+
def _debug_postprocess(self: Any, response: dict[str, Any]) -> Any:
18+
if "choices" not in response:
19+
logger.error("RAW RESPONSE (no 'choices' key): %s", response)
20+
print(f"DEBUG RAW RESPONSE: {response}")
21+
return _original_postprocess(self, response)
22+
23+
_NormalizedChat._postprocess_response = _debug_postprocess
24+
825
# Configuration constants
926

1027

0 commit comments

Comments
 (0)