Spaces:
Sleeping
Sleeping
Daniel Amendoeira
commited on
Update agent.py
Browse files
agent.py
CHANGED
@@ -102,8 +102,18 @@ class LangGraphAgent:
|
|
102 |
print("LangGraphAgent initialized.")
|
103 |
|
104 |
def __call__(self, question: str) -> str:
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
result = gaia_agent.invoke(input_state, {"recursion_limit": 30}) # prevents infinite looping when the LLM keeps calling tools over and over
|
108 |
final_response = result["messages"][-1].content
|
109 |
|
|
|
102 |
print("LangGraphAgent initialized.")
|
103 |
|
104 |
def __call__(self, question: str) -> str:
|
105 |
+
# prepare the initial user message
|
106 |
+
input_state = {
|
107 |
+
"messages": [
|
108 |
+
{
|
109 |
+
"role: "user",
|
110 |
+
"content": [
|
111 |
+
{"type": "text", "text": question}
|
112 |
+
]
|
113 |
+
}
|
114 |
+
]
|
115 |
+
|
116 |
+
print(f"Running LangGraphAgent with input: {question[:200]}...")
|
117 |
result = gaia_agent.invoke(input_state, {"recursion_limit": 30}) # prevents infinite looping when the LLM keeps calling tools over and over
|
118 |
final_response = result["messages"][-1].content
|
119 |
|