1:"$Sreact.fragment" 2:I[41596,["/_next/static/chunks/51cf3403df3ab8db.js"],"ThemeProvider"] 3:I[99623,["/_next/static/chunks/1f465ca74a71847d.js","/_next/static/chunks/6628e8793cd41c7c.js"],"default"] 4:I[1810,["/_next/static/chunks/1f465ca74a71847d.js","/_next/static/chunks/6628e8793cd41c7c.js"],"default"] 6:I[39271,["/_next/static/chunks/1f465ca74a71847d.js","/_next/static/chunks/6628e8793cd41c7c.js"],"OutletBoundary"] 7:"$Sreact.suspense" 9:I[39271,["/_next/static/chunks/1f465ca74a71847d.js","/_next/static/chunks/6628e8793cd41c7c.js"],"ViewportBoundary"] b:I[39271,["/_next/static/chunks/1f465ca74a71847d.js","/_next/static/chunks/6628e8793cd41c7c.js"],"MetadataBoundary"] d:I[79129,[],"default"] :HL["/_next/static/chunks/c2a0804a12c1a234.css","style"] :HL["/_next/static/media/1b99372b3eaef0c8-s.p.758e15a8.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/_next/static/media/797e433ab948586e-s.p.dbea232f.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/_next/static/media/caa3a2e1cccd8315-s.p.853070df.woff2","font",{"crossOrigin":"","type":"font/woff2"}] 0:{"P":null,"b":"3CCc4JxoD54WNKxdcWa8x","c":["","blog","laravel-ai-agents-package"],"q":"","i":false,"f":[[["",{"children":["blog",{"children":[["slug","laravel-ai-agents-package","d"],{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/c2a0804a12c1a234.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/51cf3403df3ab8db.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"type":"application/ld+json","dangerouslySetInnerHTML":{"__html":"{\"@context\":\"https://schema.org\",\"@type\":\"Person\",\"name\":\"Raad Kasem\",\"url\":\"https://raadkasem.dev\",\"jobTitle\":\"Senior Software Engineer & Team Lead\",\"worksFor\":{\"@type\":\"Organization\",\"name\":\"CanGuru\"},\"alumniOf\":[{\"@type\":\"CollegeOrUniversity\",\"name\":\"Syrian Virtual University\"},{\"@type\":\"CollegeOrUniversity\",\"name\":\"Tishreen University\"}],\"knowsAbout\":[\"Artificial Intelligence\",\"Machine Learning\",\"LangChain\",\"LangGraph\",\"FastAPI\",\"Python\",\"PHP\",\"Laravel\",\"RAG Pipelines\"],\"sameAs\":[\"https://github.com/raadkasem\",\"https://linkedin.com/in/raad-kasem\"]}"}}]}],["$","body",null,{"className":"geist_a71539c9-module__T19VSG__variable geist_mono_8d43a2aa-module__8Li5zG__variable outfit_a0e3ceb4-module__1hgF0q__variable antialiased","children":["$","$L2",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":["$L5",[["$","script","script-0",{"src":"/_next/static/chunks/e1faea17a9e9ed14.js","async":true,"nonce":"$undefined"}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],{},null,false,false]},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$L9",null,{"children":"$La"}],["$","div",null,{"hidden":true,"children":["$","$Lb",null,{"children":["$","$7",null,{"name":"Next.Metadata","children":"$Lc"}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],false]],"m":"$undefined","G":["$d",[]],"S":true} e:I[97333,["/_next/static/chunks/51cf3403df3ab8db.js","/_next/static/chunks/e1faea17a9e9ed14.js"],""] 5:["$","div",null,{"className":"min-h-screen bg-[var(--bg)]","children":["$","article",null,{"className":"section-container pt-32 max-w-3xl","children":[["$","$Le",null,{"href":"/blog","className":"inline-flex items-center gap-2 text-sm text-muted hover:text-accent transition-colors mb-8","children":[["$","svg",null,{"ref":"$undefined","xmlns":"http://www.w3.org/2000/svg","width":24,"height":24,"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":2,"strokeLinecap":"round","strokeLinejoin":"round","className":"lucide lucide-arrow-left h-4 w-4","aria-hidden":"true","children":[["$","path","1l729n",{"d":"m12 19-7-7 7-7"}],["$","path","x3x0zl",{"d":"M19 12H5"}],"$undefined"]}],"Back to Blog"]}],["$","header",null,{"className":"mb-10","children":[["$","div",null,{"className":"flex flex-wrap items-center gap-3 text-sm text-muted mb-4","children":[["$","span",null,{"className":"inline-flex items-center gap-1.5","children":[["$","svg",null,{"ref":"$undefined","xmlns":"http://www.w3.org/2000/svg","width":24,"height":24,"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":2,"strokeLinecap":"round","strokeLinejoin":"round","className":"lucide lucide-calendar h-3.5 w-3.5","aria-hidden":"true","children":[["$","path","1cmpym",{"d":"M8 2v4"}],["$","path","4m81vk",{"d":"M16 2v4"}],["$","rect","1hopcy",{"width":"18","height":"18","x":"3","y":"4","rx":"2"}],["$","path","8toen8",{"d":"M3 10h18"}],"$undefined"]}],"May 12, 2025"]}],["$","span",null,{"className":"inline-flex items-center gap-1.5","children":[["$","svg",null,{"ref":"$undefined","xmlns":"http://www.w3.org/2000/svg","width":24,"height":24,"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":2,"strokeLinecap":"round","strokeLinejoin":"round","className":"lucide lucide-clock h-3.5 w-3.5","aria-hidden":"true","children":[["$","circle","1mglay",{"cx":"12","cy":"12","r":"10"}],["$","path","mmk7yg",{"d":"M12 6v6l4 2"}],"$undefined"]}],"8 min read"]}]]}],["$","h1",null,{"className":"font-[family-name:var(--font-outfit)] text-3xl font-bold tracking-tight text-foreground sm:text-4xl lg:text-5xl","children":"Building AI Agents in Laravel: A Deep Dive into the Prism Package"}],["$","div",null,{"className":"mt-4 flex flex-wrap gap-2","children":[["$","span","Laravel",{"className":"rounded-full border border-[var(--card-border)] bg-[var(--card-bg)] px-3 py-1 text-xs text-muted","children":"Laravel"}],["$","span","AI Agents",{"className":"rounded-full border border-[var(--card-border)] bg-[var(--card-bg)] px-3 py-1 text-xs text-muted","children":"AI Agents"}],["$","span","PHP",{"className":"rounded-full border border-[var(--card-border)] bg-[var(--card-bg)] px-3 py-1 text-xs text-muted","children":"PHP"}],["$","span","Prism",{"className":"rounded-full border border-[var(--card-border)] bg-[var(--card-bg)] px-3 py-1 text-xs text-muted","children":"Prism"}],["$","span","LLM Integration",{"className":"rounded-full border border-[var(--card-border)] bg-[var(--card-bg)] px-3 py-1 text-xs text-muted","children":"LLM Integration"}],["$","span","Backend",{"className":"rounded-full border border-[var(--card-border)] bg-[var(--card-bg)] px-3 py-1 text-xs text-muted","children":"Backend"}]]}]]}],["$","div",null,{"className":"prose-custom","children":"$Lf"}]]}]}] a:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]] 10:I[39406,["/_next/static/chunks/1f465ca74a71847d.js","/_next/static/chunks/6628e8793cd41c7c.js"],"IconMark"] 8:null c:[["$","title","0",{"children":"Building AI Agents in Laravel: A Deep Dive into the Prism Package | Raad Kasem"}],["$","meta","1",{"name":"description","content":"How to build production-ready AI agents directly in Laravel using the Prism package — covering tool use, multi-step reasoning, structured output, and integration patterns for real-world applications."}],["$","link","2",{"rel":"author","href":"https://raadkasem.dev"}],["$","meta","3",{"name":"author","content":"Raad Kasem"}],["$","meta","4",{"name":"keywords","content":"Raad Kasem,Software Engineer,AI Engineer,LangChain,LangGraph,RAG,FastAPI,Full Stack Developer,Team Lead,LLM,Machine Learning"}],["$","meta","5",{"name":"creator","content":"Raad Kasem"}],["$","meta","6",{"name":"robots","content":"index, follow"}],["$","meta","7",{"name":"googlebot","content":"index, follow, max-video-preview:-1, max-image-preview:large, max-snippet:-1"}],["$","meta","8",{"property":"og:title","content":"Raad Kasem — AI-focused Senior Software Engineer"}],["$","meta","9",{"property":"og:description","content":"Senior Software Engineer & Team Lead with 7+ years building production-ready AI/LLM-powered solutions."}],["$","meta","10",{"property":"og:url","content":"https://raadkasem.dev"}],["$","meta","11",{"property":"og:site_name","content":"Raad Kasem"}],["$","meta","12",{"property":"og:locale","content":"en_US"}],["$","meta","13",{"property":"og:image:alt","content":"Raad Kasem — AI-focused Senior Software Engineer"}],["$","meta","14",{"property":"og:image:type","content":"image/png"}],["$","meta","15",{"property":"og:image","content":"https://raadkasem.dev/opengraph-image?6524c747f4eb7f2a"}],["$","meta","16",{"property":"og:image:width","content":"1200"}],["$","meta","17",{"property":"og:image:height","content":"630"}],["$","meta","18",{"property":"og:type","content":"website"}],["$","meta","19",{"name":"twitter:card","content":"summary_large_image"}],["$","meta","20",{"name":"twitter:title","content":"Raad Kasem — AI-focused Senior Software Engineer"}],["$","meta","21",{"name":"twitter:description","content":"Senior Software Engineer & Team Lead with 7+ years building production-ready AI/LLM-powered solutions."}],["$","meta","22",{"name":"twitter:image:alt","content":"Raad Kasem — AI-focused Senior Software Engineer"}],["$","meta","23",{"name":"twitter:image:type","content":"image/png"}],["$","meta","24",{"name":"twitter:image","content":"https://raadkasem.dev/opengraph-image?6524c747f4eb7f2a"}],["$","meta","25",{"name":"twitter:image:width","content":"1200"}],["$","meta","26",{"name":"twitter:image:height","content":"630"}],["$","link","27",{"rel":"icon","href":"/icon?51d30ca368f9894e","alt":"$undefined","type":"image/png","sizes":"32x32"}],["$","$L10","28",{}]] f:[["$","h1",null,{"className":"font-[family-name:var(--font-outfit)] text-3xl font-bold tracking-tight text-foreground mt-10 mb-4 first:mt-0","children":"Building AI Agents in Laravel: A Deep Dive into the Prism Package"}],"\n",["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":["For years, building AI-powered features in Laravel meant either calling OpenAI's API with raw HTTP requests or shelling out to Python microservices. That's changed dramatically. The ",["$","a",null,{"className":"text-accent underline underline-offset-4 hover:text-[var(--accent-purple)] transition-colors","target":"_blank","rel":"noopener noreferrer","href":"https://github.com/echolabsdev/prism","children":"Prism"}]," package (by EchoLabs) brings first-class LLM integration to Laravel with an elegant, Laravel-native API."]}],"\n",["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"After shipping three production features with Prism, I want to share what I've learned — from basic text generation to building full AI agents with tool use and multi-step reasoning."}],"\n",["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"Why Build AI Agents in Laravel?"}],"\n",["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"If your application is already in Laravel, adding a Python sidecar service for AI means:"}],"\n",["$","ul",null,{"className":"list-disc list-inside space-y-2 text-muted mb-5","children":["\n",["$","li",null,{"className":"text-base leading-relaxed","children":"Another deployment to manage"}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":"Cross-service authentication"}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":"Network latency for every AI call"}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":"Two codebases to maintain"}],"\n"]}],"\n",["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"With Prism, your AI logic lives alongside your business logic. Your agents can directly access Eloquent models, query the database, dispatch jobs, and use your existing service classes. No API boundaries, no serialization overhead."}],"\n",["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"Getting Started with Prism"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"className":"overflow-x-auto rounded-xl border border-[var(--card-border)] bg-[var(--surface)] p-4 text-sm mb-5","style":{"backgroundColor":"#22272e","color":"#adbac7"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed","children":["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","data-language":"bash","data-theme":"github-dark-dimmed","style":{"display":"grid"},"children":["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":"composer"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" require"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" echolabs/prism"}]]}]}]}]}],"\n",["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"Basic text generation — the \"hello world\":"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"className":"overflow-x-auto rounded-xl border border-[var(--card-border)] bg-[var(--surface)] p-4 text-sm mb-5","style":{"backgroundColor":"#22272e","color":"#adbac7"},"tabIndex":"0","data-language":"php","data-theme":"github-dark-dimmed","children":["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","data-language":"php","data-theme":"github-dark-dimmed","style":{"display":"grid"},"children":["$L11","\n","$L12","\n","$L13","\n","$L14","\n","$L15","\n","$L16","\n","$L17","\n","$L18"]}]}]}],"\n","$L19","\n","$L1a","\n","$L1b","\n","$L1c","\n","$L1d","\n","$L1e","\n","$L1f","\n","$L20","\n","$L21","\n","$L22","\n","$L23","\n","$L24","\n","$L25","\n","$L26","\n","$L27","\n","$L28","\n","$L29","\n","$L2a","\n","$L2b","\n","$L2c","\n","$L2d","\n","$L2e","\n","$L2f","\n","$L30","\n","$L31","\n","$L32","\n","$L33","\n","$L34","\n","$L35","\n","$L36","\n","$L37","\n","$L38","\n","$L39","\n","$L3a"] 11:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"use"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" EchoLabs\\Prism\\Prism"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] 12:["$","span",null,{"data-line":"","children":" "}] 13:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$response "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"text"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}] 14:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'anthropic'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'claude-sonnet-4-5-20241022'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 15:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'Explain dependency injection in one paragraph.'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 16:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"asText"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}] 17:["$","span",null,{"data-line":"","children":" "}] 18:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":"echo"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $response"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"text;"}]]}] 19:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"Simple enough. But the real power comes from structured output and tool use."}] 1a:["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"Structured Output with Prism"}] 1b:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"One of the biggest headaches with LLMs is parsing their output. Prism solves this with structured output that maps directly to PHP objects:"}] 1c:["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"className":"overflow-x-auto rounded-xl border border-[var(--card-border)] bg-[var(--surface)] p-4 text-sm mb-5","style":{"backgroundColor":"#22272e","color":"#adbac7"},"tabIndex":"0","data-language":"php","data-theme":"github-dark-dimmed","children":["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","data-language":"php","data-theme":"github-dark-dimmed","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"use"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" EchoLabs\\Prism\\Prism"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"class"}],["$","span",null,{"style":{"color":"#F69D50"},"children":" ProductAnalysis"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"{"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" __construct"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $sentiment,"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" float"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $confidence,"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" array"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $keyThemes,"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $summary,"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" ?string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $actionRequired,"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ) {}"}]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"}"}]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$analysis "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"structured"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'openai'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'gpt-4o'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withStructuredOutput"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"ProductAnalysis"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::class"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\"Analyze this customer review: {"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$review"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"content"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}],"\n","$L3b","\n","$L3c","\n","$L3d","\n","$L3e","\n","$L3f"]}]}]}] 1d:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"This is a game-changer. No more regex parsing, no more \"please respond in JSON format\" prayers. The output is validated and typed."}] 1e:["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"Building a Real AI Agent with Tool Use"}] 1f:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"Here's where it gets exciting. Prism supports tool use — you define tools that the LLM can call, and it decides when and how to use them."}] 20:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":["$","strong",null,{"className":"font-semibold text-foreground","children":"Example: An intelligent customer support agent"}]}] 21:["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"className":"overflow-x-auto rounded-xl border border-[var(--card-border)] bg-[var(--surface)] p-4 text-sm mb-5","style":{"backgroundColor":"#22272e","color":"#adbac7"},"tabIndex":"0","data-language":"php","data-theme":"github-dark-dimmed","children":["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","data-language":"php","data-theme":"github-dark-dimmed","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"use"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" EchoLabs\\Prism\\Prism"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"use"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" EchoLabs\\Prism\\Tool"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":"// Define tools the agent can use"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$lookupOrderTool "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Tool"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"as"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'lookup_order'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"for"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'Look up a customer order by order number'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withStringParameter"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'order_number'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'The order number to look up'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"function"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ("}],["$","span",null,{"style":{"color":"#F47067"},"children":"string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order_number)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#F47067"},"children":" string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"where"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'number'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", $order_number)"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"with"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(["}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'items'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'shipment'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'customer'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"])"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"first"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" if"}],"$L40","$L41","$L42"]}],"\n","$L43","\n","$L44","\n","$L45","\n","$L46","\n","$L47","\n","$L48","\n","$L49","\n","$L4a","\n","$L4b","\n","$L4c","\n","$L4d","\n","$L4e","\n","$L4f","\n","$L50","\n","$L51","\n","$L52","\n","$L53","\n","$L54","\n","$L55","\n","$L56","\n","$L57","\n","$L58","\n","$L59","\n","$L5a","\n","$L5b","\n","$L5c","\n","$L5d","\n","$L5e","\n","$L5f","\n","$L60","\n","$L61","\n","$L62","\n","$L63","\n","$L64","\n","$L65","\n","$L66","\n","$L67","\n","$L68","\n","$L69","\n","$L6a","\n","$L6b","\n","$L6c","\n","$L6d","\n","$L6e","\n","$L6f","\n","$L70","\n","$L71","\n","$L72","\n","$L73","\n","$L74","\n","$L75","\n","$L76","\n","$L77","\n","$L78","\n","$L79","\n","$L7a","\n","$L7b","\n","$L7c","\n","$L7d","\n","$L7e","\n","$L7f","\n","$L80","\n","$L81","\n","$L82","\n","$L83","\n","$L84","\n","$L85"]}]}]}] 22:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":["The ",["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","children":"withMaxSteps(5)"}]," is crucial — it allows the agent to call multiple tools in sequence. The agent might:"]}] 23:["$","ol",null,{"className":"list-decimal list-inside space-y-2 text-muted mb-5","children":["\n",["$","li",null,{"className":"text-base leading-relaxed","children":"Look up the order"}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":"Check inventory for a replacement"}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":"Initiate a refund"}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":"Respond with a summary"}],"\n"]}] 24:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"All in a single request, with the LLM deciding the sequence based on the conversation."}] 25:["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"Integrating Agents into Laravel Controllers"}] 26:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"Here's how I structure AI agent endpoints in a real Laravel application:"}] 27:["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"className":"overflow-x-auto rounded-xl border border-[var(--card-border)] bg-[var(--surface)] p-4 text-sm mb-5","style":{"backgroundColor":"#22272e","color":"#adbac7"},"tabIndex":"0","data-language":"php","data-theme":"github-dark-dimmed","children":["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","data-language":"php","data-theme":"github-dark-dimmed","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"class"}],["$","span",null,{"style":{"color":"#F69D50"},"children":" SupportChatController"}],["$","span",null,{"style":{"color":"#F47067"},"children":" extends"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Controller"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"{"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" __construct"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" private"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" SupportAgentService"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $agentService,"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" private"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" ConversationRepository"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $conversations,"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ) {}"}]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" message"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"MessageRequest"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $request)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" JsonResponse"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $conversation "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"conversations"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"findOrCreate"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":" userId"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":": $request"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"user"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"id,"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":" sessionId"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":": $request"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"input"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'session_id'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"),"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" );"}]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // Add the user message to conversation history"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $conversation"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"addMessage"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'user'"}],"$L86","$L87","$L88","$L89","$L8a","$L8b"]}],"\n","$L8c","\n","$L8d","\n","$L8e","\n","$L8f","\n","$L90","\n","$L91","\n","$L92","\n","$L93","\n","$L94","\n","$L95","\n","$L96","\n","$L97","\n","$L98","\n","$L99","\n","$L9a","\n","$L9b","\n","$L9c","\n","$L9d","\n","$L9e","\n","$L9f","\n","$La0","\n","$La1","\n","$La2","\n","$La3","\n","$La4"]}]}]}] 28:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"And the service class:"}] 29:["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"className":"overflow-x-auto rounded-xl border border-[var(--card-border)] bg-[var(--surface)] p-4 text-sm mb-5","style":{"backgroundColor":"#22272e","color":"#adbac7"},"tabIndex":"0","data-language":"php","data-theme":"github-dark-dimmed","children":["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","data-language":"php","data-theme":"github-dark-dimmed","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"class"}],["$","span",null,{"style":{"color":"#F69D50"},"children":" SupportAgentService"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"{"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" private"}],["$","span",null,{"style":{"color":"#F47067"},"children":" array"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $tools;"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" __construct"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" private"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" OrderService"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $orders,"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" private"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" RefundService"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $refunds,"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ) {"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"tools "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"registerTools"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" respond"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"Conversation"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $conversation, "}],["$","span",null,{"style":{"color":"#F47067"},"children":"string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $message)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" TextResult"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $messages "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $conversation"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"messages"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"map"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"function"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ($msg) {"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#F47067"},"children":" new"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Message"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($msg"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"role, $msg"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"content);"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" })"}],"$La5","$La6","$La7"]}],"\n","$La8","\n","$La9","\n","$Laa","\n","$Lab","\n","$Lac","\n","$Lad","\n","$Lae","\n","$Laf","\n","$Lb0","\n","$Lb1","\n","$Lb2","\n","$Lb3","\n","$Lb4","\n","$Lb5","\n","$Lb6","\n","$Lb7","\n","$Lb8","\n","$Lb9","\n","$Lba","\n","$Lbb"]}]}]}] 2a:["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"RAG in Laravel with Prism"}] 2b:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"You can build RAG (Retrieval-Augmented Generation) pipelines entirely in Laravel:"}] 2c:["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"className":"overflow-x-auto rounded-xl border border-[var(--card-border)] bg-[var(--surface)] p-4 text-sm mb-5","style":{"backgroundColor":"#22272e","color":"#adbac7"},"tabIndex":"0","data-language":"php","data-theme":"github-dark-dimmed","children":["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","data-language":"php","data-theme":"github-dark-dimmed","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"class"}],["$","span",null,{"style":{"color":"#F69D50"},"children":" KnowledgeBaseService"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"{"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" query"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $question)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#F47067"},"children":" string"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // 1. Generate embedding for the question"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $embedding "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"embeddings"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'openai'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'text-embedding-3-small'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"fromInput"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($question)"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"asEmbeddings"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // 2. Search vector database for relevant documents"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $relevantDocs "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"vectorSearch"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $embedding"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"embeddings["}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"0"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"]"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"embedding,"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":" limit"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":": "}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"5"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":","}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" );"}]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // 3. Generate answer with context"}]}],"\n",["$","span",null,{"data-line":"","children":["$Lbc","$Lbd","$Lbe","$Lbf"]}],"\n","$Lc0","\n","$Lc1","\n","$Lc2","\n","$Lc3","\n","$Lc4","\n","$Lc5","\n","$Lc6","\n","$Lc7","\n","$Lc8","\n","$Lc9","\n","$Lca","\n","$Lcb","\n","$Lcc","\n","$Lcd","\n","$Lce","\n","$Lcf","\n","$Ld0","\n","$Ld1","\n","$Ld2","\n","$Ld3","\n","$Ld4","\n","$Ld5","\n","$Ld6","\n","$Ld7","\n","$Ld8","\n","$Ld9","\n","$Lda","\n","$Ldb"]}]}]}] 2d:["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"Error Handling & Resilience"}] 2e:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"Production AI features need robust error handling:"}] 2f:["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"className":"overflow-x-auto rounded-xl border border-[var(--card-border)] bg-[var(--surface)] p-4 text-sm mb-5","style":{"backgroundColor":"#22272e","color":"#adbac7"},"tabIndex":"0","data-language":"php","data-theme":"github-dark-dimmed","children":["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","data-language":"php","data-theme":"github-dark-dimmed","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"class"}],["$","span",null,{"style":{"color":"#F69D50"},"children":" ResilientAgentService"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"{"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" respond"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $message)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#F47067"},"children":" string"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" try"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"primaryAgent"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($message);"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" } "}],["$","span",null,{"style":{"color":"#F47067"},"children":"catch"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"RateLimitException"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $e) {"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // Fall back to a cheaper model"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Log"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"warning"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'Primary model rate limited, falling back'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", ["}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'retry_after'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $e"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"retryAfter,"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ]);"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"fallbackAgent"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($message);"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" } "}],["$","span",null,{"style":{"color":"#F47067"},"children":"catch"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"TimeoutException"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $e) {"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Log"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"error"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'AI agent timeout'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", ["}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'message'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],"$Ldc"]}],"\n","$Ldd","\n","$Lde","\n","$Ldf","\n","$Le0","\n","$Le1","\n","$Le2","\n","$Le3","\n","$Le4","\n","$Le5","\n","$Le6","\n","$Le7","\n","$Le8","\n","$Le9","\n","$Lea","\n","$Leb","\n","$Lec","\n","$Led","\n","$Lee","\n","$Lef","\n","$Lf0","\n","$Lf1","\n","$Lf2","\n","$Lf3","\n","$Lf4","\n","$Lf5","\n","$Lf6","\n","$Lf7","\n","$Lf8","\n","$Lf9","\n","$Lfa","\n","$Lfb","\n","$Lfc","\n","$Lfd"]}]}]}] 30:["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"Testing AI Agents in Laravel"}] 31:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"Testing AI features is tricky. Here's my approach:"}] 32:["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"className":"overflow-x-auto rounded-xl border border-[var(--card-border)] bg-[var(--surface)] p-4 text-sm mb-5","style":{"backgroundColor":"#22272e","color":"#adbac7"},"tabIndex":"0","data-language":"php","data-theme":"github-dark-dimmed","children":["$","code",null,{"className":"rounded bg-[var(--card-bg)] px-1.5 py-0.5 text-sm font-mono text-accent","data-language":"php","data-theme":"github-dark-dimmed","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":"class"}],["$","span",null,{"style":{"color":"#F69D50"},"children":" SupportAgentTest"}],["$","span",null,{"style":{"color":"#F47067"},"children":" extends"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" TestCase"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"{"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" public"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" test_agent_looks_up_order_when_asked"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#F47067"},"children":" void"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // Create test data"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"factory"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"create"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(["}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'number'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'ORD-123'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"]);"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // Mock Prism to avoid actual API calls in tests"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"fake"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(["}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" new"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" TextResult"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":" text"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":": "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\"I found your order ORD-123. It's currently being shipped.\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":","}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":" toolCalls"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":": ["}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" new"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" ToolCall"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'lookup_order'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", ["}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'order_number'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'ORD-123'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"]),"}]]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ],"}]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ),"}]}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ]);"}]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n","$Lfe","\n","$Lff","\n","$L100","\n","$L101","\n","$L102","\n","$L103","\n","$L104","\n","$L105","\n","$L106","\n","$L107","\n","$L108","\n","$L109","\n","$L10a","\n","$L10b"]}]}]}] 33:["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"Performance Tips"}] 34:["$","ol",null,{"className":"list-decimal list-inside space-y-2 text-muted mb-5","children":["\n",["$","li",null,{"className":"text-base leading-relaxed","children":[["$","strong",null,{"className":"font-semibold text-foreground","children":"Cache aggressively"}],": If the same question comes in repeatedly, cache the response"]}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":[["$","strong",null,{"className":"font-semibold text-foreground","children":"Use streaming for chat interfaces"}],": Prism supports streaming — show tokens as they arrive"]}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":[["$","strong",null,{"className":"font-semibold text-foreground","children":"Queue long-running agents"}],": For complex multi-step agents, dispatch to a queue and use WebSockets to stream results"]}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":[["$","strong",null,{"className":"font-semibold text-foreground","children":"Choose the right model"}],": Claude Haiku for classification, Sonnet for generation, Opus only when quality demands it"]}],"\n",["$","li",null,{"className":"text-base leading-relaxed","children":[["$","strong",null,{"className":"font-semibold text-foreground","children":"Batch embeddings"}],": When indexing documents, batch embedding requests (Prism supports this)"]}],"\n"]}] 35:["$","h2",null,{"className":"font-[family-name:var(--font-outfit)] text-2xl font-semibold tracking-tight text-foreground mt-10 mb-3","children":"Conclusion"}] 36:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"Laravel + Prism is a legitimate alternative to Python-based AI stacks for many use cases. If your application is already in Laravel and you need to add AI features — chatbots, content generation, data analysis, intelligent routing — you can do it without adding a Python service."}] 37:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"The key advantages: your AI logic shares the same models, services, and database access as your business logic. No serialization boundaries, no cross-service debugging, no extra deployments."}] 38:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":"The key limitation: for complex multi-agent orchestration with state machines (like what LangGraph provides), you'll still want a dedicated Python service. But for 80% of AI features, Prism in Laravel is more than enough."}] 39:["$","hr",null,{"className":"my-8 border-[var(--card-border)]"}] 3a:["$","p",null,{"className":"text-base leading-relaxed text-muted mb-5","children":["$","em",null,{"children":"Got questions about building AI features in Laravel? I'm happy to dive deeper into any of these patterns — reach out via the contact section."}]}] 3b:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"asStructured"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}] 3c:["$","span",null,{"data-line":"","children":" "}] 3d:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":"// $analysis->object is a ProductAnalysis instance"}]}] 3e:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$sentiment "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $analysis"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"object"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"sentiment; "}],["$","span",null,{"style":{"color":"#768390"},"children":"// \"positive\""}]]}] 3f:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$confidence "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $analysis"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"object"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"confidence; "}],["$","span",null,{"style":{"color":"#768390"},"children":"// 0.92"}]]}] 40:["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ("}] 41:["$","span",null,{"style":{"color":"#F47067"},"children":"!"}] 42:["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$order) {"}] 43:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"Order {"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$order_number"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"} not found.\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] 44:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] 45:["$","span",null,{"data-line":"","children":" "}] 46:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" json_encode"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(["}]]}] 47:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'number'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"number,"}]]}] 48:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'status'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"status,"}]]}] 49:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'items'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"items"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"map"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"only"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(["}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'name'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'quantity'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'price'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"]),"}]]}] 4a:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'shipped_at'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"shipment"}],["$","span",null,{"style":{"color":"#F47067"},"children":"?->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"shipped_at,"}]]}] 4b:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'tracking'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"shipment"}],["$","span",null,{"style":{"color":"#F47067"},"children":"?->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"tracking_number,"}]]}] 4c:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'total'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"total,"}]]}] 4d:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ]);"}]}] 4e:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" });"}]}] 4f:["$","span",null,{"data-line":"","children":" "}] 50:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$initiateRefundTool "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Tool"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"as"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'initiate_refund'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 51:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"for"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'Initiate a refund for an order. Only use when customer explicitly requests.'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 52:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withStringParameter"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'order_number'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'The order number to refund'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 53:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withStringParameter"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'reason'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'The reason for the refund'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 54:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"function"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ("}],["$","span",null,{"style":{"color":"#F47067"},"children":"string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order_number, "}],["$","span",null,{"style":{"color":"#F47067"},"children":"string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $reason)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#F47067"},"children":" string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]]}] 55:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $order "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"where"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'number'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", $order_number)"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"first"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}] 56:["$","span",null,{"data-line":"","children":" "}] 57:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" if"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ("}],["$","span",null,{"style":{"color":"#F47067"},"children":"!"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$order "}],["$","span",null,{"style":{"color":"#F47067"},"children":"||"}],["$","span",null,{"style":{"color":"#F47067"},"children":" !"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$order"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"isRefundable"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()) {"}]]}] 58:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"Order {"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$order_number"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"} is not eligible for refund.\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] 59:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] 5a:["$","span",null,{"data-line":"","children":" "}] 5b:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $refund "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" RefundService"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"initiate"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($order, $reason);"}]]}] 5c:["$","span",null,{"data-line":"","children":" "}] 5d:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"Refund initiated. Refund ID: {"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$refund"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"id"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}. \""}],["$","span",null,{"style":{"color":"#F47067"},"children":" ."}]]}] 5e:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"Amount: "}],["$","span",null,{"style":{"color":"#F47067"},"children":"\\$"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"{"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$refund"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"amount"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}. \""}],["$","span",null,{"style":{"color":"#F47067"},"children":" ."}]]}] 5f:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"Expected processing time: 3-5 business days.\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] 60:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" });"}]}] 61:["$","span",null,{"data-line":"","children":" "}] 62:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$checkInventoryTool "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Tool"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"as"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'check_inventory'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 63:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"for"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'Check if a product is currently in stock'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 64:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withStringParameter"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'product_name'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'The product name to check'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 65:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"function"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ("}],["$","span",null,{"style":{"color":"#F47067"},"children":"string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $product_name)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#F47067"},"children":" string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]]}] 66:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $products "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Product"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"where"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'name'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'LIKE'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\"%{"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$product_name"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}%\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 67:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"select"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(["}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'name'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'sku'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'stock_quantity'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'price'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"])"}]]}] 68:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"limit"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"5"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 69:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"get"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}] 6a:["$","span",null,{"data-line":"","children":" "}] 6b:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" if"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ($products"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"isEmpty"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()) {"}]]}] 6c:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"No products found matching '{"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$product_name"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}'.\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] 6d:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] 6e:["$","span",null,{"data-line":"","children":" "}] 6f:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $products"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"map"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"function"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ($p) {"}]]}] 70:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $status "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $p"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"stock_quantity "}],["$","span",null,{"style":{"color":"#F47067"},"children":">"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" 0"}],["$","span",null,{"style":{"color":"#F47067"},"children":" ?"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"In Stock ({"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$p"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"stock_quantity"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"})\""}],["$","span",null,{"style":{"color":"#F47067"},"children":" :"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"Out of Stock\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] 71:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"{"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$p"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"name"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"} (SKU: {"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$p"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"sku"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}) - {"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$status"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"} - "}],["$","span",null,{"style":{"color":"#F47067"},"children":"\\$"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"{"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$p"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"price"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] 72:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" })"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"join"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\""}],["$","span",null,{"style":{"color":"#F47067"},"children":"\\n"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":");"}]]}] 73:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" });"}]}] 74:["$","span",null,{"data-line":"","children":" "}] 75:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":"// Create the agent"}]}] 76:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$response "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"text"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}] 77:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'anthropic'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'claude-sonnet-4-5-20241022'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 78:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withSystemPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"<<<"}],["$","span",null,{"style":{"color":"#F47067"},"children":"PROMPT"}]]}] 79:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" You are a helpful customer support agent for an e-commerce store."}]}] 7a:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" You can look up orders, check inventory, and initiate refunds."}]}] 7b:["$","span",null,{"data-line":"","children":" "}] 7c:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" Guidelines:"}]}] 7d:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" - Always verify the order exists before taking action"}]}] 7e:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" - Only initiate refunds when the customer explicitly asks"}]}] 7f:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" - Be empathetic and professional"}]}] 80:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" - If you can't resolve the issue, explain what the customer should do next"}]}] 81:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" PROMPT"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] 82:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withTools"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"([$lookupOrderTool, $initiateRefundTool, $checkInventoryTool])"}]]}] 83:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withMaxSteps"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"5"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":") "}],["$","span",null,{"style":{"color":"#768390"},"children":"// Allow up to 5 tool calls per request"}]]}] 84:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($customerMessage)"}]]}] 85:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"asText"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}] 86:["$","span",null,{"style":{"color":"#ADBAC7"},"children":", $request"}] 87:["$","span",null,{"style":{"color":"#F47067"},"children":"->"}] 88:["$","span",null,{"style":{"color":"#DCBDFB"},"children":"input"}] 89:["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}] 8a:["$","span",null,{"style":{"color":"#96D0FF"},"children":"'message'"}] 8b:["$","span",null,{"style":{"color":"#ADBAC7"},"children":"));"}] 8c:["$","span",null,{"data-line":"","children":" "}] 8d:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // Run the agent with full conversation context"}]}] 8e:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $response "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"agentService"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"respond"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}]]}] 8f:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":" conversation"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":": $conversation,"}]]}] 90:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":" message"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":": $request"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"input"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'message'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"),"}]]}] 91:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" );"}]}] 92:["$","span",null,{"data-line":"","children":" "}] 93:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // Save the assistant response"}]}] 94:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $conversation"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"addMessage"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'assistant'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", $response"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"text);"}]]}] 95:["$","span",null,{"data-line":"","children":" "}] 96:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // Log token usage for cost tracking"}]}] 97:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" TokenUsageLog"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"create"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(["}]]}] 98:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'conversation_id'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $conversation"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"id,"}]]}] 99:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'input_tokens'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $response"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"usage"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"inputTokens,"}]]}] 9a:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'output_tokens'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $response"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"usage"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"outputTokens,"}]]}] 9b:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'model'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'claude-sonnet-4-5-20241022'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":","}]]}] 9c:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'cost_cents'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"calculateCost"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($response"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"usage),"}]]}] 9d:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ]);"}]}] 9e:["$","span",null,{"data-line":"","children":" "}] 9f:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" response"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"json"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(["}]]}] a0:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'message'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $response"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"text,"}]]}] a1:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'session_id'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $conversation"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"session_id,"}]]}] a2:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ]);"}]}] a3:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] a4:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"}"}]}] a5:["$","span",null,{"style":{"color":"#F47067"},"children":"->"}] a6:["$","span",null,{"style":{"color":"#DCBDFB"},"children":"toArray"}] a7:["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}] a8:["$","span",null,{"data-line":"","children":" "}] a9:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"text"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}] aa:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'anthropic'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'claude-sonnet-4-5-20241022'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] ab:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withSystemPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"$$this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"getSystemPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"())"}]]}] ac:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withMessages"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($messages)"}]]}] ad:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withTools"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"$$this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"tools)"}]]}] ae:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withMaxSteps"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"5"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] af:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($message)"}]]}] b0:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"asText"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}] b1:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] b2:["$","span",null,{"data-line":"","children":" "}] b3:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" private"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" registerTools"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#F47067"},"children":" array"}]]}] b4:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]}] b5:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ["}]]}] b6:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"createOrderLookupTool"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(),"}]]}] b7:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"createRefundTool"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(),"}]]}] b8:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"createInventoryTool"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(),"}]]}] b9:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ];"}]}] ba:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] bb:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"}"}]}] bc:["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $context "}] bd:["$","span",null,{"style":{"color":"#F47067"},"children":"="}] be:["$","span",null,{"style":{"color":"#DCBDFB"},"children":" collect"}] bf:["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($relevantDocs)"}] c0:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"map"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"fn"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ($doc) => "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\"Source: {"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$doc"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"title"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}"}],["$","span",null,{"style":{"color":"#F47067"},"children":"\\n"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"{"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$doc"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"content"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] c1:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"join"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\""}],["$","span",null,{"style":{"color":"#F47067"},"children":"\\n\\n"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"---"}],["$","span",null,{"style":{"color":"#F47067"},"children":"\\n\\n"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":");"}]]}] c2:["$","span",null,{"data-line":"","children":" "}] c3:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $response "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"text"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}] c4:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'anthropic'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'claude-sonnet-4-5-20241022'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] c5:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withSystemPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"<<<"}],["$","span",null,{"style":{"color":"#F47067"},"children":"PROMPT"}]]}] c6:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" Answer the question based on the provided context."}]}] c7:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" If the context doesn't contain the answer, say so."}]}] c8:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#96D0FF"},"children":" Always cite which source document you used."}]}] c9:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" PROMPT"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] ca:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\"Context:"}],["$","span",null,{"style":{"color":"#F47067"},"children":"\\n"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"{"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$context"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}"}],["$","span",null,{"style":{"color":"#F47067"},"children":"\\n\\n"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"Question: {"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"$$question"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"}\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] cb:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"asText"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}] cc:["$","span",null,{"data-line":"","children":" "}] cd:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $response"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"text;"}]]}] ce:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] cf:["$","span",null,{"data-line":"","children":" "}] d0:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" private"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" vectorSearch"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"array"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $embedding, "}],["$","span",null,{"style":{"color":"#F47067"},"children":"int"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $limit)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Collection"}]]}] d1:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]}] d2:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // Using pgvector extension with Eloquent"}]}] d3:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Document"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"query"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}] d4:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"selectRaw"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\"*, embedding <=> ? AS distance\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", ["}]]}] d5:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" json_encode"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($embedding)"}]]}] d6:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ])"}]}] d7:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"orderBy"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'distance'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] d8:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"limit"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($limit)"}]]}] d9:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"get"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"();"}]]}] da:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] db:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"}"}]}] dc:["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $message]);"}] dd:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"I'm experiencing delays. Let me connect you with a team member.\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] de:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" } "}],["$","span",null,{"style":{"color":"#F47067"},"children":"catch"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"\\Throwable"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $e) {"}]]}] df:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Log"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"error"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'AI agent failed'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", ["}]]}] e0:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'error'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $e"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"getMessage"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(),"}]]}] e1:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'message'"}],["$","span",null,{"style":{"color":"#F47067"},"children":" =>"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $message,"}]]}] e2:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ]);"}]}] e3:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"I'm having trouble processing your request. \""}],["$","span",null,{"style":{"color":"#F47067"},"children":" ."}]]}] e4:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"Please try again or contact support@example.com.\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] e5:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] e6:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] e7:["$","span",null,{"data-line":"","children":" "}] e8:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" private"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" primaryAgent"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $message)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#F47067"},"children":" string"}]]}] e9:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]}] ea:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Cache"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"remember"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}]]}] eb:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#96D0FF"},"children":" \"agent_response:\""}],["$","span",null,{"style":{"color":"#F47067"},"children":" ."}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" md5"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($message),"}]]}] ec:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#DCBDFB"},"children":" now"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"addMinutes"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"30"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"),"}]]}] ed:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" fn"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" () => "}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"text"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}] ee:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'anthropic'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'claude-sonnet-4-5-20241022'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] ef:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($message)"}]]}] f0:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"asText"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}] f1:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"text"}]]}] f2:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" );"}]}] f3:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] f4:["$","span",null,{"data-line":"","children":" "}] f5:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" private"}],["$","span",null,{"style":{"color":"#F47067"},"children":" function"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" fallbackAgent"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#F47067"},"children":"string"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $message)"}],["$","span",null,{"style":{"color":"#F47067"},"children":":"}],["$","span",null,{"style":{"color":"#F47067"},"children":" string"}]]}] f6:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" {"}]}] f7:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"text"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}] f8:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"using"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'openai'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'gpt-4o-mini'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":")"}]]}] f9:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"withPrompt"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"($message)"}]]}] fa:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"asText"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}]]}] fb:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" ->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"text;"}]]}] fc:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] fd:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"}"}]}] fe:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $service "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":" app"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"SupportAgentService"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::class"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":");"}]]}] ff:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $response "}],["$","span",null,{"style":{"color":"#F47067"},"children":"="}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $service"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"respond"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}]]}] 100:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":" conversation"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":": "}],["$","span",null,{"style":{"color":"#6CB6FF"},"children":"Conversation"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"factory"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"()"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"create"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"(),"}]]}] 101:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F69D50"},"children":" message"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":": "}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"\"Where is my order ORD-123?\""}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":","}]]}] 102:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" );"}]}] 103:["$","span",null,{"data-line":"","children":" "}] 104:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" $this"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"assertStringContains"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'ORD-123'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", $response"}],["$","span",null,{"style":{"color":"#F47067"},"children":"->"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"text);"}]]}] 105:["$","span",null,{"data-line":"","children":" "}] 106:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#768390"},"children":" // Verify the tool was called"}]}] 107:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#6CB6FF"},"children":" Prism"}],["$","span",null,{"style":{"color":"#F47067"},"children":"::"}],["$","span",null,{"style":{"color":"#DCBDFB"},"children":"assertToolCalled"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"("}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'lookup_order'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":", "}],["$","span",null,{"style":{"color":"#F47067"},"children":"function"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" ($args) {"}]]}] 108:["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"color":"#F47067"},"children":" return"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":" $args["}],["$","span",null,{"style":{"color":"#96D0FF"},"children":"'order_number'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":"] "}],["$","span",null,{"style":{"color":"#F47067"},"children":"==="}],["$","span",null,{"style":{"color":"#96D0FF"},"children":" 'ORD-123'"}],["$","span",null,{"style":{"color":"#ADBAC7"},"children":";"}]]}] 109:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" });"}]}] 10a:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":" }"}]}] 10b:["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"color":"#ADBAC7"},"children":"}"}]}]