File size: 1,096 Bytes
372531f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import logging
from typing import List, Dict, Any
import asyncio
from gpt_researcher import GPTResearcher
from src.logs_handler import CustomLogsHandler  # Update import

async def run() -> None:
    """Run the research process and generate a report."""
    query = "What happened in the latest burning man floods?"
    report_type = "research_report"
    report_source = "online"
    tone = "informative"
    config_path = None

    custom_logs_handler = CustomLogsHandler(query=query)  # Pass query parameter

    researcher = GPTResearcher(
        query=query,
        report_type=report_type,
        report_source=report_source,
        tone=tone,
        config_path=config_path,
        websocket=custom_logs_handler
    )

    await researcher.conduct_research()  # Conduct the research
    report = await researcher.write_report()  # Write the research report
    logging.info("Report generated successfully.")  # Log report generation

    return report

# Run the asynchronous function using asyncio
if __name__ == "__main__":
    asyncio.run(run())