Replace assistant calling with graph invoke
Browse files
app.py
CHANGED
|
@@ -59,10 +59,10 @@ class BasicAgent:
|
|
| 59 |
def __call__(self, question: str) -> Tuple[str, TypedDict]:
|
| 60 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 61 |
state = State(question=question, messages=[HumanMessage(content=question)])
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
print(f"Agent returning fixed answer: {
|
| 65 |
-
return
|
| 66 |
|
| 67 |
def assistant(self, state: State):
|
| 68 |
# System message
|
|
|
|
| 59 |
def __call__(self, question: str) -> Tuple[str, TypedDict]:
|
| 60 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 61 |
state = State(question=question, messages=[HumanMessage(content=question)])
|
| 62 |
+
result = self.compiled_graph.invoke(state)
|
| 63 |
+
final_answer = result["messages"][-1].content
|
| 64 |
+
print(f"Agent returning fixed answer: {final_answer}")
|
| 65 |
+
return final_answer, result["messages"]
|
| 66 |
|
| 67 |
def assistant(self, state: State):
|
| 68 |
# System message
|