IamRulo commited on
Commit
f0062d2
·
verified ·
1 Parent(s): 0fcca08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -1
app.py CHANGED
@@ -4,6 +4,17 @@ import requests
4
  import inspect
5
  import pandas as pd
6
 
 
 
 
 
 
 
 
 
 
 
 
7
  # (Keep Constants as is)
8
  # --- Constants ---
9
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
@@ -12,10 +23,28 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
12
  # ----- THIS IS WHERE 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."
 
 
 
 
19
  print(f"Agent returning fixed answer: {fixed_answer}")
20
  return fixed_answer
21
 
 
4
  import inspect
5
  import pandas as pd
6
 
7
+ # Rulo copycat
8
+ from smolagents import(
9
+ ToolCallingAgent,
10
+ CodeAgent,
11
+ DuckDuckGoSearchTool,
12
+ InferenceClientModel,
13
+ HfApiModel,
14
+ OpenAIServerModel
15
+ )
16
+ # Rulo
17
+
18
  # (Keep Constants as is)
19
  # --- Constants ---
20
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
 
23
  # ----- THIS IS WHERE YOU CAN BUILD WHAT YOU WANT ------
24
  class BasicAgent:
25
  def __init__(self):
26
+ #rulo copycat
27
+ self.model = OpenAIServerModel(
28
+ model_id='o4-mini',
29
+ #api_base="https://api.openai.com/v1",
30
+ #api_key=os.environ["OPENAI_API_KEY"],
31
+ )
32
+ self.agent = ToolCallingAgent(
33
+ tools=[DuckDuckGoSearchTool()],
34
+ model=self.model,
35
+ add_base_tools=True
36
+ )
37
+ #rulo
38
+
39
  print("BasicAgent initialized.")
40
+
41
  def __call__(self, question: str) -> str:
42
  print(f"Agent received question (first 50 chars): {question[:50]}...")
43
+ #fixed_answer = "This is a default answer."
44
+ #rulo
45
+ fixed_answer = self.agent.run(question)
46
+ #rulo
47
+
48
  print(f"Agent returning fixed answer: {fixed_answer}")
49
  return fixed_answer
50