cowrycode commited on
Commit
a7200f2
·
verified ·
1 Parent(s): 44323e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -23,6 +23,18 @@ class BasicAgent:
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]}...")
@@ -32,7 +44,7 @@ class BasicAgent:
32
 
33
  def __call__(self, question: str) -> str:
34
  #return smart_agent(question, self.api_key)
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)
 
23
  def __init__(self):
24
  print("BasicAgent initialized.")
25
  self.api_key = os.getenv("HF_TOKEN")
26
+ self.llm = HuggingFaceInferenceAPI(
27
+ model_name="deepseek-ai/DeepSeek-R1-0528",
28
+ token=api_key,
29
+ provider="auto",
30
+ max_iterations=10,
31
+ max_execution_time=60
32
+ )
33
+ self.agent = AgentWorkflow.from_tools_or_functions(
34
+ [wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool,
35
+ round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
36
+ llm=self.llm
37
+ )
38
 
39
  async def run(self, question: str) -> str:
40
  print(f"Agent received question (first 50 chars): {question[:50]}...")
 
44
 
45
  def __call__(self, question: str) -> str:
46
  #return smart_agent(question, self.api_key)
47
+ return await self.agent.run(question)
48
  #print(f"Agent received question (first 50 chars): {question[:50]}...")
49
  #fixed_answer = "This is a default answer."
50
  #fixed_answer = self.llamaindex_agent.run(question)