1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[18797],{8667:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(22155);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}},11069:(e,t,n)=>{n.d(t,{u:()=>p,v:()=>d});var s=n(22155),o=n(62934),r=n(17515),i=n(65363),a=n(59572),l=n(8528);function d(e){return s.Children.toArray(e).filter(e=>"\n"!==e).map(e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)})?.filter(Boolean)??[]}function c(e){const{values:t,children:n}=e;return(0,s.useMemo)(()=>{const e=t??function(e){return d(e).map(({props:{value:e,label:t,attributes:n,default:s}})=>({value:e,label:t,attributes:n,default:s}))}(n);return function(e){const t=(0,l.XI)(e,(e,t)=>e.value===t.value);if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map(e=>e.value).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e},[t,n])}function u({value:e,tabValues:t}){return t.some(t=>t.value===e)}function h({queryString:e=!1,groupId:t}){const n=(0,o.W6)(),r=function({queryString:e=!1,groupId:t}){if("string"==typeof e)return e;if(!1===e)return null;if(!0===e&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:e,groupId:t});return[(0,i.aZ)(r),(0,s.useCallback)(e=>{if(!r)return;const t=new URLSearchParams(n.location.search);t.set(r,e),n.replace({...n.location,search:t.toString()})},[r,n])]}function p(e){const{defaultValue:t,queryString:n=!1,groupId:o}
1=e,i=c(e),[l,d]=(0,s.useState)(()=>function({defaultValue:e,tabValues:t}){if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(e){if(!u({value:e,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${e}" but none of its children has the corresponding value. Available values are: ${t.map(e=>e.value).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return e}const n=t.find(e=>e.default)??t[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:i})),[p,f]=h({queryString:n,groupId:o}),[m,g]=function({groupId:e}){const t=function(e){return e?`docusaurus.tab.${e}`:null}(e),[n,o]=(0,a.Dv)(t);return[n,(0,s.useCallback)(e=>{t&&o.set(e)},[t,o])]}({groupId:o}),x=(()=>{const e=p??m;return u({value:e,tabValues:i})?e:null})();(0,r.A)(()=>{x&&d(x)},[x]);return{selectedValue:l,selectValue:(0,s.useCallback)(e=>{if(!u({value:e,tabValues:i}))throw new Error(`Can't select invalid tab value=${e}`);d(e),f(e),g(e)},[f,g,i]),tabValues:i}}},51580:(e,t,n)=>{n.d(t,{A:()=>p});var s=n(22155),o=n(70851),r=n(2910),i=n(11069),a=n(82889);const l={tabList:"tabList_eqjL",tabItem:"tabItem_aml6"};var d=n(65723);function c({className:e,block:t,selectedValue:n,selectValue:s,tabValues:i}){const a=[],{blockElementScrollPositionUntilNextRender:c}=(0,r.a_)(),u=e=>{const t=e.currentTarget,o=a.indexOf(t),r=i[o].value;r!==n&&(c(t),s(r))},h=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=a.indexOf(e.currentTarget)+1;t=a[n]??a[0];break}case"ArrowLeft":{const n=a.indexOf(e.currentTarget)-1;t=a[n]??a[a.length-1];break}}t?.focus()};return(0,d.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.A)("tabs",{"tabs--block":t},e),children:i.map(({value:e,label:t,attributes:s})=>(0,d.jsx)("li",{role:"tab",tabIndex:n===e?0:-1,"aria-selected":n===e,ref:e=>{a.push(e)},onKeyDown:h,onClick:u,...s,className:(0,o.A)("tabs__item",l.tabItem,s?.className,{"tabs__item--active":n===e}),children:t??e},e))})}function u({lazy:e,children:t,selectedValue:n}){const r=(Array.isArray(t)?t:[t]).filter(Boolean);if(e){const e=r.find(e=>e.props.value===n);return e?(0,s.cloneElement)(e,{className:(0,o.A)("margin-top--md",e.props.className)}):null}return(0,d.jsx)("div",{className:"margin-top--md",children:r.map((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==n}))})}function h(e){const t=(0,i.u)(e);return(0,d.jsxs)("div",{className:(0,o.A)("tabs-container",l.tabList),
1children:[(0,d.jsx)(c,{...t,...e}),(0,d.jsx)(u,{...t,...e})]})}function p(e){const t=(0,a.default)();return(0,d.jsx)(h,{...e,children:(0,i.v)(e.children)},String(t))}},72474:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});n(22155);var s=n(70851);const o={tabItem:"tabItem_U_yJ"};var r=n(65723);function i({children:e,hidden:t,className:n}){return(0,r.jsx)("div",{role:"tabpanel",className:(0,s.A)(o.tabItem,n),hidden:t,children:e})}},98677:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>d,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"sidekick-studio/agentflows/sequential-agents/llm-node","title":"LLM Node","description":"Understanding the LLM Node in Sequential Agents","source":"@site/docs/sidekick-studio/agentflows/sequential-agents/llm-node.md","sourceDirName":"sidekick-studio/agentflows/sequential-agents","slug":"/sidekick-studio/agentflows/sequential-agents/llm-node","permalink":"/docs/sidekick-studio/agentflows/sequential-agents/llm-node","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"description":"Understanding the LLM Node in Sequential Agents"},"sidebar":"docs","previous":{"title":"End Node","permalink":"/docs/sidekick-studio/agentflows/sequential-agents/end-node"},"next":{"title":"Loop Node","permalink":"/docs/sidekick-studio/agentflows/sequential-agents/loop-node"}}');var o=n(65723),r=n(8667),i=n(51580),a=n(72474);const l={description:"Understanding the LLM Node in Sequential Agents"},d="LLM Node",c={},u=[{value:"Understanding the LLM Node",id:"understanding-the-llm-node",level:2},{value:"Inputs",id:"inputs",level:2},{value:"Outputs",id:"outputs",level:2},{value:"Features",id:"features",level:2},{value:"JSON Structured Output",id:"json-structured-output",level:3},{value:"State Management",id:"state-management",level:3},{value:"Best Practices",id:"best-practices",level:2}];function h(e){const t={code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"llm-node",children:"LLM Node"})}),"\n",(0,o.jsxs)(t.p,{children:["The LLM Node is a ",(0,o.jsx)(t.strong,{children:"specialized node that leverages language models to generate responses"})," based on conversation context. Unlike the Agent Node, the LLM Node does not make autonomous decisions about when to use tools or execute external actions. Instead, it focuses on generating high-quality text responses with flexible output formatting options."]}),"\n",(0,o.jsx)(t.h2,{id:"understanding-the-llm-node",children:"Understanding the LLM Node"}),"\n",(0,o.jsxs)(t.p,{children:["The LLM Node processes input from previous nodes, including the conversation history ",(0,o.jsx)(t.code,{children:"state.messages"})," and any custom State, and uses a language model to generate a response based on a System Prompt and optional configuration settings. It is particularly useful for:"]}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.strong,{children:"Generating responses when no external tools are required"})}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Processing, analyzing, or transforming data"})," in the State"]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Creating structured outputs"})," in JSON format for consumption by other nodes"]}),"\n"]}),"\n",(0,o.jsx)(t.h2,{id:"inputs",children:"Inputs"}),"\n",(0,o.jsxs)(t.table,{children:[(0,o.jsx)(t.thead,{children:(0,o.jsxs)(t.tr,{children:[(0,o.jsx)(t.th,{}),(0,o.jsx)(t.th,{children:"Required"}),(0,o.jsx)(t.th,{children:"Description"})]})}),(0,o.jsxs)(t.tbody,{children:[(0,o.jsxs)(t.tr,{children:[(0,o.jsx)(t.td,{children:"System Prompt"}),(0,o.jsx)(t.td,{children:(0,o.jsx)(t.strong,{children:"Yes"})}),(0,o.jsxs)(t.td,{children:["Text prompt that ",(0,o.jsx)(t.strong,{children:"defines the LLM's role and response parameters"}),"."]})]}),(0,o.jsxs)(t.tr,{children:[(0,o.jsx)(t.td,{children:"Chat Model"}),(0,o.jsx)(t.td,{children:"No"}),(0,o.jsxs)(t.td,{children:["A custom ",(0,o.jsx)(t.strong,{children:"Chat Model (LLM)"})," to use instead of the default one defined in the Start Node."]})]}),(0,o.jsxs)(t.tr,{children:[(0,o.jsx)(t.td,{children:"JSON Schema"}),(0,o.jsx)(t.td,{children:"No"}),(0,o.jsx)(t.td,{children:"A schema defining the structure of the LLM Node's response when JSON Structured Output is enabled."})]}),(0,o.jsxs)(t.tr,{children:[(0,o.jsx)(t.td,{children:"Enable JSON Structured Output"}),(0,o.jsx)(t.td,{children:"No"}),(0,o.jsxs)(t.td,{children:["A configuration to ",(0,o.jsx)(t.strong,{children:"force the LLM Node's response to follow"}
1)," a predefined JSON schema."]})]}),(0,o.jsxs)(t.tr,{children:[(0,o.jsx)(t.td,{children:"Update State"}),(0,o.jsx)(t.td,{children:"No"}),(0,o.jsxs)(t.td,{children:["A JSON object that defines ",(0,o.jsx)(t.strong,{children:"how the LLM Node should update the custom State"})," before passing it to the next node."]})]})]})]}),"\n",(0,o.jsx)(t.h2,{id:"outputs",children:"Outputs"}),"\n",(0,o.jsx)(t.p,{children:"The LLM Node can connect to the following nodes as outputs:"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Agent Node:"})," Connects to an Agent Node to continue the conversation with an agent that can access tools."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"LLM Node:"})," Routes the conversation flow to another LLM Node for additional processing or response generation."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Condition Agent Node:"})," Connects to a Condition Agent Node to implement branching logic based on the agent's evaluation of the conversation."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Condition Node:"})," Connects to a Condition Node to implement branching logic based on predefined conditions."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Loop Node:"})," Connects to a Loop Node to implement repetitive processes based on specific conditions."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"End Node:"})," Connects to an End Node to conclude the conversational flow."]}),"\n"]}),"\n",(0,o.jsx)(t.h2,{id:"features",children:"Features"}),"\n",(0,o.jsx)(t.h3,{id:"json-structured-output",children:"JSON Structured Output"}),"\n",(0,o.jsx)(t.p,{children:'When the "Enable JSON Structured Output" option is enabled, the LLM Node can generate responses that conform to a predefined JSON schema. This is particularly useful when:'}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["You need to extract ",(0,o.jsx)(t.strong,{children:"specific data points"})," from the LLM's analysis"]}),"\n",(0,o.jsxs)(t.li,{children:["Downstream nodes require ",(0,o.jsx)(t.strong,{children:"structured input"})," for processing"]}),"\n",(0,o.jsxs)(t.li,{children:["You want to ensure ",(0,o.jsx)(t.strong,{children:"consistent response formats"})," for various user queries"]}),"\n"]}),"\n",(0,o.jsx)(t.p,{children:"For example, if you're building a customer inquiry workflow, you might define a JSON schema that extracts the customer's issue type, urgency level, and relevant product information from their message."}),"\n",(0,o.jsx)(t.h3,{id:"state-management",children:"State Management"}),"\n",(0,o.jsx)(t.p,{children:"The LLM Node can update the custom State based on the insights or analysis it generates. This allows the LLM Node to pass valuable information to subsequent nodes in the workflow without exposing that information directly to the user."}),"\n",(0,o.jsx)(t.p,{children:'For example, an LLM Node might analyze a customer\'s sentiment and add a "sentimentScore" to the custom State, which a Condition Node could then use to route the conversation to different support agents based on the detected sentiment.'}),"\n",(0,o.jsx)(t.h2,{id:"best-practices",children:"Best Practices"}),"\n","\n",(0,o.jsxs)(i.A,{children:[(0,o.jsxs)(a.default,{value:"pro-tips",label:"Pro Tips",children:[(0,o.jsx)(t.p,{children:(0,o.jsx)(t.strong,{children:"Clear system prompt"})}),(0,o.jsx)(t.p,{children:"Craft a concise and unambiguous System Prompt that accurately reflects the LLM Node's role and capabilities. This guides the LLM Node's decision-making and ensures it acts within its defined scope."}),(0,o.jsx)(t.p,{children:(0,o.jsx)(t.strong,{children:"Optimize for structured output"})}),(0,o.jsx)(t.p,{children:"Keep your JSON schemas as straightforward as possible, focusing on the essential data elements. Only enable JSON Structured Output when you need to extract specific data points from the LLM's response or when downstream nodes require JSON input."}),(0,o.jsx)(t.p,{children:(0,o.jsx)(t.strong,{children:"Strategic tool selection"})}),(0,o.jsx)(t.p,{children:"Choose and configure the tools available to the LLM Node (via the Tool Node), based on the specific tasks it needs to perform. Avoid providing too many tools, which can lead to confusion and inefficiency."})]}),(0,o.jsxs)(a.default,{value:"pitfalls",label:"Potential Pitfalls",children:[(0,o.jsx)(t.p,{children:(0,o.jsx)(t.strong,{children:"Overly complex JSON sc
1hemas"})}),(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Problem:"})," The JSON schema defined for the LLM Node's output is unnecessarily complex, making it difficult for the LLM to generate responses that match the schema or for downstream nodes to process the output efficiently."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Example:"})," You create a schema with many nested objects, optional fields, and arrays of complex objects, leading to inconsistent or incorrect outputs and difficulties in processing the data."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Solution:"})," Simplify your JSON schemas to focus on the essential data points. Define clear, flat structures whenever possible, and only use nested objects or arrays when necessary."]}),"\n"]}),(0,o.jsx)(t.p,{children:(0,o.jsx)(t.strong,{children:"Inadequate system prompting"})}),(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Problem:"})," The System Prompt doesn't provide enough guidance for the LLM to generate the desired output, especially when trying to produce structured data or provide a specific type of analysis."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Example:"})," Your prompt simply says \"Analyze the user's message,\" which doesn't specify what kind of analysis to perform or what output format to use."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.strong,{children:"Solution:"})," Be specific about what you want the LLM to analyze, how it should present its findings, and any constraints it should consider. For example: \"Analyze the user's message for signs of customer dissatisfaction. Identify the specific product or service mentioned, the nature of the issue, and the customer's emotional state, then provide a concise summary.\""]}),"\n"]})]})]})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(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.