Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cli/decompose/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def decompose(
).parse()

constraint_validation_strategies: dict[str, Literal["code", "llm"]] = {
cons_key: validation_decision.generate(m_session, cons_key).parse()
cons_key: validation_decision.generate(m_session, cons_key).parse() or "llm"
for cons_key in task_prompt_constraints
}

Expand All @@ -142,7 +142,9 @@ def decompose(
constraints=[
{
"constraint": cons_str,
"validation_strategy": constraint_validation_strategies[cons_str],
"validation_strategy": constraint_validation_strategies.get(
cons_str, "llm"
),
Comment on lines +145 to +147
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@csbobby, can you please confirm that you are okay with changing this and always having an LLM default?

Copy link
Copy Markdown
Contributor

@csbobby csbobby Mar 11, 2026

Choose a reason for hiding this comment

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

Hi @AngeloDanducci @jakelorocco Thank you for sharing this.
Yes, adding a fallback setup "llm" looks good point.

  • We tested the extraction feature by using the mainstream models/APIs. Typically, it works well on both regular or larger sizes (7B or +). We don't recommend to use the weaker llms since the output quality will be potentially different or unpredictable. But if any user encounter it, the "llm" seems will helpful to provide a best try on meaningful constraint content instead of a program error. If you think this satisfy our intent Mellea usage for users, also looks good to me.

About the fix, the ideal position I think is the first position of the error occurred.

  • The cons_key is the validation strategy, and the cons_str is the validation type (llm/code) for the following up execution. The extraction failure (if there is) of the validation type will be detected on the validation_decision.generate(m_session, cons_key).parse() at (L119 ).
  • I would suggest to add the fallback to the extraction failure position at (L119 ) rather than other following steps (e.g., on the returned DecompPipelineResult (L145-147) in the original fix).

That would keep the consistency for the fallbacked cons_str.

Line 119

    constraint_validation_strategies: dict[str, Literal["code", "llm"]] = {
        cons_key: validation_decision.generate(m_session, cons_key).parse() or "llm"
        for cons_key in task_prompt_constraints
    }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI, also completed #556.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks @csbobby - I've added the default value to line 119.

However I've also kept the update on 145.

I think the update on line 145 handles cases where a constraint in subtask_data.constraints doesn't exist as a key in constraint_validation_strategies at all (which happened when I ran this example).

}
for cons_str in subtask_data.constraints
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def run_decompose(task_prompt: str) -> DecompPipelineResult:

result = decompose(
task_prompt=task_prompt,
model_id="granite4:micro",
model_id="granite3.3:8b", # Note micro will not properly create tags, need 8b
backend=DecompBackend.ollama, # Use Ollama backend
backend_req_timeout=300, # 5 minute timeout
)
Expand Down Expand Up @@ -84,7 +84,9 @@ def generate_python_script(
print("\n📝 Generating executable Python script...")

# Load the template from the CLI decompose directory
cli_decompose_dir = Path(__file__).parent.parent.parent.parent / "cli" / "decompose"
cli_decompose_dir = (
Path(__file__).parent.parent.parent.parent.parent / "cli" / "decompose"
)
environment = Environment(
loader=FileSystemLoader(cli_decompose_dir), autoescape=False
)
Expand Down