diff --git a/src/main.py b/src/main.py index b223552..f147b19 100644 --- a/src/main.py +++ b/src/main.py @@ -38,8 +38,6 @@ async def get_report_endpoint(request: ReportRequest): # Call the asynchronous get_report function generator = ReportGenerator(request.query, request.report_type) await generator.generate_report() - async for log in generator: - yield log except Exception as e: yield f"Error: {str(e)}" diff --git a/src/phoenix_technologies/gptresearch/deepresearch.py b/src/phoenix_technologies/gptresearch/deepresearch.py index d8e0adc..3724c99 100644 --- a/src/phoenix_technologies/gptresearch/deepresearch.py +++ b/src/phoenix_technologies/gptresearch/deepresearch.py @@ -9,10 +9,11 @@ class CustomLogsHandler: logs = [] self.logs = logs # Initialize logs to store data - async def send_json(self, data: Dict[str, Any]) -> None: + async def send_json(self, data: Dict[str, Any]) -> AsyncGenerator[str, Any]: """Send JSON data and log it.""" self.logs.append(data) # Append data to logs - print(f"My custom Log: {data}") # For demonstration, print the log + print(f"My custom Log: {data}") + yield f"My custom Log: {data}" class ReportGenerator: def __init__(self, query: str, report_type: str):