Skip to content

feat(Structured Output Parser Node): Add auto-fix support to Strucutred Output Parser #15915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Cadiac
Copy link
Contributor

@Cadiac Cadiac commented Jun 2, 2025

Summary

This PR merges Auto-fixing Output Parser auto-fix functionality to Structured Output Parser node. User can now turn on Auto-Fix on these nodes, and optionally provide a custom prompt instructions for fixing the output like on the auto-fixing node. If Auto-Fix mode is enabled a Model input has to be connected to the node.

autofix.mp4

With this change Auto-fixing Output Parser is should be considered deprecated, as the Structured Output Parser now offers the same functionality. The old node is still kept available for now, with a 'Deprecated' tag on it and we may remove it in the future.

This is the first time we're displaying such 'Deprecated' tag - to display it, make node's description contain string "deprecated". In future we may want to add a way to add tags node definitions.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/ADO-3549/merge-auto-fixing-and-structured-output-nodes

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@@ -163,7 +173,7 @@ function onCommunityNodeTooltipClick(event: MouseEvent) {
:is-trigger="isTrigger"
:is-official="isOfficial"
:data-test-id="dataTestId"
:tag="nodeType.tag"
Copy link
Contributor Author

@Cadiac Cadiac Jun 2, 2025

Choose a reason for hiding this comment

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

nodeType.tag was typed string | undefined but this component expects an object, so I don't think this would've worked before - but it also looks like no nodes used this mechanism. I did fix the typing issue on the computed value now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍

Copy link

codecov bot commented Jun 2, 2025

Codecov Report

Attention: Patch coverage is 70.83333% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...components/Node/NodeCreator/ItemTypes/NodeItem.vue 40.00% 6 Missing ⚠️
...putParserStructured/OutputParserStructured.node.ts 92.30% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Cadiac Cadiac marked this pull request as ready for review June 2, 2025 09:52
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic found 11 issues across 6 files. Review them in cubic.dev

React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.

@@ -0,0 +1,16 @@
export const NAIVE_FIX_PROMPT = `Instructions:
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate implementation of NAIVE_FIX_PROMPT that already exists in other files. Consider importing from a shared location instead of duplicating.

Suggested change
export const NAIVE_FIX_PROMPT = `Instructions:
export { NAIVE_FIX_PROMPT } from '../../../utils/output_parsers/prompt';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Intentionally took a copy of it to make this independent of the old auto-fixing node.

@n8n-assistant n8n-assistant bot added the n8n team Authored by the n8n team label Jun 2, 2025
@Cadiac Cadiac requested review from a team and nikhilkuria June 2, 2025 10:02
Copy link
Contributor

@nikhilkuria nikhilkuria left a comment

Choose a reason for hiding this comment

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

Nice work 👏

inputs: [],
inputs: `={{
((parameters) => {
if (parameters?.autoFix) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, I think we really need to work on the inputs being loaded dynamically in the NDV.

@@ -163,7 +173,7 @@ function onCommunityNodeTooltipClick(event: MouseEvent) {
:is-trigger="isTrigger"
:is-official="isOfficial"
:data-test-id="dataTestId"
:tag="nodeType.tag"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍

@shortstacked
Copy link
Contributor

Workflow Test Results 📊 🔴 2 Failed, ⚠️ 4 Warnings, 👍 77 Successful out of 83 total workflows.

Detail: Workflows failing: 237: Workflow contains 1 deleted data. View full workflow run

Tested Ref: 91580d27d2daba007db98f8b9ffa7c073f7f5dab by @nikhilkuria

❌ Failed Tests (2)

Workflow ID Workflow Name Reason
237 BasicLLMChain:AzureChat Workflow contains 1 deleted data.
258 Agent:auto-fix:openai Workflow contains 2 deleted data.

⚠️ Warnings (4)

Workflow ID Workflow Name Reason
35 Slack:User:getPresence info:UserProfile:get update... Workflow contains new data that previously did not exist.
53 ConvertKit:CustomField:create getAll update delete... Workflow contains new data that previously did not exist.
257 Agent:auto-fix:anthropic Workflow contains new data that previously did not exist.
48 Asana:Project:getAll get:Task:create update move g... Workflow contains new data that previously did not exist.

Copy link
Contributor

github-actions bot commented Jun 4, 2025

✅ All Cypress E2E specs passed

@Cadiac Cadiac merged commit 4f07ac3 into master Jun 4, 2025
85 checks passed
@Cadiac Cadiac deleted the ado-3549-spike-merge-auto-fixing-and-structured-output-nodes branch June 4, 2025 09:07
Alexandero89 pushed a commit to Alexandero89/n8n that referenced this pull request Jun 4, 2025
Alexandero89 pushed a commit to Alexandero89/n8n that referenced this pull request Jun 4, 2025
@janober
Copy link
Member

janober commented Jun 11, 2025

Got released with [email protected]

TianYi0217 pushed a commit to TianYi0217/n8n that referenced this pull request Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants