Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import pandas as pd
|
|
| 6 |
|
| 7 |
import spaces
|
| 8 |
from agent import graph
|
| 9 |
-
from langchain_core.messages import HumanMessage
|
| 10 |
|
| 11 |
# (Keep Constants as is)
|
| 12 |
# --- Constants ---
|
|
@@ -27,7 +27,14 @@ class BasicAgent:
|
|
| 27 |
print("BasicAgent initialized.")
|
| 28 |
def __call__(self, question: str) -> str:
|
| 29 |
answer = graph.invoke({
|
| 30 |
-
"messages": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
"file_path": None,
|
| 32 |
"url": None,
|
| 33 |
"task_id": None
|
|
|
|
| 6 |
|
| 7 |
import spaces
|
| 8 |
from agent import graph
|
| 9 |
+
from langchain_core.messages import HumanMessage, SystemMessage
|
| 10 |
|
| 11 |
# (Keep Constants as is)
|
| 12 |
# --- Constants ---
|
|
|
|
| 27 |
print("BasicAgent initialized.")
|
| 28 |
def __call__(self, question: str) -> str:
|
| 29 |
answer = graph.invoke({
|
| 30 |
+
"messages": [SystemMessage(content = """
|
| 31 |
+
You are a general AI assistant. I will ask you a question.
|
| 32 |
+
Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
|
| 33 |
+
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 34 |
+
If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
|
| 35 |
+
If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
|
| 36 |
+
If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 37 |
+
"""), HumanMessage(content=question)],
|
| 38 |
"file_path": None,
|
| 39 |
"url": None,
|
| 40 |
"task_id": None
|