Spaces:
Configuration error
Configuration error
Orel MAZOR commited on
Commit ·
e5ebf3f
1
Parent(s): 3cce64e
Commit 2
Browse filesFiles changed (5)
1234567891011121314151617181920name: Sync to Hugging Face Spaceon: push: branches: [main]jobs: sync-to-hub: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 lfs: true - name: Push to Hugging Face Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | git config --global user.email "you@example.com" git config --global user.name "Your Name" git remote add space https://huggingface.co/spaces/Coool2/Final_Assignment_Template git push -f https://Coool2:$HF_TOKEN@huggingface.co/spaces/Coool2/Final_Assignment_Template main14 unmodified lines15161718192021151 unmodified lines17317417517617717817918018118218318453 unmodified lines23823924024124224324424524624724824914 unmodified linesfrom opentelemetry.sdk.trace.export import SimpleSpanProcessorfrom opentelemetry import tracefrom langfuse import Langfusefrom smolagents import SpeechToTextTool, PythonInterpreterToolimport requests151 unmodified lines# GAIA system prompt from the leaderboardself.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.IMPORTANT :- When you need to find information in a document, use the BM25 retriever tool to search for relevant sections.- 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.- 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."""# Initialize retriever tool (will be updated when documents are loaded)self.retriever_tool = BM25RetrieverTool()53 unmodified lines]self.agent = CodeAgent(tools=base_tools + [SpeechToTextTool(),WebSearchTool(),PythonInterpreterTool()],model=self.model,description=self.system_prompt,max_steps=6 )def load_documents_from_file(self, file_path: str):14 unmodified lines15161718192021151 unmodified lines17317417517617717817918018118253 unmodified lines23623723823924024124224324424524624724824925025125225325425525614 unmodified linesfrom opentelemetry.sdk.trace.export import SimpleSpanProcessorfrom opentelemetry import tracefrom langfuse import Langfusefrom smolagents import PythonInterpreterTool, FinalAnswerToolimport requests151 unmodified lines# GAIA system prompt from the leaderboardself.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.IMPORTANT:- 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.- Always use the final_answer tool to return your final answer, even if you think you can answer the question without using the tools."""# Initialize retriever tool (will be updated when documents are loaded)self.retriever_tool = BM25RetrieverTool()53 unmodified lines]self.agent = CodeAgent(tools=base_tools + [WebSearchTool(),PythonInterpreterTool(),FinalAnswerTool()],model=self.model,description=self.system_prompt,max_steps=5,additional_authorized_imports = ["math", # basic calculations"statistics", # common numeric helpers"itertools", # safe functional helpers"datetime", # date handling"random", # simple randomness (no os access)"re", # regular expressions"json", # serialisation / parsing] )def load_documents_from_file(self, file_path: str):
.DS_Store
.github/workflows/sync_to_hf_space.ymlDeleted-20
__pycache__/agent2.cpython-311.pyc
__pycache__/custom_models.cpython-311.pycAdded
agent2.py+17-10