Rudraprasad commited on
Commit
f0bc20c
·
verified ·
1 Parent(s): 0c467b0

Update agents.py

Browse files
Files changed (1) hide show
  1. agents.py +3 -1
agents.py CHANGED
@@ -14,11 +14,13 @@ from smolagents import CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool, Wikipe
14
  from langchain_groq import ChatGroq
15
 
16
  # === WRAPPER CLASS TO FIX 'content' ERROR ===
 
 
17
  class WrappedChatGroq(ChatGroq):
18
  def invoke(self, *args, **kwargs):
19
  result = super().invoke(*args, **kwargs)
20
  if isinstance(result, dict) and "content" in result:
21
- return SimpleNamespace(content=result["content"])
22
  return result
23
 
24
  # === TOOLS ===
 
14
  from langchain_groq import ChatGroq
15
 
16
  # === WRAPPER CLASS TO FIX 'content' ERROR ===
17
+ from langchain_core.messages import AIMessage # <-- import AIMessage
18
+
19
  class WrappedChatGroq(ChatGroq):
20
  def invoke(self, *args, **kwargs):
21
  result = super().invoke(*args, **kwargs)
22
  if isinstance(result, dict) and "content" in result:
23
+ return AIMessage(content=result["content"])
24
  return result
25
 
26
  # === TOOLS ===