Skip to content

feat: (m-decompose) Module Prompt V3#770

Open
csbobby wants to merge 21 commits intogenerative-computing:mainfrom
csbobby:tagparse
Open

feat: (m-decompose) Module Prompt V3#770
csbobby wants to merge 21 commits intogenerative-computing:mainfrom
csbobby:tagparse

Conversation

@csbobby
Copy link
Copy Markdown
Contributor

@csbobby csbobby commented Apr 1, 2026

Module Prompt V3

Description

  • Enhance the module execution and extraction robustness.

Implementation Checklist

Protocol Compliance

  • parts() returns list of constituent parts (Components or CBlocks)
  • format_for_llm() returns TemplateRepresentation or string
  • _parse(computed: ModelOutputThunk) parses model output correctly into the specified Component return type

Testing

  • Tests added to tests/components/
  • New code has 100% coverage
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

@csbobby csbobby requested a review from a team as a code owner April 1, 2026 03:16
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

The PR description has been updated. Please fill out the template for your PR to be reviewed.

@csbobby csbobby changed the title Tagparse feat (m decompose) Module Prompt V3 Apr 1, 2026
@csbobby csbobby changed the title feat (m decompose) Module Prompt V3 feat (m decompose): Module Prompt V3 Apr 1, 2026
@csbobby csbobby changed the title feat (m decompose): Module Prompt V3 feat: (m-decompose) Module Prompt V3 Apr 1, 2026
@github-actions github-actions bot added the enhancement New feature or request label Apr 1, 2026
@csbobby csbobby requested a review from a team as a code owner April 1, 2026 18:46
@csbobby csbobby removed the request for review from a team April 1, 2026 22:46
@csbobby
Copy link
Copy Markdown
Contributor Author

csbobby commented Apr 1, 2026

Updated the modular prompts to adapt the recent llms.

@csbobby csbobby enabled auto-merge April 2, 2026 06:16
@csbobby csbobby disabled auto-merge April 2, 2026 06:18
@csbobby
Copy link
Copy Markdown
Contributor Author

csbobby commented Apr 2, 2026

Hi This passes the tests and ready to be reviewed @jakelorocco.

@csbobby csbobby requested a review from jakelorocco April 6, 2026 15:16
Copy link
Copy Markdown
Contributor

@planetf1 planetf1 left a comment

Choose a reason for hiding this comment

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

A few observations — mostly around parsing robustness and test coverage. Also worth checking whether the from e exception-chaining fix applied in _general_instructions.py is needed in any equivalent except blocks in _subtask_constraint_assign.py.

raise TagExtractionError(
'LLM failed to generate correct tags for extraction: "<assigned_constraints>"'
)
subtask_constraint_assign_str = re.sub(
Copy link
Copy Markdown
Contributor

@planetf1 planetf1 Apr 7, 2026

Choose a reason for hiding this comment

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

pattern is already compiled as RE_FINAL_SENTENCE in _general_instructions.py — could extract rather than re-compiling on every iteration.

subtask_constraint_assign_match.group(1).strip()
if subtask_constraint_assign_match
else None
else data[3].strip()
Copy link
Copy Markdown
Contributor

@planetf1 planetf1 Apr 7, 2026

Choose a reason for hiding this comment

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

silently swallows the block when the tag is missing. general-instructions parser has a nicer graduated fallback (open-tag-only). Log warning at a minimum (how do we return?)

#MODEL_ID=granite4:latest

MODEL_ID=qwen2.5:7b
MODEL_ID=mistral-small3.2:latest # granite4:latest
Copy link
Copy Markdown
Contributor

@planetf1 planetf1 Apr 7, 2026

Choose a reason for hiding this comment

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

Hardcoded model mistral-small3.2:latest —can we make it variable?
Is the model used documented in the test docs?
How much memory does it need? Is it reasonable on a smaller system (though if it's needed for results, understandable).

continue

# Only keep lines starting with "- "
if stripped.startswith("- "):
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.

This silently drops any constraint not prefixed with - (e.g. numbered lists). The old code kept those. Might be worth logging skipped lines or broadening the heuristic a touch.


# Remove duplicates while preserving order
subtask_constraint_assign = list(
dict.fromkeys(subtask_constraint_assign)
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.

Probably fine in practice, but dict.fromkeys will quietly collapse genuinely distinct constraints that happen to share identical text.

)

assert requested_templates == ["m_decomp_result_v2.py.jinja2"]
assert requested_templates == ["m_decomp_result_v3.py.jinja2"]
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.

The new fallback parsing paths (open-tag-only, final-sentence stripping, - filtering) don't seem to have dedicated tests yet — could we add a few unit cases?

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.

Would this example work with a newer granite4 model?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants