cowrycode commited on
Commit
c96d9d6
·
verified ·
1 Parent(s): 1b5c4ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -13,6 +13,7 @@ from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
13
  from youtube_tool import youtube_transcript_tool, youtube_transcript_snippet_tool
14
  from multiple_tools import round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool, wikipedia_search_tool
15
  from agent import smart_agent
 
16
 
17
  # (Keep Constants as is)
18
  # --- Constants ---
@@ -24,7 +25,7 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
24
  class BasicAgent:
25
  def __init__(self):
26
  print("BasicAgent initialized. . . .")
27
- self.agent = smart_agent()
28
  # self.api_key = os.getenv("HF_TOKEN")
29
  # self.llm = HuggingFaceInferenceAPI(
30
  # model_name="deepseek-ai/DeepSeek-R1-0528",
@@ -37,6 +38,12 @@ class BasicAgent:
37
  # round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
38
  # llm=self.llm
39
  # )
 
 
 
 
 
 
40
 
41
  async def run(self, question: str) -> str:
42
  print(f"Agent received question (first 50 chars): {question[:50]}...")
 
13
  from youtube_tool import youtube_transcript_tool, youtube_transcript_snippet_tool
14
  from multiple_tools import round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool, wikipedia_search_tool
15
  from agent import smart_agent
16
+ from llama_index.llms.openai import OpenAI
17
 
18
  # (Keep Constants as is)
19
  # --- Constants ---
 
25
  class BasicAgent:
26
  def __init__(self):
27
  print("BasicAgent initialized. . . .")
28
+ # self.agent = smart_agent()
29
  # self.api_key = os.getenv("HF_TOKEN")
30
  # self.llm = HuggingFaceInferenceAPI(
31
  # model_name="deepseek-ai/DeepSeek-R1-0528",
 
38
  # round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
39
  # llm=self.llm
40
  # )
41
+ OpenAI_key = os.getenv("OPEN_AI_TOKEN")
42
+ self.llm = OpenAI(model="gpt-4o-mini", temperature=0.2, api_key=OpenAI_key)
43
+ self.agent = AgentWorkflow.from_tools_or_functions(
44
+ [wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
45
+ llm=self.llm,
46
+ )
47
 
48
  async def run(self, question: str) -> str:
49
  print(f"Agent received question (first 50 chars): {question[:50]}...")