{"id":41771,"date":"2024-02-24T00:00:52","date_gmt":"2024-02-24T07:00:52","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/premier-developer\/?p=41771"},"modified":"2024-02-21T14:13:24","modified_gmt":"2024-02-21T21:13:24","slug":"how-to-visualize-semantic-kernel-azure-openai-plans-using-mermaid","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/how-to-visualize-semantic-kernel-azure-openai-plans-using-mermaid\/","title":{"rendered":"How to visualize Semantic Kernel &#038; Azure OpenAI plans using Mermaid"},"content":{"rendered":"<p><a href=\"https:\/\/www.linkedin.com\/in\/jordan-bean\/\" target=\"_blank\" rel=\"noopener\">Jordan Bean<\/a> explores how to visualize Semantic Kernel &amp; Azure OpenAI plans using Mermaid.<\/p>\n<hr \/>\n<p>Using the function calling ability of Semantic Kernel\/OpenAI is very exciting from an application development point of view. Instead of hard-coding paths though the system, Semantic Kernel &amp; OpenAI can decide for themselves what plugins to call, the order of operations, parsing input &amp; output, etc.<\/p>\n<p>However, it can be challenging to understand\u00a0<strong>why<\/strong>\u00a0the system decided to go down a path &amp; all of the operations, prompts, function calls, etc. that occurred.<\/p>\n<p>Semantic Kernel provides a\u00a0<code>ChatHistory<\/code>\u00a0class that records \u201cmost\u201d of the calls made, the associated role &amp; the order of operations.<\/p>\n<p>We can use this to generate a\u00a0<code>SequenceDiagram<\/code>\u00a0in Mermaid to visualize the system.<\/p>\n<p>Here is how I visualized my OpenAI call plans for my Semantic Kernel sleeping bag example app (see the\u00a0<a href=\"https:\/\/jordanbeandev.com\/how-to-build-your-own-chatbot-using-c-semantic-kernel-azure-openai-part-1\/\">previous blog posts<\/a>\u00a0about how this example app works).<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2024\/02\/image-7.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-41772\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2024\/02\/image-7.jpg\" alt=\"Image image 7\" width=\"949\" height=\"789\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2024\/02\/image-7.jpg 949w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2024\/02\/image-7-300x249.jpg 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2024\/02\/image-7-768x639.jpg 768w\" sizes=\"(max-width: 949px) 100vw, 949px\" \/><\/a><\/p>\n<h2 class=\"wp-block-heading\">Mermaid<\/h2>\n<p>I used a JavaScript library called\u00a0<a href=\"https:\/\/mermaid.js.org\/intro\/\">Mermaid<\/a>\u00a0to generate diagrams on the fly. Mermaid is a diagraming &amp; charting tool that uses a \u201cMarkdown\u201d-like text language for defining diagrams. The library then renders the diagram based upon the text. Mermaid also includes a\u00a0<a href=\"https:\/\/mermaid.live\/edit\">live editor<\/a>\u00a0where you can play with the diagram before trying to embed it in your app.<\/p>\n<p>Continued reading Jordan&#8217;s <a href=\"https:\/\/jordanbeandev.com\/how-to-visualize-semantic-kernel-azure-openai-plans-using-mermaid\/\">full post here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jordan Bean explores how to visualize Semantic Kernel &amp; Azure OpenAI plans using Mermaid. Using the function calling ability of Semantic Kernel\/OpenAI is very exciting from an application development point of view. Instead of hard-coding paths though the system, Semantic Kernel &amp; OpenAI can decide for themselves what plugins to call, the order of operations, [&hellip;]<\/p>\n","protected":false},"author":582,"featured_media":41773,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14],"tags":[10650,10653,10651],"class_list":["post-41771","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","tag-azure-openai","tag-mermaid","tag-semantic-kernel"],"acf":[],"blog_post_summary":"<p>Jordan Bean explores how to visualize Semantic Kernel &amp; Azure OpenAI plans using Mermaid. Using the function calling ability of Semantic Kernel\/OpenAI is very exciting from an application development point of view. Instead of hard-coding paths though the system, Semantic Kernel &amp; OpenAI can decide for themselves what plugins to call, the order of operations, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/41771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=41771"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/41771\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/41773"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=41771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=41771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=41771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}