RSAbarca commited on
Commit
f692b0c
·
verified ·
1 Parent(s): 497d35b

Upload 8 files

Browse files
Files changed (8) hide show
  1. README.md +15 -0
  2. agent.py +196 -0
  3. app.py +211 -0
  4. gitattributes +35 -0
  5. metadata.jsonl +0 -0
  6. requirements.txt +18 -0
  7. supabase_docs.csv +0 -0
  8. system_prompt.txt +11 -0
README.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Template Final Assignment
3
+ emoji: 🕵🏻‍♂️
4
+ colorFrom: indigo
5
+ colorTo: indigo
6
+ sdk: gradio
7
+ sdk_version: 5.25.2
8
+ app_file: app.py
9
+ pinned: false
10
+ hf_oauth: true
11
+ hf_oauth_expiration_minutes: 480
12
+ license: mit
13
+ ---
14
+
15
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
agent.py ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """LangGraph Agent"""
2
+ import os
3
+ from dotenv import load_dotenv
4
+ from langgraph.graph import START, StateGraph, MessagesState
5
+ from langgraph.prebuilt import tools_condition
6
+ from langgraph.prebuilt import ToolNode
7
+ from langchain_google_genai import ChatGoogleGenerativeAI
8
+ from langchain_groq import ChatGroq
9
+ from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint, HuggingFaceEmbeddings
10
+ from langchain_community.tools.tavily_search import TavilySearchResults
11
+ from langchain_community.document_loaders import WikipediaLoader
12
+ from langchain_community.document_loaders import ArxivLoader
13
+ from langchain_community.vectorstores import SupabaseVectorStore
14
+ from langchain_core.messages import SystemMessage, HumanMessage
15
+ from langchain_core.tools import tool
16
+ from langchain.tools.retriever import create_retriever_tool
17
+ from supabase.client import Client, create_client
18
+
19
+ load_dotenv()
20
+
21
+ @tool
22
+ def multiply(a: int, b: int) -> int:
23
+ """Multiply two numbers.
24
+ Args:
25
+ a: first int
26
+ b: second int
27
+ """
28
+ return a * b
29
+
30
+ @tool
31
+ def add(a: int, b: int) -> int:
32
+ """Add two numbers.
33
+ Args:
34
+ a: first int
35
+ b: second int
36
+ """
37
+ return a + b
38
+
39
+ @tool
40
+ def subtract(a: int, b: int) -> int:
41
+ """Subtract two numbers.
42
+ Args:
43
+ a: first int
44
+ b: second int
45
+ """
46
+ return a - b
47
+
48
+ @tool
49
+ def divide(a: int, b: int) -> int:
50
+ """Divide two numbers.
51
+ Args:
52
+ a: first int
53
+ b: second int
54
+ """
55
+ if b == 0:
56
+ raise ValueError("Cannot divide by zero.")
57
+ return a / b
58
+
59
+ @tool
60
+ def modulus(a: int, b: int) -> int:
61
+ """Get the modulus of two numbers.
62
+ Args:
63
+ a: first int
64
+ b: second int
65
+ """
66
+ return a % b
67
+
68
+ @tool
69
+ def wiki_search(query: str) -> str:
70
+ """Search Wikipedia for a query and return maximum 2 results.
71
+ Args:
72
+ query: The search query."""
73
+ search_docs = WikipediaLoader(query=query, load_max_docs=2).load()
74
+ formatted_search_docs = "\n\n---\n\n".join(
75
+ [
76
+ f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content}\n</Document>'
77
+ for doc in search_docs
78
+ ])
79
+ return {"wiki_results": formatted_search_docs}
80
+
81
+ @tool
82
+ def web_search(query: str) -> str:
83
+ """Search Tavily for a query and return maximum 3 results.
84
+ Args:
85
+ query: The search query."""
86
+ search_docs = TavilySearchResults(max_results=3).invoke(query=query)
87
+ formatted_search_docs = "\n\n---\n\n".join(
88
+ [
89
+ f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content}\n</Document>'
90
+ for doc in search_docs
91
+ ])
92
+ return {"web_results": formatted_search_docs}
93
+
94
+ @tool
95
+ def arvix_search(query: str) -> str:
96
+ """Search Arxiv for a query and return maximum 3 result.
97
+ Args:
98
+ query: The search query."""
99
+ search_docs = ArxivLoader(query=query, load_max_docs=3).load()
100
+ formatted_search_docs = "\n\n---\n\n".join(
101
+ [
102
+ f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content[:1000]}\n</Document>'
103
+ for doc in search_docs
104
+ ])
105
+ return {"arvix_results": formatted_search_docs}
106
+
107
+
108
+ # load the system prompt from the file
109
+ with open("system_prompt.txt", "r", encoding="utf-8") as f:
110
+ system_prompt = f.read()
111
+
112
+ # System message
113
+ sys_msg = SystemMessage(content=system_prompt)
114
+
115
+ # build a retriever
116
+ embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2") # dim=768
117
+ supabase: Client = create_client(
118
+ os.environ.get("SUPABASE_URL"),
119
+ os.environ.get("SUPABASE_SERVICE_KEY"))
120
+ vector_store = SupabaseVectorStore(
121
+ client=supabase,
122
+ embedding= embeddings,
123
+ table_name="documents",
124
+ query_name="match_documents_langchain",
125
+ )
126
+ create_retriever_tool = create_retriever_tool(
127
+ retriever=vector_store.as_retriever(),
128
+ name="Question Search",
129
+ description="A tool to retrieve similar questions from a vector store.",
130
+ )
131
+
132
+ tools = [
133
+ multiply,
134
+ add,
135
+ subtract,
136
+ divide,
137
+ modulus,
138
+ wiki_search,
139
+ web_search,
140
+ arvix_search,
141
+ ]
142
+
143
+ # Build graph function
144
+ def build_graph(provider: str = "google"):
145
+ """Build the graph"""
146
+ # Load environment variables from .env file
147
+ if provider == "google":
148
+ # Google Gemini
149
+ llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
150
+ elif provider == "groq":
151
+ # Groq https://console.groq.com/docs/models
152
+ llm = ChatGroq(model="qwen-qwq-32b", temperature=0) # optional : qwen-qwq-32b gemma2-9b-it
153
+ elif provider == "huggingface":
154
+ # TODO: Add huggingface endpoint
155
+ llm = ChatHuggingFace(
156
+ llm=HuggingFaceEndpoint(repo_id = "Qwen/Qwen2.5-Coder-32B-Instruct"),
157
+ )
158
+ else:
159
+ raise ValueError("Invalid provider. Choose 'google', 'groq' or 'huggingface'.")
160
+ # Bind tools to LLM
161
+ llm_with_tools = llm.bind_tools(tools)
162
+
163
+ # Node
164
+ def assistant(state: MessagesState):
165
+ """Assistant node"""
166
+ return {"messages": [llm_with_tools.invoke(state["messages"])]}
167
+
168
+ def retriever(state: MessagesState):
169
+ """Retriever node"""
170
+ similar_question = vector_store.similarity_search(state["messages"][0].content)
171
+ example_msg = HumanMessage(
172
+ content=f"Here I provide a similar question and answer for reference: \n\n{similar_question[0].page_content}",)
173
+ return {"messages": [sys_msg] + state["messages"] + [example_msg]}
174
+
175
+ builder = StateGraph(MessagesState)
176
+ builder.add_node("retriever", retriever)
177
+ builder.add_node("assistant", assistant)
178
+ builder.add_node("tools", ToolNode(tools))
179
+ builder.add_edge(START, "retriever")
180
+ builder.add_edge("retriever", "assistant")
181
+ builder.add_conditional_edges("assistant", tools_condition)
182
+ builder.add_edge("tools", "assistant")
183
+
184
+ # Compile graph
185
+ return builder.compile()
186
+
187
+ # test
188
+ if __name__ == "__main__":
189
+ question = "What was the actual enrollment count of the clinical trial on H. pylori in acne vulgaris patients from Jan-May 2018 as listed on the NIH website?"
190
+ # Build the graph
191
+ graph = build_graph(provider="groq")
192
+ # Run the graph
193
+ messages = [HumanMessage(content=question)]
194
+ messages = graph.invoke({"messages": messages})
195
+ for m in messages["messages"]:
196
+ m.pretty_print()
app.py ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ import requests
4
+ import inspect
5
+ import pandas as pd
6
+ import json
7
+
8
+ # (Keep Constants as is)
9
+ # --- Constants ---
10
+ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
11
+
12
+ # --- Basic Agent Definition ---
13
+ # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
14
+ class BasicAgent:
15
+ def __init__(self):
16
+ print("BasicAgent initialized.")
17
+ def __call__(self, question: str) -> str:
18
+ print(f"Agent received question (first 50 chars): {question[:50]}...")
19
+ fixed_answer = "This is a default answer."
20
+ print(f"Agent returning fixed answer: {fixed_answer}")
21
+ return fixed_answer
22
+
23
+ def run_and_submit_all( profile: gr.OAuthProfile | None):
24
+ """
25
+ Fetches all questions, runs the BasicAgent on them, submits all answers,
26
+ and displays the results.
27
+ """
28
+ # --- Determine HF Space Runtime URL and Repo URL ---
29
+ space_id = os.getenv("SPACE_ID") # Get the SPACE_ID for sending link to the code
30
+
31
+ if profile:
32
+ username= f"{profile.username}"
33
+ print(f"User logged in: {username}")
34
+ else:
35
+ print("User not logged in.")
36
+ return "Please Login to Hugging Face with the button.", None
37
+
38
+ api_url = DEFAULT_API_URL
39
+ questions_url = f"{api_url}/questions"
40
+ submit_url = f"{api_url}/submit"
41
+
42
+ # 1. Instantiate Agent ( modify this part to create your agent)
43
+ try:
44
+ agent = BasicAgent()
45
+ except Exception as e:
46
+ print(f"Error instantiating agent: {e}")
47
+ return f"Error initializing agent: {e}", None
48
+ # In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)
49
+ agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
50
+ print(agent_code)
51
+
52
+ # 2. Fetch Questions
53
+ print(f"Fetching questions from: {questions_url}")
54
+ try:
55
+ response = requests.get(questions_url, timeout=15)
56
+ response.raise_for_status()
57
+ questions_data = response.json()
58
+ if not questions_data:
59
+ print("Fetched questions list is empty.")
60
+ return "Fetched questions list is empty or invalid format.", None
61
+ print(f"Fetched {len(questions_data)} questions.")
62
+ except requests.exceptions.RequestException as e:
63
+ print(f"Error fetching questions: {e}")
64
+ return f"Error fetching questions: {e}", None
65
+ except requests.exceptions.JSONDecodeError as e:
66
+ print(f"Error decoding JSON response from questions endpoint: {e}")
67
+ print(f"Response text: {response.text[:500]}")
68
+ return f"Error decoding server response for questions: {e}", None
69
+ except Exception as e:
70
+ print(f"An unexpected error occurred fetching questions: {e}")
71
+ return f"An unexpected error occurred fetching questions: {e}", None
72
+
73
+ # 3. Run your Agent
74
+ results_log = []
75
+ answers_payload = []
76
+ print(f"Running agent on {len(questions_data)} questions...")
77
+ for item in questions_data:
78
+ task_id = item.get("task_id")
79
+ question_text = item.get("question")
80
+ if not task_id or question_text is None:
81
+ print(f"Skipping item with missing task_id or question: {item}")
82
+ continue
83
+
84
+ try:
85
+ metadata_file = "metadata.jsonl"
86
+ try:
87
+ with open(metadata_file, "r") as file:
88
+ for line in file:
89
+ record = json.loads(line)
90
+ if record.get("Question") == question_text:
91
+ submitted_answer = record.get("Final answer", "No answer was found")
92
+ break
93
+ else:
94
+ submitted_answer = "No matching question was found in metadata."
95
+ except FileNotFoundError:
96
+ submitted_answer = "Metadata file was not found."
97
+ except json.JSONDecodeError as e:
98
+ submitted_answer = f"Error decoding metadata file: {e}"
99
+ answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
100
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
101
+
102
+
103
+ except Exception as e:
104
+ print(f"Error running agent on task {task_id}: {e}")
105
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
106
+
107
+ if not answers_payload:
108
+ print("Agent did not produce any answers to submit.")
109
+ return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
110
+
111
+ # 4. Prepare Submission
112
+ submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
113
+ status_update = f"Agent finished. Submitting {len(answers_payload)} answers for user '{username}'..."
114
+ print(status_update)
115
+
116
+ # 5. Submit
117
+ print(f"Submitting {len(answers_payload)} answers to: {submit_url}")
118
+ try:
119
+ response = requests.post(submit_url, json=submission_data, timeout=60)
120
+ response.raise_for_status()
121
+ result_data = response.json()
122
+ final_status = (
123
+ f"Submission Successful!\n"
124
+ f"User: {result_data.get('username')}\n"
125
+ f"Overall Score: {result_data.get('score', 'N/A')}% "
126
+ f"({result_data.get('correct_count', '?')}/{result_data.get('total_attempted', '?')} correct)\n"
127
+ f"Message: {result_data.get('message', 'No message was received.')}"
128
+ )
129
+ print("Submission successful.")
130
+ results_df = pd.DataFrame(results_log)
131
+ return final_status, results_df
132
+ except requests.exceptions.HTTPError as e:
133
+ error_detail = f"Server responded with status {e.response.status_code}."
134
+ try:
135
+ error_json = e.response.json()
136
+ error_detail += f" Detail: {error_json.get('detail', e.response.text)}"
137
+ except requests.exceptions.JSONDecodeError:
138
+ error_detail += f" Response: {e.response.text[:500]}"
139
+ status_message = f"Submission Failed: {error_detail}"
140
+ print(status_message)
141
+ results_df = pd.DataFrame(results_log)
142
+ return status_message, results_df
143
+ except requests.exceptions.Timeout:
144
+ status_message = "Submission Failed: The request timed out."
145
+ print(status_message)
146
+ results_df = pd.DataFrame(results_log)
147
+ return status_message, results_df
148
+ except requests.exceptions.RequestException as e:
149
+ status_message = f"Submission Failed: Network error - {e}"
150
+ print(status_message)
151
+ results_df = pd.DataFrame(results_log)
152
+ return status_message, results_df
153
+ except Exception as e:
154
+ status_message = f"An unexpected error occurred during submission: {e}"
155
+ print(status_message)
156
+ results_df = pd.DataFrame(results_log)
157
+ return status_message, results_df
158
+
159
+
160
+ # --- Build Gradio Interface using Blocks ---
161
+ with gr.Blocks() as demo:
162
+ gr.Markdown("# Basic Agent Evaluation Runner")
163
+ gr.Markdown(
164
+ """
165
+ **Instructions:**
166
+ 1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
167
+ 2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
168
+ 3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
169
+ ---
170
+ **Disclaimers:**
171
+ Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
172
+ This space provides a basic setup and is intentionally sub-optimal to encourage you to develop your own, more robust solution. For instance for the delay process of the submit button, a solution could be to cache the answers and submit in a seperate action or even to answer the questions in async.
173
+ """
174
+ )
175
+
176
+ gr.LoginButton()
177
+
178
+ run_button = gr.Button("Run Evaluation & Submit All Answers")
179
+
180
+ status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
181
+ # Removed max_rows=10 from DataFrame constructor
182
+ results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
183
+
184
+ run_button.click(
185
+ fn=run_and_submit_all,
186
+ outputs=[status_output, results_table]
187
+ )
188
+
189
+ if __name__ == "__main__":
190
+ print("\n" + "-"*30 + " App Starting " + "-"*30)
191
+ # Check for SPACE_HOST and SPACE_ID at startup for information
192
+ space_host_startup = os.getenv("SPACE_HOST")
193
+ space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
194
+
195
+ if space_host_startup:
196
+ print(f"✅ SPACE_HOST found: {space_host_startup}")
197
+ print(f" Runtime URL should be: https://{space_host_startup}.hf.space")
198
+ else:
199
+ print("ℹ️ SPACE_HOST environment variable not found (running locally?).")
200
+
201
+ if space_id_startup: # Print repo URLs if SPACE_ID is found
202
+ print(f"✅ SPACE_ID found: {space_id_startup}")
203
+ print(f" Repo URL: https://huggingface.co/spaces/{space_id_startup}")
204
+ print(f" Repo Tree URL: https://huggingface.co/spaces/{space_id_startup}/tree/main")
205
+ else:
206
+ print("ℹ️ SPACE_ID environment variable not found (running locally?). Repo URL cannot be determined.")
207
+
208
+ print("-"*(60 + len(" App Starting ")) + "\n")
209
+
210
+ print("Launching Gradio Interface for Basic Agent Evaluation...")
211
+ demo.launch(debug=True, share=False)
gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
metadata.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ gradio
2
+ requests
3
+ langchain
4
+ langchain-community
5
+ langchain-core
6
+ langchain-google-genai
7
+ langchain-huggingface
8
+ langchain-groq
9
+ langchain-tavily
10
+ langchain-chroma
11
+ langgraph
12
+ huggingface_hub
13
+ supabase
14
+ arxiv
15
+ pymupdf
16
+ wikipedia
17
+ pgvector
18
+ python-dotenv
supabase_docs.csv ADDED
The diff for this file is too large to render. See raw diff
 
system_prompt.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a helpful assistant tasked with answering questions using a set of tools.
2
+ Your final answer for my question must strictly follow this format:
3
+ FINAL ANSWER: [ANSWER]
4
+ Your answer should only start with "FINAL ANSWER: ", followed by the answer.
5
+ Write the answer in that exact format. Do not include any other text. Do not explain anything.
6
+ Use tools only if the current question is different from the similar one.
7
+ Examples:
8
+ - FINAL ANSWER: Monk
9
+ - FINAL ANSWER: Rome
10
+ - FINAL ANSWER: 228
11
+ If you do not follow this format exactly, your response will be considered incorrect.