Commit graph

59 commits

Author SHA1 Message Date
db19c4f4f8 Add Logs 2025-07-24 10:05:48 +02:00
cf88959576 Update query parameters and response handling in server.py
Replaced hardcoded date values with environment variables for flexibility and added a new filter for newspapers. Enhanced response parsing by including facets for related persons and organizations.
2025-07-03 23:33:12 +02:00
e5a6c59f7a Add execution time logging to smd_detail_article function
Introduced performance tracking in the smd_detail_article function by adding execution time logging. This helps in monitoring and optimizing the function’s runtime during API requests and processing.
2025-06-21 22:22:21 +02:00
bbec6df3fd Refactor response handling to parse JSON content.
Replace raw response text retrieval with JSON parsing to extract specific content. This ensures more precise data handling and aligns with expected response structure.
2025-06-21 22:19:50 +02:00
4c554b1472 Fix incorrect API key header in summarization function
The "Bearer" prefix was mistakenly included in the API key header. This change removes it to align with the expected format required by the external service.
2025-06-21 21:57:17 +02:00
cfc124915f Fix incorrect string formatting for model payload key
Replaced curly brackets with direct reference to the environment variable in the payload model value. This ensures the correct model is passed dynamically from environment configurations.
2025-06-21 21:54:29 +02:00
5799319ade Update response handling and add summarized content return
Modified the response handling to return raw text instead of JSON in one case and updated another to include summarized content with article ID. These changes ensure consistency and enhance the response structure for better client integration.
2025-06-21 21:47:13 +02:00
0d532d147b Simplify server response handling by returning raw data.
Replaced the summarized content processing with direct data return. This improves efficiency by skipping the summarization step and ensures the full response data is available to the caller for further use.
2025-06-21 21:43:51 +02:00
6f9f74dae0 Refactor summarize_to_words to accept text and title.
Updated the `summarize_to_words` function to take `text` and `title` as separate parameters instead of a single `article` dictionary. Adjusted payload and function calls accordingly for better clarity and flexibility.
2025-06-21 21:35:54 +02:00
1d5aeb1644 Add article summarization via external API integration
Introduced a new `summarize_to_words` function to summarize articles using an external API. Integrated it into `smd_detail_article` to return summarized article content instead of the full text. Updated header key capitalization for consistency.
2025-06-21 21:18:32 +02:00
3c1f8a2c25 Optimize query formulation instructions in docstring
Clarified that the SMD search query should be written in German and enriched with relevant contextual keywords. This ensures better alignment with language requirements and improves search accuracy.
2025-06-21 20:52:00 +02:00
25000459cb Set default page size from environment variable
Replaced the hardcoded page size with a value fetched from the `SWISSDOX_PAGESIZE` environment variable, defaulting to 10 if not set. This allows greater flexibility and configurability for pagination settings.
2025-06-21 20:39:22 +02:00
87d4884eea Switch HTTP method from GET to POST in server request.
Updated the SMD server client to use POST instead of GET for sending requests. This change ensures the payload is sent as JSON in compliance with the server's expected input format.
2025-06-21 20:25:52 +02:00
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