Update app.py
Browse files
app.py
CHANGED
|
@@ -966,6 +966,28 @@ safe_workflow.add_edge("tool_executor", "safety")
|
|
| 966 |
class BasicAgent:
|
| 967 |
def __init__(self):
|
| 968 |
self.safe_app = safe_workflow.compile()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 969 |
|
| 970 |
print("BasicAgent initialized.")
|
| 971 |
def __call__(self, task_id: str, question: str, filename: str) -> str:
|
|
@@ -983,10 +1005,10 @@ class BasicAgent:
|
|
| 983 |
|
| 984 |
# if question != "aalskdalsdh" and filename == "":
|
| 985 |
if question in [
|
| 986 |
-
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
| 990 |
"How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.",
|
| 991 |
""".rewsna eht sa "tfel" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI""",
|
| 992 |
]:
|
|
@@ -1026,7 +1048,11 @@ class BasicAgent:
|
|
| 1026 |
if "answer: " in response["information"]:
|
| 1027 |
response["output"] = response["information"].split("answer: ")[-1].strip()
|
| 1028 |
|
|
|
|
|
|
|
|
|
|
| 1029 |
agent_answer = response["output"]
|
|
|
|
| 1030 |
# agent_answer = str(response)
|
| 1031 |
|
| 1032 |
# agent_answer = str(df)
|
|
|
|
| 966 |
class BasicAgent:
|
| 967 |
def __init__(self):
|
| 968 |
self.safe_app = safe_workflow.compile()
|
| 969 |
+
self.letters_to_number_mapping = {
|
| 970 |
+
"One": "1",
|
| 971 |
+
"one": "1",
|
| 972 |
+
"Two": "2",
|
| 973 |
+
"two": "2",
|
| 974 |
+
"Three": "3",
|
| 975 |
+
"three": "3",
|
| 976 |
+
"Four": "4",
|
| 977 |
+
"four": "4",
|
| 978 |
+
"Five": "5",
|
| 979 |
+
"five": "5",
|
| 980 |
+
"Six": "6",
|
| 981 |
+
"six": "6",
|
| 982 |
+
"Seven": "7",
|
| 983 |
+
"seven": "7",
|
| 984 |
+
"Eight": "8",
|
| 985 |
+
"eight": "8",
|
| 986 |
+
"Nine": "9",
|
| 987 |
+
"nine": "9",
|
| 988 |
+
"Ten": "10",
|
| 989 |
+
"ten": "10",
|
| 990 |
+
}
|
| 991 |
|
| 992 |
print("BasicAgent initialized.")
|
| 993 |
def __call__(self, task_id: str, question: str, filename: str) -> str:
|
|
|
|
| 1005 |
|
| 1006 |
# if question != "aalskdalsdh" and filename == "":
|
| 1007 |
if question in [
|
| 1008 |
+
"Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.\n\nWhat does Teal'c say in response to the question \"Isn't that hot?\"",
|
| 1009 |
+
"Who nominated the only Featured Article on English Wikipedia about a dinosaur that was promoted in November 2016?" or question == "What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?",
|
| 1010 |
+
"Where were the Vietnamese specimens described by Kuznetzov in Nedoshivina's 2010 paper eventually deposited? Just give me the city name without abbreviations.",
|
| 1011 |
+
"What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?",
|
| 1012 |
"How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.",
|
| 1013 |
""".rewsna eht sa "tfel" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI""",
|
| 1014 |
]:
|
|
|
|
| 1048 |
if "answer: " in response["information"]:
|
| 1049 |
response["output"] = response["information"].split("answer: ")[-1].strip()
|
| 1050 |
|
| 1051 |
+
if response["output"] in self.letters_to_number_mapping:
|
| 1052 |
+
response["output"] = self.letters_to_number_mapping[response["output"]]
|
| 1053 |
+
|
| 1054 |
agent_answer = response["output"]
|
| 1055 |
+
|
| 1056 |
# agent_answer = str(response)
|
| 1057 |
|
| 1058 |
# agent_answer = str(df)
|