Commit graph

46 commits

Author SHA1 Message Date
8eda903185 Switch to aiohttp for async HTTP requests in server logic
Replaced synchronous requests with aiohttp to enable non-blocking, async HTTP requests. Updated `smd_detail_article` and `smd_research` to utilize asyncio for parallel execution, significantly improving efficiency for handling multiple API calls. Added aiohttp and asyncio dependencies to requirements.txt.
2025-06-21 20:17:59 +02:00
1554d5e4ab Update article query logic and improve response structure
Removed the unused `smd_detail_article` decorator and expanded the response structure to include detailed article data in nested JSON. Adjusted the pagination default `pageSize` from 10 to 25 to handle larger datasets effectively.
2025-06-21 20:06:17 +02:00
d779b5bd98 Update SMD server to fix API URL and clarify docstring
Revised the API endpoint URL from smd.ch to swissdox.ch for accuracy and updated the function docstring to clarify the purpose of the article_id parameter. These changes improve clarity and ensure API requests are routed correctly.
2025-06-21 19:50:27 +02:00
4793aca10e Update docstring for smd_detail_article function
Clarify the usage instructions and context for the smd_detail_article function. This ensures better understanding of its relationship with the smd_research tool.
2025-06-21 19:35:33 +02:00
a36990856c Update default onlyResults parameter to False
The `onlyResults` parameter was changed from `True` to `False` in the API request configuration. This ensures more comprehensive data retrieval by including additional metadata in the API response.
2025-06-21 19:31:05 +02:00
bf695bef09 Refactor SMD utilities and streamline research query usage
Remove unnecessary SMD utilities and shift query creation logic directly into `smd_research` for simplicity. This eliminates duplicate functionality and reduces reliance on external utility files, consolidating responsibilities within server implementation.
2025-06-21 19:14:11 +02:00
60c441c817 Add GPT Researcher MCP server implementation
Introduce an MCP server for GPT Researcher using FastMCP, enabling AI assistants to perform web research and generate reports via SSE. Includes async processing steps with real-time updates and a runnable server script.
2025-06-01 13:31:42 +02:00
895671189e Refactor API methods to use AsyncGenerator for SSE.
Updated `write_report` and `get_research_sources` to stream results via server-sent events (SSE) using `AsyncGenerator`. This allows incremental data delivery and better error reporting, improving client-server communication.
2025-06-01 13:00:41 +02:00
1b60eb0ae6 Refactor quick_search to support SSE response streaming.
Updated `quick_search` to return an `AsyncGenerator` for streaming server-sent events (SSE) during quick research execution. Enhanced error handling to provide detailed feedback and upgraded `gpt-researcher` dependency to version 0.13.3 for compatibility.
2025-06-01 12:56:34 +02:00
d66bb1cd7a Standardize SSE event types to "message"
Replaced various custom SSE event types like "tool_update", "tool_result", and "tool_error" with the unified "message" event type. This simplifies event handling logic and ensures consistency across all server-sent event flows.
2025-06-01 12:19:21 +02:00
cda44df1a0 Refactor deep_research to support SSE-based streaming.
Updated the `deep_research` function to use asynchronous generators and send Server-Sent Events (SSE) for real-time streaming updates. Added a new utility for formatting SSE events and improved research lifecycle visibility with intermediate progress steps and error handling.
2025-06-01 11:46:11 +02:00
11bfff7ff7 Set FastMCP server to listen on all interfaces with a config.
Updated the FastMCP initialization to explicitly bind to 0.0.0.0, set the port to 8000, and specify a keep-alive timeout of 720 seconds. This ensures the server is properly configured for broader accessibility and stability.
2025-05-31 23:59:42 +02:00
b1ad64cd75 Introduce research resource API and improve research caching
Add a `research://{topic}` resource endpoint for direct access to research context, reducing redundant API calls. Introduced `research_store` for caching research results and modularized helper methods like `store_research_results` and `format_context_with_sources` for better reusability and clarity. Refactored existing researcher initialization for simplicity and improved comments to clarify intended usage.
2025-05-31 23:54:51 +02:00
ba48f44321 Set keep-alive timeout for FastMCP servers to 720 seconds
Added the `timeout_keep_alive` parameter to FastMCP initialization in both GPT Researcher and SMD Researcher servers. This ensures connections remain active for longer, improving server reliability for long-lived client interactions.
2025-05-31 22:29:01 +02:00
12503a4453 Set FastMCP server to listen on all interfaces with port 8000
The `host` and `port` parameters were added to FastMCP initialization for both GPT Researcher and SMD servers. This ensures the servers are accessible on all network interfaces at port 8000.
2025-05-31 21:16:40 +02:00
a593cdcae8 Update APP_ENTRYPOINT in Dockerfile to new path
Changed the APP_ENTRYPOINT environment variable to reflect the updated directory structure. This ensures the application points to the correct script path during execution.
2025-05-31 20:28:10 +02:00
dc93de9b18 Use shell form for CMD in Dockerfile
Switched CMD to use shell form instead of exec form for running the application. This simplifies the command syntax and ensures compatibility in environments where exec form parsing may cause issues.
2025-05-31 20:06:23 +02:00
3b75d04f32 Add SMD MCP Server implementation and utilities
Implemented the SMD MCP Server with functionality for AI-driven research and article retrieval via the MCP protocol. Added utilities for prompt creation and enhanced dependency configuration. This serves as a foundation for handling SMD-related queries and data processing.
2025-05-31 17:08:46 +02:00
47c036a973 Remove unused research resource and related utilities
Eliminated the `research://{topic}` resource API, associated utilities, and the `research_store`. These components were redundant due to existing alternatives using the `conduct_research` tool. This cleanup reduces complexity and improves maintainability.
2025-05-03 11:10:56 +02:00
eec1b34517 Refactor module structure and improve Docker configuration
Reorganized module directories under `phoenix_technologies` for better namespace clarity and maintainability. Updated the Dockerfile to use an environment variable for the application entry point, enhancing flexibility in deployment. Additionally, revamped the README to reflect the new structure and provide clearer project documentation.
2025-05-03 11:03:15 +02:00
6bab336883 Update function docstrings for clarity and focus
Simplified the descriptions in `deep_research` and `quick_search` docstrings to improve readability and eliminate redundant details. This ensures concise and focused explanations of each function's purpose.
2025-04-26 19:48:06 +02:00
51eecd2830 Add CustomLogsHandler for JSON logging in GPTResearcher
Introduced a CustomLogsHandler class to handle and log JSON data during research or search operations. Updated GPTResearcher initialization to include the CustomLogsHandler for improved logging and debugging.
2025-04-26 19:28:43 +02:00
0892ecdc8e Use "sse" mode in MCP run method
Updated the `mcp.run` call to include the "sse" mode, ensuring proper handling of server events. This change improves the server's event loop management and prepares it for SSE-specific operations.
2025-04-26 18:48:51 +02:00
7f7a6083f8 Add quick_search function and remove citation note in deep_research
Introduced the quick_search function for faster, snippet-based searches and adjusted mcp.run to remove the "sse" argument. Additionally, modified the deep_research docstring to remove the citation requirement note for simpler usage documentation.
2025-04-26 18:46:11 +02:00
7e5a6db0f6 Set research type dynamically via environment variable
Added `RESEARCH_TYPE` environment variable to configure the default research type for GPTResearcher. Updated the initialization of GPTResearcher to use this dynamic configuration, improving flexibility and adaptability.
2025-04-26 18:14:41 +02:00
626345b65e Add report_type parameter to GPTResearcher initialization
This update enables specifying the report type during researcher initialization. It introduces "deep" as the default report type, enhancing flexibility for future use cases.
2025-04-26 18:11:21 +02:00
44b91b9375 Refactor codebase to implement MCP server for GPT Researcher
Replaced FastAPI app with an MCP server implementation, enhancing flexibility and modularity for research operations. Deprecated `phoenix_technologies` package, updated server logic, added utility functions, and revised dependencies in `requirements.txt`. Updated Dockerfile and README to align with the new architecture.
2025-04-26 17:54:43 +02:00
73e929ca00 Refactor report generation with simplified log streaming
Replaced custom log handler and async report generation logic with a simplified fake data streamer for the StreamingResponse. Added uvicorn server startup code for direct script execution.
2025-04-26 08:38:02 +02:00
e2b4ba5a7d Refactor log streaming and report generation logic
Simplified the logic for log streaming by consolidating into a single async generator (`log_stream`). Removed redundant tasks and streamlined report generation to improve code readability and maintainability.
2025-04-25 22:11:19 +02:00
1472e277bc Refactor report generation with async streaming and logging
Enhanced report generation by integrating `CustomLogsHandler` and separating tasks for generating reports and streaming logs. Replaced the previous implementation with a unified async generator to handle concurrent execution and improve error handling. Updated module exports to include the new `CustomLogsHandler` component.
2025-04-25 22:07:25 +02:00
6ee47f02c0 Fix incorrect attribute access for generator completion check
Replaced `generator.researcher.complete` with the correct `generator.complete`. This resolves a potential logic error and ensures the completion condition is properly evaluated.
2025-04-25 19:57:01 +02:00
79be94afd2 Refactor generator completion checks for consistency.
Replaced `.is_complete()` method calls with direct `.complete` attribute access to streamline the code. Removed the redundant `is_complete()` method from `deepresearch.py` to reduce unnecessary indirection. This simplifies the logic and improves readability.
2025-04-25 19:53:59 +02:00
b16305e369 Fix missing parentheses in is_complete method call
The is_complete method was incorrectly referenced without parentheses, causing a potential runtime error. This fix ensures proper method invocation and prevents the loop from behaving incorrectly.
2025-04-25 19:51:38 +02:00
cb5fe35d24 Refactor report generation flow to include progress streaming
Modified the report generation process to stream logs incrementally during execution. Introduced new methods `init` and `is_complete` to enhance modularity and track completion status. Adjusted generator logic to better manage and yield logs in real-time.
2025-04-25 19:47:34 +02:00
ae4e81906e Add progress messages to report generation process
This change introduces status updates to indicate the start and successful completion of the report generation. These progress messages improve user feedback during the asynchronous operation.
2025-04-25 19:26:18 +02:00
ffeb2527b3 Refactor log handling in deepresearch module
Removed the unnecessary `logs` initialization and streamlined the `CustomLogsHandler` setup. This simplifies the code and avoids redundant log storage.
2025-04-25 18:58:40 +02:00
936eb6f394 Refactor report generation and logging handlers.
Introduced `CustomLogsHandler` to streamline log management and updated `ReportGenerator` to simplify report generation output. Removed unused asynchronous iterator methods, improving code clarity and reducing complexity.
2025-04-25 18:56:41 +02:00
1dbf774d55 Refactor async methods to adjust return types.
Changed `send_json` to return `None` instead of yielding and updated log retrieval to use `yield` in place of `return`. These modifications align function behavior with intended asynchronous use cases and improve consistency.
2025-04-25 18:46:48 +02:00
327758f00f Refactor async logging logic in report generation.
Removed unused log yielding in `main.py` to simplify the flow. Updated `send_json` in `deepresearch.py` to use an async generator for more flexible streaming of log data.
2025-04-25 18:42:40 +02:00
ade4511a87 Add report generation step to the main async process
The `generate_report` method is now explicitly called within the main process, ensuring the researcher's report generation is initiated properly. Updated its return type annotation for clarity in `deepresearch.py`.
2025-04-25 18:39:33 +02:00
14429fc6f7 Refactor logging and improve async iteration in report generation
Refactored `CustomLogsHandler` to accept an optional logs list and modified its method to append data instead of yielding. Enhanced `ReportGenerator` with proper asynchronous iterator implementation, enabling smooth log handling and retrieval. Simplified variable naming for better readability.
2025-04-25 18:35:30 +02:00
cd79fe99be Refactor ReportGenerator and integrate custom logs handler
Introduced `CustomLogsHandler` to manage log handling and WebSocket integration in `ReportGenerator`. Simplified and restructured report generation logic for improved maintainability. Removed obsolete methods and enhanced overall readability with cleaner code structure.
2025-04-25 18:20:51 +02:00
6993a52d47 Refactor and improve ReportGenerator for clarity and robustness
Enhanced docstrings for better clarity and consistency across methods. Added error handling for report generation and ensured default values for research details to avoid null errors. Improved comments and logic flow for readability and maintainability.
2025-04-25 10:03:21 +02:00
9f87253082 Make DeepResearch asynchronously iterable.
Added asynchronous iteration methods (`__aiter__` and `__anext__`) to the `DeepResearch` class to enable streaming of research report chunks. Introduced functionality to generate and split reports into smaller chunks for improved report handling.
2025-04-25 09:57:43 +02:00
43423732e2 Add environment variable placeholders to README
Included new environment variable placeholders for better configuration guidance. These updates clarify setup requirements and improve documentation completeness.
2025-04-25 08:42:32 +02:00
3d0d2b2770 Add FastAPI app for report generation with Docker support
Implement a modular FastAPI-based service for generating research reports using `GPTResearcher`. Includes secure API key authentication, a streaming response endpoint, and a Dockerized deployment setup. Also adds documentation, core dependencies, and project structure.
2025-04-25 08:34:18 +02:00