lovepreetsingh1996 commited on
Commit
fb35c19
·
1 Parent(s): 17641af

fix: async error

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -8,6 +8,7 @@ from llama_index.core.tools import FunctionTool
8
  from llama_index.tools.duckduckgo import DuckDuckGoSearchToolSpec
9
  from llama_index.core.agent.workflow import AgentWorkflow
10
  import pandas as pd
 
11
 
12
  # (Keep Constants as is)
13
  # --- Constants ---
@@ -45,7 +46,11 @@ class BasicAgent:
45
  duckduckgoSearchTools = DuckDuckGoSearchToolSpec().to_tool_list()
46
 
47
  agent = AgentWorkflow.from_tools_or_functions([*duckduckgoSearchTools, youtube_transcript_answer_tool], llm=self.llm)
48
- fixed_answer = agent.run(question)
 
 
 
 
49
  print(f"Agent returning fixed answer: {fixed_answer}")
50
  return fixed_answer
51
 
 
8
  from llama_index.tools.duckduckgo import DuckDuckGoSearchToolSpec
9
  from llama_index.core.agent.workflow import AgentWorkflow
10
  import pandas as pd
11
+ import asyncio
12
 
13
  # (Keep Constants as is)
14
  # --- Constants ---
 
46
  duckduckgoSearchTools = DuckDuckGoSearchToolSpec().to_tool_list()
47
 
48
  agent = AgentWorkflow.from_tools_or_functions([*duckduckgoSearchTools, youtube_transcript_answer_tool], llm=self.llm)
49
+
50
+ async def run_agent():
51
+ return await agent.run(question)
52
+
53
+ fixed_answer = asyncio.run(run_agent())
54
  print(f"Agent returning fixed answer: {fixed_answer}")
55
  return fixed_answer
56