do web searches in ddg, google and google news

This commit is contained in:
Dobromir Popov
2024-01-08 17:52:31 +02:00
parent 317a876ec4
commit 7c0dd39227
5 changed files with 115 additions and 7 deletions

View File

@ -204,17 +204,23 @@ async def async_main():
def sync_main():
# Synchronous part for scheduling
topic = "TSLA"
topic = "tesla news"
interval = 1 # in minutes
folder = "agent-py-bot/scrape/raw"
schedule.every(interval).minutes.do(run_web_agent, topic=topic, folder=folder)
# Run once at the start
run_web_agent(topic=topic, folder=folder)
news_json = run_web_agent(topic=topic, folder=folder)
while True:
schedule.run_pending()
time.sleep(1)
# Check if there's new data obtained from web agent
new_data, new_summary = run_web_agent(topic=topic, folder=folder)
# Use the new data to call the async function
user_message = f"New data received: {new_data}"
query_result = query_llm(user_message)
if __name__ == '__main__':
loop = asyncio.get_event_loop()