Spaces:
Build error
Build error
Update agents.py
Browse files
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
|
| 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 ===
|