PageSourceSearch

https://theanswer.ai/assets/js/e81c92eb.04bacfd5.js

js theanswer.ai collected 2026-10-02 00:45:20 UTC 8,149 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[26304],{8667:(e,t,r)=>{r.d(t,{R:()=>o,x:()=>u});var s=r(22155);const n={},i=s.createContext(n);function o(e){const t=s.useContext(i);return s.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function u(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:o(e.components),s.createElement(i.Provider,{value:t},e.children)}},28316:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>u,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"sidekick-studio/chatflows/output-parsers/structured-output-parser","title":"Structured Output Parser","description":"Parse LLM output into structured JSON format","source":"@site/docs/sidekick-studio/chatflows/output-parsers/structured-output-parser.md","sourceDirName":"sidekick-studio/chatflows/output-parsers","slug":"/sidekick-studio/chatflows/output-parsers/structured-output-parser","permalink":"/docs/sidekick-studio/chatflows/output-parsers/structured-output-parser","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"description":"Parse LLM output into structured JSON format"},"sidebar":"docs","previous":{"title":"Custom List Output Parser","permalink":"/docs/sidekick-studio/chatflows/output-parsers/custom-list-output-parser"},"next":{"title":"Prompts","permalink":"/docs/sidekick-studio/chatflows/prompts/"}}');var n=r(65723),i=r(8667);const o={description:"Parse LLM output into structured JSON format"},u="Structured Output Parser",l={},c=[{value:"Overview",id:"overview",level:2},{value:"Key Benefits",id:"key-benefits",level:2},{value:"How to Use",id:"how-to-use",level:2},{value:"Tips and Best Practices",id:"tips-and-best-practices",level:2},{value:"Troubleshooting",id:"troubleshooting",level:2},{value:"Example Usage",id:"example-usage",level:2}];function a(e){const t={a:"a",h1:"h1",h2:"h2",header:"header",li:"li",ol:"ol",p:"p",ul:"ul",...(0,i.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.header,{children:(0,n.jsx)(t.h1,{id:"structured-output-parser",children:"Structured Output Parser"})}),"\n",(0,n.jsx)(t.h2,{id:"overview",children:"Overview"}),"\n",(0,n.jsx)(t.p,{children:"The Structured Output Parser is a powerful feature in AnswerAgentAI that allows you to parse the output of a Language Model (LLM) call into a predefined JSON structure. This tool is essential for extracting structured information from the LLM's responses, making it easier to process and use the data in your workflows."}),"\n",(0,n.jsx)(t.h2,{id:"key-benefits",children:"Key Benefits"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"Standardizes LLM outputs into a consistent, structured JSON format"}),"\n",(0,n.jsx)(t.li,{children:"Improves data extraction and processing from LLM responses"}),"\n",(0,n.jsx)(t.li,{children:"Enables easy integration of LLM outputs with other systems and workflows"}),"\n"]}),"\n",(0,n.jsx)(t.h2,{id:"how-to-use",children:"How to Use"}),"\n",(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"Add the Structured Output Parser node to your AnswerAgentAI canvas."}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"Configure the node with the following settings:"}),"\n",(0,n.jsx)(t.p,{children:"a. Autofix (Optional):"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"Toggle this option to enable automatic fixing of parsing errors."}),"\n",(0,n.jsx)(t.li,{children:"When enabled, if the initial parsing fails, the system will make another call to the model to correct any errors."}),"\n"]}),"\n",(0,n.jsx)(t.p,{children:"b. JSON Structure:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"Define the structure you want the LLM output to conform to."}),"\n",(0,n.jsxs)(t.li,{children:["Add properties to the data grid, specifying:","\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"Property name"}),"\n",(0,n.jsx)(t.li,{children:"Data type (string, number, or boolean)"}),"\n",(0,n.jsx)(t.li,{children:"Description of the property"}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"Connect the Structured Output Parser node to your LLM node in the workflow."}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"Run your workflow to see the parsed, structured output."}),"\n"]}),"\n"]}),"\n",(0,n.jsxs)("figure",{children:[(0,n.jsx)("img",{src:"/.gitbook/assets/screenshots/structuredoutputparser.png",alt:""}),(0,n.jsx)("figcaption",{children:(0,n.jsx)("p",{children:" Structured Output Parser node configuration panel & Drop UI"})})]}),"\n",(0,n.jsx)(t.h2,{id:"tips-and-best-practices",children:"Tips and Best Practices"}),"\n",(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsx)(t.li,{children:"Be specific in your property descriptions to guide the LLM in generating appropriate content."}),"\n",(0,n.jsx)(t.li,{children:"Start with a simple structure and gradually add complexity as needed."}),"\n",(0,n.jsx)(t.li,{children:"Use the Autofix feature when dealing with complex structures or less reliable LLM outputs."}),"\n",(0,n.jsx)(t.li,{children:"Test your parser with various LLM outputs to ensure it handles different scenarios correctly."}),"\n",(0,n.jsxs)(t.li,{children:["If you need nested or more structured outputs, consider using the ",(0,n.jsx)(t.a,{href:"/docs/sidekick-studio/chatflows/output-parsers/advanced-structured-output-parser",children:"Advanced Structured Output Parser"})," node."]}),"\n"]}),"\n",(0,n.jsx)(t.h2,{id:"troubleshooting",children:"Troubleshooting"}),"\n",(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"Invalid JSON Structure:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:'Error: "Invalid JSON in StructuredOutputParser"'}),"\n",(0,n.jsx)(t.li,{children:"Solution: Double-check your JSON structure in the data grid. Ensure all properties have valid names and types."}),"\n"]}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"Parsing Failures:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"Issue: The parser fails to extract the desired information consistently."}),"\n",(0,n.jsx)(t.li,{children:"Solution: Refine your property descriptions, simplify the structure, or enable the Autofix option."}),"\n"]}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"Unexpected Output:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"Issue: The parsed output doesn't match your expectations."}),"\n",(0,n.jsx)(t.li,{children:"Solution: Review your LLM prompt and ensure it aligns with the structure you've defined in the parser."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,n.jsx)(t.h2,{id:"example-usage",children:"Example Usage"}),"\n",(0,n.jsx)(t.p,{children:"Here's a basic example of how to set up the JSON Structure:"}),"\n",(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"Property: answer\r\nType: string\r\nDescription: Answer to the user's question"}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"Property: source\r\nType: string\r\nDescription: Sources used to answer the question, should be websites"}),"\n"]}),"\n"]}),"\n",(0,n.jsx)(t.p,{children:"This structure will parse the LLM output into an object with 'answer' and 'source' fields, making it easy to use this information in subsequent steps of your workflow."}),"\n",(0,n.jsxs)("figure",{children:[(0,n.jsx)("img",{src:"/.gitbook/assets/screenshots/structuredoutputparserinaworkflow.png",alt:""}),(0,n.jsx)("figcaption",{children:(0,n.jsx)("p",{children:" Structured Output Parser node In a workflow & Drop UI"})})]}),"\n",(0,n.jsx)(t.p,{children:"By using the Structured Output Parser, you can transform raw 
1LLM responses into clean, structured data, enhancing the capabilities and reliability of your AnswerAgentAI workflows."})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(a,{...e})}):a(e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.