Skip to content

Conversation

strickvl
Copy link
Contributor

Summary

Please provide a short summary explaining the motivation behind these changes.

Checklist

  • I have read the contributing guidelines.
  • I have run the necessary tests and linters.
  • I have updated relevant documentation where applicable.

Related Issues

Please link to any relevant issues or discussions.

@strickvl strickvl requested review from htahir1 and Copilot May 27, 2025 18:00
@strickvl strickvl added enhancement New feature or request internal labels May 27, 2025
Copy link

dagshub bot commented May 27, 2025

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new deep research agent workflow project with several new files covering pipeline orchestration, configuration, logging, and custom materializers for report visualization and decision approval. Key changes include the implementation of the main research pipeline interface, multiple YAML configuration files for different research modes, and custom materializers for handling complex output formats.

Reviewed Changes

Copilot reviewed 55 out of 55 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
deep_research/run.py Implements the main CLI and pipeline configuration with research mode presets
deep_research/pipelines/parallel_research_pipeline.py Defines the parallelized deep research pipeline using ZenML's pipeline decorator
deep_research/materializers/* Adds custom materializers for visualization of reflection outputs and approval decisions
deep_research/configs/*.yaml Provides several configuration files for various research modes
deep_research/logging_config.py Sets up logging configuration for the application

Copy link
Contributor

@htahir1 htahir1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smaller things:

  • The main README.md needs an update
  • Have we tried with other models too?

Ive also stopped mid-way because i feel like we need to agree on some patterns moving forward that seem bigger to be fair:

  • How do we expect prompts to be versioned?
  • Do we want one big "ResearchState" model to be passed around as "memory" of the whole thing? Maybe we can call this "memory"?

In both cases I feel like the big problem is that downstream steps are so "entangled" with the structure of the schema and assume that these will be in a certain state. Therefore the chances of error are super high even if one small thing changes in the future

Comment on lines 68 to 74
decomposed_questions = get_structured_llm_output(
prompt=state.main_query,
system_prompt=updated_system_prompt,
model=llm_model,
fallback_response=fallback_questions,
project=langfuse_project_name,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the expected schema of the output? Is it embedde in state.main_query? If so thats also super hard to understand

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is actually one bit from what you gave me that I never changed. I didn't want to dump in instructor or something like it to force the structured output as I never needed it so far.

@strickvl
Copy link
Contributor Author

I'm not sure about using the word memory as it's just too overloaded at the moment.

Prompts are being versioned in git and also via ZenML as an artifact with the pydantic model we're passing around.

@strickvl strickvl marked this pull request as draft May 27, 2025 20:15
strickvl and others added 7 commits May 27, 2025 22:16
- Add appropriate tags to all artifacts across pipeline steps
- Use add_tags() with artifact parameter matching Annotated names
- Tags help categorize and filter artifacts in the ZenML dashboard
* Complete refactoring of ResearchState to artifact-based architecture

This commit implements the design document for splitting the monolithic ResearchState into separate, named artifacts with custom visualizations. Major changes include:

## New Artifact Classes
- **QueryContext**: Immutable context containing the research query and sub-questions
- **SearchData**: All search results and cost tracking information
- **SynthesisData**: Synthesized information from searches (including enhanced versions)
- **AnalysisData**: Cross-viewpoint analysis and reflection metadata
- **FinalReport**: The generated HTML report with metadata

## Custom Materializers
Each artifact now has its own materializer with beautiful HTML visualizations:
- Interactive charts using Chart.js for search costs
- Collapsible sections for better organization
- Consistent styling across all artifact views
- Metadata tables with key statistics

## Pipeline Updates
- All steps refactored to use the new artifact-based approach
- Proper dependencies established between parallel steps
- Fixed merge step to run after parallel sub-question processing
- Updated metadata logging and tagging throughout

## Bug Fixes
- Fixed log_metadata calls to include infer_artifact=True parameter
- Fixed template variable names in final report generation
- Corrected enhanced_info merging logic to preserve original synthesis data
- Added proper step dependencies in parallel pipeline

## Test Updates
- Updated all tests to use the new artifact-based interface
- Tests now create individual artifacts instead of ResearchState
- Maintained test coverage for all functionality

This refactoring improves modularity, enables better artifact visualization in the ZenML dashboard, and makes the pipeline more maintainable and extensible.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* Delete legacy code

---------

Co-authored-by: Claude <[email protected]>
- Created shared CSS file at assets/styles.css consolidating all common styles
- Added CSS utility functions in utils/css_utils.py for consistent styling
- Updated all materializers to use shared CSS instead of inline styles
- Updated report template in prompts.py to use shared CSS
- Fixed unused 'question' variable in approval_decision_materializer.py
- Reduced code duplication across all visualization components

This refactoring improves maintainability by centralizing style definitions
and provides consistent visual styling across all materializers.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…yles

- Update STATIC_HTML_TEMPLATE in utils/prompts.py to use shared CSS
- Replace ~650 lines of inline CSS with reference to shared styles
- Maintain report-specific styles only where necessary
- Achieve significant code reduction across the codebase
- Move LLM output processing functions to llm_utils.py (remove_reasoning_from_output, clean_json_tags, clean_markdown_tags, safe_json_loads)
- Move HTML extraction to css_utils.py (extract_html_from_content)
- Create new config_utils.py for configuration management (load_pipeline_config, check_required_env_vars)
- Update all imports across the codebase
- Delete the now-empty helper_functions.py

This improves code organization by grouping related functionality together.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@strickvl strickvl requested a review from Copilot May 28, 2025 08:20
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new CLI entry point and supporting ZenML pipeline with rich visualizations and configuration presets.

  • Introduces run.py for the Deep Research Agent CLI with mode presets
  • Defines a parallelized ZenML pipeline in pipelines/parallel_research_pipeline.py
  • Implements several custom materializers for interactive HTML output
  • Adds YAML configuration files for rapid, balanced, and deep research modes
  • Updates requirements.txt with necessary dependencies

Reviewed Changes

Copilot reviewed 52 out of 52 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
deep_research/run.py CLI entry point applying presets, logging, and env checks
deep_research/pipelines/parallel_research_pipeline.py Defines the parallel research ZenML pipeline
deep_research/materializers/* Custom Pydantic materializers generating HTML views
deep_research/configs/*.yaml Preset configurations for different research modes
deep_research/requirements.txt Adds and pins project dependencies

- Use Click context to detect user-provided overrides instead of hardcoded defaults
- Set explicit default="tavily" for search-provider to match help text

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@strickvl strickvl requested a review from htahir1 May 28, 2025 15:57
@strickvl strickvl marked this pull request as ready for review May 28, 2025 16:53
@htahir1
Copy link
Contributor

htahir1 commented Jun 2, 2025

Merging for now we do follow ups later

@htahir1 htahir1 merged commit b0b4e11 into main Jun 2, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants