Orel MAZOR commited on
Commit
e5ebf3f
·
1 Parent(s): 3cce64e
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
.github/workflows/sync_to_hf_space.yml DELETED
@@ -1,20 +0,0 @@
1
- name: Sync to Hugging Face Space
2
- on:
3
- push:
4
- branches: [main]
5
- jobs:
6
- sync-to-hub:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v3
10
- with:
11
- fetch-depth: 0
12
- lfs: true
13
- - name: Push to Hugging Face Space
14
- env:
15
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
16
- run: |
17
- git config --global user.email "you@example.com"
18
- git config --global user.name "Your Name"
19
- git remote add space https://huggingface.co/spaces/Coool2/Final_Assignment_Template
20
- git push -f https://Coool2:$HF_TOKEN@huggingface.co/spaces/Coool2/Final_Assignment_Template main
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
__pycache__/agent2.cpython-311.pyc CHANGED
Binary files a/__pycache__/agent2.cpython-311.pyc and b/__pycache__/agent2.cpython-311.pyc differ
 
__pycache__/custom_models.cpython-311.pyc ADDED
Binary file (23.9 kB). View file
 
agent2.py CHANGED
@@ -15,7 +15,7 @@ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExport
15
  from opentelemetry.sdk.trace.export import SimpleSpanProcessor
16
  from opentelemetry import trace
17
  from langfuse import Langfuse
18
- from smolagents import SpeechToTextTool, PythonInterpreterTool
19
 
20
 
21
  import requests
@@ -173,12 +173,10 @@ class GAIAAgent:
173
 
174
  # GAIA system prompt from the leaderboard
175
  self.system_prompt = """You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. 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. 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. 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.
176
-
177
- IMPORTANT :
178
- - When you need to find information in a document, use the BM25 retriever tool to search for relevant sections.
179
- - When you need to find information in a visited web page, do not use the BM25 retriever tool, but instead use the visit_webpage tool to fetch the content of the page, and then use the retrieved content to answer the question.
180
- - In the last step of your reasoning, if you think your reasoning is not able to answer the question, answer the question directy with your internal reasoning, without using the BM25 retriever tool or the visit_webpage tool.
181
- """
182
 
183
  # Initialize retriever tool (will be updated when documents are loaded)
184
  self.retriever_tool = BM25RetrieverTool()
@@ -238,12 +236,21 @@ class GAIAAgent:
238
  ]
239
  self.agent = CodeAgent(
240
  tools=base_tools + [
241
- SpeechToTextTool(),
242
  WebSearchTool(),
243
- PythonInterpreterTool()],
 
244
  model=self.model,
245
  description=self.system_prompt,
246
- max_steps=6 )
 
 
 
 
 
 
 
 
 
247
 
248
 
249
  def load_documents_from_file(self, file_path: str):
 
15
  from opentelemetry.sdk.trace.export import SimpleSpanProcessor
16
  from opentelemetry import trace
17
  from langfuse import Langfuse
18
+ from smolagents import PythonInterpreterTool, FinalAnswerTool
19
 
20
 
21
  import requests
 
173
 
174
  # GAIA system prompt from the leaderboard
175
  self.system_prompt = """You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. 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. 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. 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.
176
+ IMPORTANT:
177
+ - In the last step of your reasoning, if you think your reasoning is not able to answer the question, answer the question directy with your internal reasoning, without using the BM25 retriever tool or the visit_webpage tool.
178
+ - Always use the final_answer tool to return your final answer, even if you think you can answer the question without using the tools.
179
+ """
 
 
180
 
181
  # Initialize retriever tool (will be updated when documents are loaded)
182
  self.retriever_tool = BM25RetrieverTool()
 
236
  ]
237
  self.agent = CodeAgent(
238
  tools=base_tools + [
 
239
  WebSearchTool(),
240
+ PythonInterpreterTool(),
241
+ FinalAnswerTool()],
242
  model=self.model,
243
  description=self.system_prompt,
244
+ max_steps=5,
245
+ additional_authorized_imports = [
246
+ "math", # basic calculations
247
+ "statistics", # common numeric helpers
248
+ "itertools", # safe functional helpers
249
+ "datetime", # date handling
250
+ "random", # simple randomness (no os access)
251
+ "re", # regular expressions
252
+ "json", # serialisation / parsing
253
+ ] )
254
 
255
 
256
  def load_documents_from_file(self, file_path: str):