Skip to content

Commit 1a80539

Browse files
committed
Add artifact tags to all pipeline steps
- 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
1 parent 5d3bd77 commit 1a80539

11 files changed

+88
-11
lines changed

deep_research/steps/approval_step.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
summarize_research_progress,
1111
)
1212
from utils.pydantic_models import ApprovalDecision, ReflectionOutput
13-
from zenml import log_metadata, step
13+
from zenml import add_tags, log_metadata, step
1414
from zenml.client import Client
1515

1616
logger = logging.getLogger(__name__)
@@ -300,6 +300,9 @@ def get_research_approval_step(
300300
}
301301
)
302302

303+
# Add tag to the approval decision artifact
304+
add_tags(tags=["hitl"], artifact="approval_decision")
305+
303306
return ApprovalDecision(
304307
approved=False,
305308
selected_queries=[],

deep_research/steps/collect_tracing_metadata_step.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
get_trace_stats,
1919
get_traces_by_name,
2020
)
21-
from zenml import get_step_context, step
21+
from zenml import add_tags, get_step_context, step
2222

2323
logger = logging.getLogger(__name__)
2424

@@ -231,4 +231,10 @@ def collect_tracing_metadata_step(
231231
)
232232
metadata.search_queries_count = search_queries_count
233233

234+
# Add tags to the artifacts
235+
add_tags(tags=["state"], artifact="state")
236+
add_tags(
237+
tags=["exa", "tavily", "llm", "cost"], artifact="tracing_metadata"
238+
)
239+
234240
return state, metadata

deep_research/steps/cross_viewpoint_step.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
ViewpointAnalysis,
1515
ViewpointTension,
1616
)
17-
from zenml import log_metadata, step
17+
from zenml import add_tags, log_metadata, step
1818

1919
logger = logging.getLogger(__name__)
2020

@@ -187,6 +187,9 @@ def cross_viewpoint_analysis_step(
187187
infer_artifact=True,
188188
)
189189

190+
# Add tags to the artifact
191+
add_tags(tags=["state", "viewpoint"], artifact="analyzed_state")
192+
190193
return state
191194

192195
except Exception as e:
@@ -220,4 +223,7 @@ def cross_viewpoint_analysis_step(
220223
}
221224
)
222225

226+
# Add tags to the artifact
227+
add_tags(tags=["state", "viewpoint"], artifact="analyzed_state")
228+
223229
return state

deep_research/steps/execute_approved_searches_step.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
SynthesizedInfo,
1919
)
2020
from utils.search_utils import search_and_extract_results
21-
from zenml import log_metadata, step
21+
from zenml import add_tags, log_metadata, step
2222

2323
logger = logging.getLogger(__name__)
2424

@@ -143,6 +143,9 @@ def execute_approved_searches_step(
143143
}
144144
)
145145

146+
# Add tags to the artifact
147+
add_tags(tags=["state", "enhanced"], artifact="updated_state")
148+
146149
return state
147150

148151
# Execute approved searches
@@ -373,6 +376,9 @@ def execute_approved_searches_step(
373376
infer_artifact=True,
374377
)
375378

379+
# Add tags to the artifact
380+
add_tags(tags=["state", "enhanced"], artifact="updated_state")
381+
376382
return state
377383

378384
except Exception as e:
@@ -413,4 +419,7 @@ def execute_approved_searches_step(
413419
}
414420
)
415421

422+
# Add tags to the artifact
423+
add_tags(tags=["state", "enhanced"], artifact="updated_state")
424+
416425
return state

deep_research/steps/generate_reflection_step.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
from utils.llm_utils import get_structured_llm_output
1010
from utils.pydantic_models import Prompt, ReflectionOutput, ResearchState
11-
from zenml import log_metadata, step
11+
from zenml import add_tags, log_metadata, step
1212

1313
logger = logging.getLogger(__name__)
1414

@@ -160,4 +160,7 @@ def generate_reflection_step(
160160
infer_artifact=True,
161161
)
162162

163+
# Add tags to the artifact
164+
add_tags(tags=["reflection", "critique"], artifact="reflection_output")
165+
163166
return reflection_output

deep_research/steps/initialize_prompts_step.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from materializers.prompt_materializer import PromptMaterializer
1111
from utils import prompts
1212
from utils.pydantic_models import Prompt
13-
from zenml import step
13+
from zenml import add_tags, step
1414

1515
logger = logging.getLogger(__name__)
1616

@@ -119,6 +119,27 @@ def initialize_prompts_step(
119119

120120
logger.info(f"Loaded 9 individual prompts")
121121

122+
# add tags to all prompts
123+
add_tags(tags=["prompt", "search"], artifact="search_query_prompt")
124+
add_tags(
125+
tags=["prompt", "generation"], artifact="query_decomposition_prompt"
126+
)
127+
add_tags(tags=["prompt", "generation"], artifact="synthesis_prompt")
128+
add_tags(
129+
tags=["prompt", "generation"], artifact="viewpoint_analysis_prompt"
130+
)
131+
add_tags(tags=["prompt", "generation"], artifact="reflection_prompt")
132+
add_tags(
133+
tags=["prompt", "generation"], artifact="additional_synthesis_prompt"
134+
)
135+
add_tags(
136+
tags=["prompt", "generation"], artifact="conclusion_generation_prompt"
137+
)
138+
add_tags(
139+
tags=["prompt", "generation"], artifact="executive_summary_prompt"
140+
)
141+
add_tags(tags=["prompt", "generation"], artifact="introduction_prompt")
142+
122143
return (
123144
search_query_prompt,
124145
query_decomposition_prompt,

deep_research/steps/iterative_reflection_step.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
SynthesizedInfo,
1717
)
1818
from utils.search_utils import search_and_extract_results
19-
from zenml import log_metadata, step
19+
from zenml import add_tags, log_metadata, step
2020

2121
logger = logging.getLogger(__name__)
2222

@@ -353,6 +353,9 @@ def iterative_reflection_step(
353353
infer_artifact=True,
354354
)
355355

356+
# Add tags to the artifact
357+
add_tags(tags=["state", "reflected"], artifact="reflected_state")
358+
356359
return state
357360

358361
except Exception as e:
@@ -382,4 +385,7 @@ def iterative_reflection_step(
382385
}
383386
)
384387

388+
# Add tags to the artifact
389+
add_tags(tags=["state", "reflected"], artifact="reflected_state")
390+
385391
return state

deep_research/steps/merge_results_step.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from materializers.pydantic_materializer import ResearchStateMaterializer
77
from utils.pydantic_models import ResearchState
8-
from zenml import get_step_context, log_metadata, step
8+
from zenml import add_tags, get_step_context, log_metadata, step
99
from zenml.client import Client
1010

1111
logger = logging.getLogger(__name__)
@@ -262,4 +262,7 @@ def merge_sub_question_results_step(
262262
infer_artifact=True,
263263
)
264264

265+
# Add tags to the artifact
266+
add_tags(tags=["state", "merged"], artifact="merged_state")
267+
265268
return merged_state

deep_research/steps/process_sub_question_step.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
generate_search_query,
1818
search_and_extract_results,
1919
)
20-
from zenml import log_metadata, step
20+
from zenml import add_tags, log_metadata, step
2121

2222
logger = logging.getLogger(__name__)
2323

@@ -87,6 +87,8 @@ def process_sub_question_step(
8787
)
8888
# Return an empty state since there's no question to process
8989
sub_state.sub_questions = []
90+
# Add tags to the artifact
91+
add_tags(tags=["state", "sub-question"], artifact="output")
9092
return sub_state
9193

9294
# Get the target sub-question
@@ -283,4 +285,7 @@ def process_sub_question_step(
283285
infer_artifact=True,
284286
)
285287

288+
# Add tags to the artifact
289+
add_tags(tags=["state", "sub-question"], artifact="output")
290+
286291
return sub_state

deep_research/steps/pydantic_final_report_step.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
VIEWPOINT_ANALYSIS_TEMPLATE,
2424
)
2525
from utils.pydantic_models import Prompt, ResearchState
26-
from zenml import log_metadata, step
26+
from zenml import add_tags, log_metadata, step
2727
from zenml.types import HTMLString
2828

2929
logger = logging.getLogger(__name__)
@@ -1092,6 +1092,9 @@ def pydantic_final_report_step(
10921092
logger.info(
10931093
"Final research report generated successfully with static template"
10941094
)
1095+
# Add tags to the artifacts
1096+
add_tags(tags=["state", "final"], artifact="state")
1097+
add_tags(tags=["report", "html"], artifact="report_html")
10951098
return state, HTMLString(html_content)
10961099

10971100
# Otherwise use the LLM-generated approach
@@ -1187,6 +1190,9 @@ def pydantic_final_report_step(
11871190
)
11881191

11891192
logger.info("Final research report generated successfully")
1193+
# Add tags to the artifacts
1194+
add_tags(tags=["state", "final"], artifact="state")
1195+
add_tags(tags=["report", "html"], artifact="report_html")
11901196
return state, HTMLString(html_content)
11911197

11921198
except Exception as e:
@@ -1245,4 +1251,7 @@ def pydantic_final_report_step(
12451251
infer_model=True,
12461252
)
12471253

1254+
# Add tags to the artifacts
1255+
add_tags(tags=["state", "final"], artifact="state")
1256+
add_tags(tags=["report", "html"], artifact="report_html")
12481257
return state, HTMLString(fallback_html)

0 commit comments

Comments
 (0)