Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

Fix/pipelex validate all (#465)

Thomas Hebrard51204567038f
diff --git a/pipelex/cli/commands/validate_cmd.py b/pipelex/cli/commands/validate_cmd.py
index 3d827a456..eaf27ac7e 100644
--- a/pipelex/cli/commands/validate_cmd.py
+++ b/pipelex/cli/commands/validate_cmd.py
@@ -32,8 +32,6 @@ COMMAND = "validate"
def do_validate_all_libraries_and_dry_run() -> None:
- pipelex_instance = Pipelex.make(integration_mode=IntegrationMode.CLI)
-
try:
with get_telemetry_manager().telemetry_context():
tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
@@ -54,8 +52,6 @@ def do_validate_all_libraries_and_dry_run() -> None:
handle_model_availability_error(exc, context=ErrorContext.VALIDATION)
except PipeOperatorModelChoiceError as exc:
handle_model_choice_error(exc, context=ErrorContext.VALIDATION)
- finally:
- pipelex_instance.teardown()
def validate_cmd(
@@ -81,9 +77,12 @@ def validate_cmd(
pipelex validate --bundle my_bundle.plx --pipe my_pipe
pipelex validate all
"""
+ pipelex_instance: Pipelex
# Check for "all" keyword
if target == "all" and not pipe and not bundle:
+ pipelex_instance = Pipelex.make(integration_mode=IntegrationMode.CLI)
do_validate_all_libraries_and_dry_run()
+ pipelex_instance.teardown()
return
# Validate mutual exclusivity
@@ -156,8 +155,6 @@ def validate_cmd(
typer.secho("Failed to validate: no pipe code or bundle specified", fg=typer.colors.RED, err=True)
raise typer.Exit(1)
- # Initialize Pipelex
- pipelex_instance: Pipelex
try:
pipelex_instance = Pipelex.make(integration_mode=IntegrationMode.CLI)
except ModelDeckPresetValidatonError as model_deck_error:
diff --git a/tests/e2e/pipelex/cli/test_validate_cmd.py b/tests/e2e/pipelex/cli/test_validate_cmd.py
new file mode 100644
index 000000000..bd9ec0455
--- /dev/null
+++ b/tests/e2e/pipelex/cli/test_validate_cmd.py
@@ -0,0 +1,6 @@
+from pipelex.cli.commands.validate_cmd import do_validate_all_libraries_and_dry_run
+
+
+class TestValidateCommand:
+ def test_validate_all(self):
+ do_validate_all_libraries_and_dry_run()
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/discord_newsletter.plx b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/discord_newsletter.plx
index f912d9308..e5585be3c 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/discord_newsletter.plx
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/discord_newsletter.plx
@@ -1,37 +1,37 @@
-domain = "discord_newsletter"
+domain = "discord_newsletter_e2e"
description = "Create newsletters from Discord channel content by summarizing messages and organizing them according to newsletter format"
[concept]
-DiscordChannelUpdate = "A Discord channel with its messages for newsletter generation"
-ChannelSummary = "A summarized Discord channel for newsletter inclusion"
-HtmlNewsletter = "The final newsletter content in html format with organized channel summaries"
+DiscordChannelUpdateE2E = "A Discord channel with its messages for newsletter generation"
+ChannelSummaryE2E = "A summarized Discord channel for newsletter inclusion"
+HtmlNewsletterE2E = "The final newsletter content in html format with organized channel summaries"
-[pipe.write_discord_newsletter]
+[pipe.write_discord_newsletter_e2e]
type = "PipeSequence"
description = "Create a newsletter from Discord articles by summarizing channels and organizing content"
-inputs = { discord_channel_updates = "DiscordChannelUpdate[]" }
-output = "HtmlNewsletter"
+inputs = { discord_channel_updates = "DiscordChannelUpdateE2E[]" }
+output = "HtmlNewsletterE2E"
steps = [
- { pipe = "summarize_discord_channel_update", batch_over = "discord_channel_updates", batch_as = "discord_channel_update", result = "channel_summaries" },
- { pipe = "write_weekly_summary", result = "weekly_summary" },
- { pipe = "format_html_newsletter", result = "html_newsletter" },
+ { pipe = "summarize_discord_channel_update_e2e", batch_over = "discord_channel_updates", batch_as = "discord_channel_update", result = "channel_summaries" },
+ { pipe = "write_weekly_summary_e2e", result = "weekly_summary" },
+ { pipe = "format_html_newsletter_e2e", result = "html_newsletter" },
]
-[pipe.summarize_discord_channel_update]
+[pipe.summarize_discord_channel_update_e2e]
type = "PipeCondition"
description = "Select the appropriate summary pipe based on the channel name"
-inputs = { discord_channel_update = "DiscordChannelUpdate" }
-output = "ChannelSummary"
+inputs = { discord_channel_update = "DiscordChannelUpdateE2E" }
+output = "ChannelSummaryE2E"
expression = "discord_channel_update.name"
-outcomes = { "Introduce-Yourself" = "summarize_discord_channel_update_for_new_members" }
-default_outcome = "summarize_discord_channel_update_general"
+outcomes = { "Introduce-Yourself" = "summarize_discord_channel_update_for_new_members_e2e" }
+default_outcome = "summarize_discord_channel_update_general_e2e"
-[pipe.summarize_discord_channel_update_for_new_members]
+[pipe.summarize_discord_channel_update_for_new_members_e2e]
type = "PipeLLM"
description = "Summarize the new member announcements"
-inputs = { discord_channel_update = "DiscordChannelUpdate" }
-output = "ChannelSummary"
+inputs = { discord_channel_update = "DiscordChannelUpdateE2E" }
+output = "ChannelSummaryE2E"
system_prompt = "You are a newsletter editor who creates engaging summaries of Discord channel content. You extract key information, preserve important links, and write in a clear, concise style suitable for newsletter readers."
prompt = """
Analyze this Discord channel update and create a newsletter-friendly summary.
@@ -42,11 +42,11 @@ Channel Information:
Summarize with one bullet point for each new member
"""
-[pipe.summarize_discord_channel_update_general]
+[pipe.summarize_discord_channel_update_general_e2e]
type = "PipeLLM"
description = "Summarize a Discord channel's messages into newsletter-friendly content"
-inputs = { discord_channel_update = "DiscordChannelUpdate" }
-output = "ChannelSummary"
+inputs = { discord_channel_update = "DiscordChannelUpdateE2E" }
+output = "ChannelSummaryE2E"
system_prompt = "You are a newsletter editor who creates engaging summaries of Discord channel content. You extract key information, preserve important links, and write in a clear, concise style suitable for newsletter readers."
prompt = """
Analyze this Discord channel update and create a newsletter-friendly summary.
@@ -61,10 +61,10 @@ Each summary item should be in plain text, no bullet points. You can make some p
Make sure to preserve the channel name and position from the input for proper ordering in the newsletter.
"""
-[pipe.write_weekly_summary]
+[pipe.write_weekly_summary_e2e]
type = "PipeLLM"
description = "Combine channel summaries into a short summary of the week's Share channel content (200 characters)"
-inputs = { channel_summaries = "ChannelSummary" }
+inputs = { channel_summaries = "ChannelSummaryE2E" }
output = "Text"
prompt = """
Write a single overall summary of the week's content based on the following Share channel summaries:
@@ -76,13 +76,13 @@ Write a single overall summary of the week's content based on the following Shar
Keep it short: 200 characters.
"""
-[pipe.format_html_newsletter]
+[pipe.format_html_newsletter_e2e]
type = "PipeCompose"
description = "Combine weekly and channel summaries into a complete newsletter following specific formatting requirements"
-inputs = { weekly_summary = "Text", channel_summaries = "ChannelSummary" }
-output = "HtmlNewsletter"
+inputs = { weekly_summary = "Text", channel_summaries = "ChannelSummaryE2E" }
+output = "HtmlNewsletterE2E"
-[pipe.format_html_newsletter.template]
+[pipe.format_html_newsletter_e2e.template]
category = "html"
template = """
<!-- Weekly Summary -->
diff --git a/tests/e2e/pipelex/pipes/pipe_operators/pipe_llm_vision.plx b/tests/e2e/pipelex/pipes/pipe_operators/pipe_llm_vision.plx
index aa5cb6e83..66458a666 100644
--- a/tests/e2e/pipelex/pipes/pipe_operators/pipe_llm_vision.plx
+++ b/tests/e2e/pipelex/pipes/pipe_operators/pipe_llm_vision.plx
@@ -1,15 +1,15 @@
-domain = "pipe_llm_vision"
+domain = "pipe_llm_vision_e2e"
description = "Test PipeLLM with vision capabilities"
[concept]
-VisionAnalysis = "Some analysis based on the image"
-BasicDescription = "Basic description of the image"
+VisionAnalysisE2E = "Some analysis based on the image"
+BasicDescriptionE2E = "Basic description of the image"
-[concept.Photo]
+[concept.PhotoE2E]
description = "A photo"
refines = "Image"
-[pipe.describe_image]
+[pipe.describe_image_e2e]
type = "PipeLLM"
description = "Describe what is in the image"
inputs = { image = "Image" }
@@ -20,22 +20,22 @@ Describe what you see in this image in 1-2 sentences, be concise.
$image
"""
-[pipe.describe_image_number_1_only]
+[pipe.describe_image_number_1_only_e2e]
type = "PipeLLM"
description = "Describe what is in the image"
inputs = { image_a = "Image", image_b = "Image" }
-output = "BasicDescription"
+output = "BasicDescriptionE2E"
model = "llm_for_diagram_to_text"
prompt = """
Describe what you see in $image_a only.
Completely ignore $image_b.
"""
-[pipe.describe_image_number_2_only]
+[pipe.describe_image_number_2_only_e2e]
type = "PipeLLM"
description = "Describe what is in the image"
inputs = { image_a = "Image", image_b = "Image" }
-output = "BasicDescription"
+output = "BasicDescriptionE2E"
model = "llm_for_diagram_to_text"
prompt = """
Describe what you see in $image_b only.
@@ -43,11 +43,11 @@ Completely ignore $image_a.
"""
-[pipe.vision_analysis]
+[pipe.vision_analysis_e2e]
type = "PipeLLM"
description = "Provide detailed analysis of the image"
-inputs = { image = "Photo" }
-output = "VisionAnalysis"
+inputs = { image = "PhotoE2E" }
+output = "VisionAnalysisE2E"
model = "llm_for_diagram_to_text"
system_prompt = "You are an expert image analyst. Provide detailed, accurate descriptions."
prompt = """
diff --git a/tests/integration/pipelex/pipes/test_flow_factory/discord_newsletter.plx b/tests/integration/pipelex/pipes/test_flow_factory/discord_newsletter.plx
index f912d9308..89e5060aa 100644
--- a/tests/integration/pipelex/pipes/test_flow_factory/discord_newsletter.plx
+++ b/tests/integration/pipelex/pipes/test_flow_factory/discord_newsletter.plx
@@ -1,37 +1,37 @@
-domain = "discord_newsletter"
+domain = "discord_newsletter_flow"
description = "Create newsletters from Discord channel content by summarizing messages and organizing them according to newsletter format"
[concept]
-DiscordChannelUpdate = "A Discord channel with its messages for newsletter generation"
-ChannelSummary = "A summarized Discord channel for newsletter inclusion"
-HtmlNewsletter = "The final newsletter content in html format with organized channel summaries"
+DiscordChannelUpdateFlow = "A Discord channel with its messages for newsletter generation"
+ChannelSummaryFlow = "A summarized Discord channel for newsletter inclusion"
+HtmlNewsletterFlow = "The final newsletter content in html format with organized channel summaries"
-[pipe.write_discord_newsletter]
+[pipe.write_discord_newsletter_flow]
type = "PipeSequence"
description = "Create a newsletter from Discord articles by summarizing channels and organizing content"
-inputs = { discord_channel_updates = "DiscordChannelUpdate[]" }
-output = "HtmlNewsletter"
+inputs = { discord_channel_updates = "DiscordChannelUpdateFlow[]" }
+output = "HtmlNewsletterFlow"
steps = [
- { pipe = "summarize_discord_channel_update", batch_over = "discord_channel_updates", batch_as = "discord_channel_update", result = "channel_summaries" },
- { pipe = "write_weekly_summary", result = "weekly_summary" },
- { pipe = "format_html_newsletter", result = "html_newsletter" },
+ { pipe = "summarize_discord_channel_update_flow", batch_over = "discord_channel_updates", batch_as = "discord_channel_update", result = "channel_summaries" },
+ { pipe = "write_weekly_summary_flow", result = "weekly_summary" },
+ { pipe = "format_html_newsletter_flow", result = "html_newsletter" },
]
-[pipe.summarize_discord_channel_update]
+[pipe.summarize_discord_channel_update_flow]
type = "PipeCondition"
description = "Select the appropriate summary pipe based on the channel name"
-inputs = { discord_channel_update = "DiscordChannelUpdate" }
-output = "ChannelSummary"
+inputs = { discord_channel_update = "DiscordChannelUpdateFlow" }
+output = "ChannelSummaryFlow"
expression = "discord_channel_update.name"
-outcomes = { "Introduce-Yourself" = "summarize_discord_channel_update_for_new_members" }
-default_outcome = "summarize_discord_channel_update_general"
+outcomes = { "Introduce-Yourself" = "summarize_discord_channel_update_for_new_members_flow" }
+default_outcome = "summarize_discord_channel_update_general_flow"
-[pipe.summarize_discord_channel_update_for_new_members]
+[pipe.summarize_discord_channel_update_for_new_members_flow]
type = "PipeLLM"
description = "Summarize the new member announcements"
-inputs = { discord_channel_update = "DiscordChannelUpdate" }
-output = "ChannelSummary"
+inputs = { discord_channel_update = "DiscordChannelUpdateFlow" }
+output = "ChannelSummaryFlow"
system_prompt = "You are a newsletter editor who creates engaging summaries of Discord channel content. You extract key information, preserve important links, and write in a clear, concise style suitable for newsletter readers."
prompt = """
Analyze this Discord channel update and create a newsletter-friendly summary.
@@ -42,11 +42,11 @@ Channel Information:
Summarize with one bullet point for each new member
"""
-[pipe.summarize_discord_channel_update_general]
+[pipe.summarize_discord_channel_update_general_flow]
type = "PipeLLM"
description = "Summarize a Discord channel's messages into newsletter-friendly content"
-inputs = { discord_channel_update = "DiscordChannelUpdate" }
-output = "ChannelSummary"
+inputs = { discord_channel_update = "DiscordChannelUpdateFlow" }
+output = "ChannelSummaryFlow"
system_prompt = "You are a newsletter editor who creates engaging summaries of Discord channel content. You extract key information, preserve important links, and write in a clear, concise style suitable for newsletter readers."
prompt = """
Analyze this Discord channel update and create a newsletter-friendly summary.
@@ -61,10 +61,10 @@ Each summary item should be in plain text, no bullet points. You can make some p
Make sure to preserve the channel name and position from the input for proper ordering in the newsletter.
"""
-[pipe.write_weekly_summary]
+[pipe.write_weekly_summary_flow]
type = "PipeLLM"
description = "Combine channel summaries into a short summary of the week's Share channel content (200 characters)"
-inputs = { channel_summaries = "ChannelSummary" }
+inputs = { channel_summaries = "ChannelSummaryFlow" }
output = "Text"
prompt = """
Write a single overall summary of the week's content based on the following Share channel summaries:
@@ -76,13 +76,13 @@ Write a single overall summary of the week's content based on the following Shar
Keep it short: 200 characters.
"""
-[pipe.format_html_newsletter]
+[pipe.format_html_newsletter_flow]
type = "PipeCompose"
description = "Combine weekly and channel summaries into a complete newsletter following specific formatting requirements"
-inputs = { weekly_summary = "Text", channel_summaries = "ChannelSummary" }
-output = "HtmlNewsletter"
+inputs = { weekly_summary = "Text", channel_summaries = "ChannelSummaryFlow" }
+output = "HtmlNewsletterFlow"
-[pipe.format_html_newsletter.template]
+[pipe.format_html_newsletter_flow.template]
category = "html"
template = """
<!-- Weekly Summary -->
diff --git a/tests/integration/pipelex/pipes/test_flow_factory/test_flow_factory.py b/tests/integration/pipelex/pipes/test_flow_factory/test_flow_factory.py
index 89241ae48..16156aaec 100644
--- a/tests/integration/pipelex/pipes/test_flow_factory/test_flow_factory.py
+++ b/tests/integration/pipelex/pipes/test_flow_factory/test_flow_factory.py
@@ -88,7 +88,7 @@ class TestFlowFactory:
flow = FlowFactory.make_from_plx_file(plx_file_path)
# Find the sequence pipe
- sequence_element = flow.flow_elements.get("write_discord_newsletter")
+ sequence_element = flow.flow_elements.get("write_discord_newsletter_flow")
assert sequence_element is not None
assert sequence_element.controller_blueprint is not None
assert sequence_element.controller_blueprint.type == "PipeSequence"
@@ -111,7 +111,7 @@ class TestFlowFactory:
flow = FlowFactory.make_from_plx_file(plx_file_path)
# Find an operator pipe (LLM pipe) - converted to signature
- operator_element = flow.flow_elements.get("summarize_discord_channel_update_for_new_members")
+ operator_element = flow.flow_elements.get("summarize_discord_channel_update_for_new_members_flow")
assert operator_element is not None
assert operator_element.operator_signature is not None
assert isinstance(operator_element.operator_signature, PipeSignature)