Spaces:
Sleeping
Sleeping
EtienneB
commited on
Commit
·
ee8ec64
1
Parent(s):
0e742d5
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,9 +19,15 @@ class BasicAgent:
|
|
| 19 |
self.graph = build_graph()
|
| 20 |
def __call__(self, question: str) -> str:
|
| 21 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 27 |
"""
|
|
|
|
| 19 |
self.graph = build_graph()
|
| 20 |
def __call__(self, question: str) -> str:
|
| 21 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 22 |
+
# Wrap the question in a HumanMessage from langchain_core
|
| 23 |
+
messages = [HumanMessage(content=question)]
|
| 24 |
+
# The graph.invoke method takes a dictionary with the key "messages"
|
| 25 |
+
# and returns a dictionary with the processed messages.
|
| 26 |
+
response_messages = self.graph.invoke({"messages": messages})
|
| 27 |
+
# The answer is expected to be in the 'content' of the last message.
|
| 28 |
+
answer = response_messages['messages'][-1].content
|
| 29 |
+
print(f"Agent full response: {answer}")
|
| 30 |
+
return answer
|
| 31 |
|
| 32 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 33 |
"""
|