josondev commited on
Commit
e6bc26b
·
verified ·
1 Parent(s): 81917a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -5
app.py CHANGED
@@ -3,6 +3,10 @@ import gradio as gr
3
  import requests
4
  import inspect
5
  import pandas as pd
 
 
 
 
6
 
7
  # (Keep Constants as is)
8
  # --- Constants ---
@@ -12,7 +16,45 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
12
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
13
  class BasicAgent:
14
  def __init__(self):
15
- print("BasicAgent initialized.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  def __call__(self, question: str) -> str:
17
  print(f"Agent received question (first 50 chars): {question[:50]}...")
18
  fixed_answer = "This is a default answer."
@@ -146,11 +188,9 @@ with gr.Blocks() as demo:
146
  gr.Markdown(
147
  """
148
  **Instructions:**
149
-
150
  1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
151
  2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
152
  3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
153
-
154
  ---
155
  **Disclaimers:**
156
  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).
@@ -192,5 +232,4 @@ if __name__ == "__main__":
192
 
193
  print("-"*(60 + len(" App Starting ")) + "\n")
194
 
195
- print("Launching Gradio Interface for Basic Agent Evaluation...")
196
- demo.launch(debug=True, share=False)
 
3
  import requests
4
  import inspect
5
  import pandas as pd
6
+ from agno.agent import Agent
7
+ from agno.tools.duckduckgo import DuckDuckGoTools
8
+ from agno.models.nvidia import Nvidia
9
+
10
 
11
  # (Keep Constants as is)
12
  # --- Constants ---
 
16
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
17
  class BasicAgent:
18
  def __init__(self):
19
+ agent=Agent(
20
+ model=Nvidia(id="meta/llama-3.3-70b-instruct")
21
+ ,instructions='''
22
+ ## 🚀 Gaia Taskmaster: The Ultimate Agent Efficiency Prompt! 🌍
23
+
24
+ You are a high-performance AI agent with a laser focus on completing Gaia tasks with maximum efficiency and precision. Think of yourself as a blend of a master strategist and a productivity guru—always optimizing, always delivering.
25
+
26
+ ### Operational Guidelines for Every Gaia Task
27
+
28
+ - **Use the search tool and all available resources to gather the most current, accurate information.**
29
+ - **Present solutions with clarity, logical structure, and a results-driven mindset.**
30
+ - **Structure your responses in clear sections:**
31
+ - Task Overview
32
+ - Step-by-step Execution Plan
33
+ - Key Details, Data, or Code Snippets
34
+ - Impact Analysis or Next Steps
35
+ - **Keep responses concise but comprehensive (2-3 paragraphs or bullet points max).**
36
+ - **Apply best practices for UI stability and code formatting to ensure all outputs are organized, visible, and maintainable.**
37
+ - **End with a motivating sign-off or call to action, such as:**
38
+ - "Task completed—ready for the next challenge!"
39
+ - "Gaia task executed with precision. What’s next?"
40
+ - "Mission accomplished. Awaiting further instructions!"
41
+
42
+ _Remember: Always verify facts, optimize for efficiency, and maintain a focus on clear, actionable results!_
43
+ ''',
44
+ tools=[DuckDuckGoTools()])
45
+ print("BasicAgent initialized.")
46
+
47
+ def do_web_search(self,question:str)->str:
48
+ """
49
+ this would call an API or perform a search.
50
+ """
51
+ print(f"Performing web search for: {question}")
52
+ # Example usage
53
+ answer=agent.print_response(
54
+ "Tell me about a breaking news story happening in Times Square.", stream=True
55
+ )
56
+ return {answer}
57
+
58
  def __call__(self, question: str) -> str:
59
  print(f"Agent received question (first 50 chars): {question[:50]}...")
60
  fixed_answer = "This is a default answer."
 
188
  gr.Markdown(
189
  """
190
  **Instructions:**
 
191
  1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
192
  2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
193
  3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
 
194
  ---
195
  **Disclaimers:**
196
  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).
 
232
 
233
  print("-"*(60 + len(" App Starting ")) + "\n")
234
 
235
+ print("Launching Gradio Interface for Basic Agent Evaluation...")