cowrycode commited on
Commit
dad6e91
·
verified ·
1 Parent(s): b0c4e8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -10
app.py CHANGED
@@ -10,6 +10,7 @@ from llama_index.core.agent.workflow import AgentWorkflow
10
  from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
11
  from youtube_tool import youtube_transcript_tool, youtube_transcript_snippet_tool
12
  from multiple_tools import round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool, wikipedia_search_tool
 
13
 
14
  # (Keep Constants as is)
15
  # --- Constants ---
@@ -22,15 +23,6 @@ class BasicAgent:
22
  def __init__(self):
23
  print("BasicAgent initialized.")
24
  self.api_key = os.getenv("HF_TOKEN")
25
- self.llm = HuggingFaceInferenceAPI(
26
- model_name="deepseek-ai/DeepSeek-R1-0528",
27
- token=self.api_key,
28
- provider="auto"
29
- )
30
- self.llamaindex_agent = AgentWorkflow.from_tools_or_functions(
31
- [wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
32
- llm=self.llm,
33
- )
34
 
35
  async def run(self, question: str) -> str:
36
  print(f"Agent received question (first 50 chars): {question[:50]}...")
@@ -39,7 +31,8 @@ class BasicAgent:
39
  return answer
40
 
41
  def __call__(self, question: str) -> str:
42
- return self.run(question)
 
43
  #print(f"Agent received question (first 50 chars): {question[:50]}...")
44
  #fixed_answer = "This is a default answer."
45
  #fixed_answer = self.llamaindex_agent.run(question)
 
10
  from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
11
  from youtube_tool import youtube_transcript_tool, youtube_transcript_snippet_tool
12
  from multiple_tools import round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool, wikipedia_search_tool
13
+ from agent import smart_agent
14
 
15
  # (Keep Constants as is)
16
  # --- Constants ---
 
23
  def __init__(self):
24
  print("BasicAgent initialized.")
25
  self.api_key = os.getenv("HF_TOKEN")
 
 
 
 
 
 
 
 
 
26
 
27
  async def run(self, question: str) -> str:
28
  print(f"Agent received question (first 50 chars): {question[:50]}...")
 
31
  return answer
32
 
33
  def __call__(self, question: str) -> str:
34
+ #return self.run(question)
35
+ return asyncio.run(smart_agent(question, self.api_key))
36
  #print(f"Agent received question (first 50 chars): {question[:50]}...")
37
  #fixed_answer = "This is a default answer."
38
  #fixed_answer = self.llamaindex_agent.run(question)