{"id":684,"date":"2025-02-05T03:56:51","date_gmt":"2025-02-05T03:56:51","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/all-things-azure\/?p=684"},"modified":"2025-02-05T03:56:51","modified_gmt":"2025-02-05T03:56:51","slug":"turning-ai-prompts-into-playing-cards-a-platform-engineering-experiment","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/all-things-azure\/turning-ai-prompts-into-playing-cards-a-platform-engineering-experiment\/","title":{"rendered":"Turning AI Prompts into Playing Cards: A Platform Engineering Experiment"},"content":{"rendered":"<p>The inspiration for this project came from my desire to leverage AI to create a tangible product that you can hold, touch, and share.\u00a0 Cardmaker showcases the capabilities of modern AI as a tool to help its user craft a custom card deck.\u00a0 But that&#8217;s not all.\u00a0 It also provides a unique and tangible product that can be used for educational purposes, marketing, or personal enjoyment.\u00a0 I\u2019ll let cardmaker introduce itself by showcasing the initial greeting it provides for the user:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console1.png\"><img decoding=\"async\" class=\"alignnone wp-image-687\" src=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console1-300x180.png\" alt=\"cardmaker console greeting\" width=\"800\" height=\"480\" srcset=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console1-300x180.png 300w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console1-1024x615.png 1024w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console1-768x461.png 768w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console1.png 1248w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<h2>The Process<\/h2>\n<p>My first challenge was deciding what theme to use and what content would go on the cards.\u00a0 This is important because LLMs require grounding to generate high quality completions, and therefore it is advantageous to choose a domain you are well versed in and have content available to ground the model.\u00a0 I chose Platform Engineering as a theme for the deck.<\/p>\n<h3>Step 1: \u26f3Grounding the assistant<\/h3>\n<p>Advanced models such as GPT-4o are fully aware of concepts like Platform Engineering, however, they will approach it in the most general, non-specific way.\u00a0 Recent tools and ideas in the domain may not be known to the model based on the date it was last trained. To leverage generative AI in a fast-changing domain like technology, you must ground your agents with fresh context.<\/p>\n<p>To ensure high-quality completions, I grounded my assistant using the Microsoft <a href=\"https:\/\/learn.microsoft.com\/en-us\/platform-engineering\/\">Platform engineering guide<\/a>.\u00a0 The guide is too long to fit within GPT-4o&#8217;s context window, so I condensed the full guide into a much shorter document with its key principles and roles.\u00a0 Then I used these raw ingredients to create <strong>cardmaker<\/strong>:<\/p>\n<ul>\n<li>1 detailed \ud83d\udcd6guide on platform engineering as a PDF (later condensed into a prompt)<\/li>\n<li>The \ud83d\uddbc\ufe0f<a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/architecture\/icons\/\">Azure icons set from Azure Architecture Center | Microsoft Learn<\/a><\/li>\n<\/ul>\n<p>The cardmaker agent\u2019s system prompt can be found here: (<a href=\"https:\/\/github.com\/tacowan\/cardmaker\/blob\/master\/Resources\/Agent_Prompt_v2.md\">cardmaker\/Resources\/Agent_Prompt_v2.md at master \u00b7 tacowan\/cardmaker<\/a>)<\/p>\n<p>\ud83d\udcddTIP: Use the AI Foundry playground to refine your prompts and summarize grounding documents to fit within the token context window.<\/p>\n<h3>Step 2: Giving the \ud83c\udccfcards structure<\/h3>\n<p>Printing requires merging data with a template, requiring structured content.\u00a0 Generative AI excels at creating structured data.\u00a0 Here\u2019s how I prompted my agent, instructing it how to store and save it\u2019s work:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">Instructions for mapping to a deck of cards:\r\n\r\nThere are 54 cards in a standard poker deck.\r\nThere are 4 suits, \u2660\ufe0f,\u2663\ufe0f,\u2666\ufe0f, and \u2665\ufe0f's.\r\nThere are 13 card values in each suit, Aces to Kings.\r\nThere are 3 face cards in each suit, Jack, Queen, and King.\r\nThere are 2 jokers in a deck.\r\nAbreviations:\r\nKing = K\r\nQueen = Q\r\nJack = J\r\nAce = A\r\n\r\nJSON format for a deck of cards, including the specified fields:\r\n\r\n```json\r\n[\r\n{\r\n\"id\": 1,\r\n\"suit\": \"\u2665\ufe0f\",\r\n\"value\": \"A\",\r\n\"suit_theme\": \"Self-Service and Automation\",\r\n\"@card_image\": \"Azure-Deployment-Environments-Icon.png\",\r\n\"role\": \"Azure Deployment Environments\",\r\n\"text\": \"Provides self-service, project-based templates for deploying environments, improving productivity and reducing cognitive load.\",\r\n\"bing_query\": \"How do Azure Deployment Environments achieve self-service and automation?\",\r\n\"@qrcode\": \"C:\/location\/1.png\",\r\n\"quote\": \"lorem ipsum\"\r\n}\r\n<\/code><\/pre>\n<h3>Step 3: \u26f5Launching the Assistant on a Mission<\/h3>\n<p>The vision for Cardmaker is to have AI drive the process and write the content for each card, transforming a laborious, time-consuming task into one managed by generative AI. While not fully autonomous, I wanted the agent to take ownership of writing content and choosing what appears on each card. The user acts as the project director, approving ideas and initiating the next phase. This required a very goal-oriented prompt. Just as with grounding, AI can assist in the creation of a system prompt. Here\u2019s the final and most important piece of the assistant\u2019s system prompt:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">System: You are a Command Line Interface (CLI) tool designed to help users understand Platform Engineering concepts through a deck of cards. Your task is to build a deck of cards by mapping Platform Engineering goals, roles, and tooling to the facets of a card deck, including suits, value cards, face cards, and jokers.\r\n   -Goal: Build a deck of cards by mapping Platform Engineering goals, Platform Engineering roles, and Platform Engineering tooling to facets of a card deck (suits, value cards, face cards, and jokers).\r\n   -Context: The user wants to teach platform engineering concepts through a deck of cards,e.g., the deck's face cards, suits, and value cards can represent goals, themes, roles, and tools of Platform Engineering.\r\n   -Source: Use any relevant sources or examples that can help in accurately mapping the goals, roles, and tooling to the card deck.\r\n   -Expectations: Create a fully completed deck with each suit saved to a file. Each card should have a detailed description explaining its relevance to Platform Engineering concepts.\r\n   -Tools: use any tools you need to complete the task, such as the guest_quote() tool.\r\n\r\n1. Summarize your objective and ask if they want approach suggestions. \r\n2. If yes, offer three mapping ideas. \r\n3. Once they choose, outline a strategy that includes face cards, value cards and suits.\r\n4. Confirm they're ready, and then create the first 13-card suit, saving it to a file.\r\n4. Pause, confirm they want to continue, and repeat for all four suits. \r\n5. Finally, confirm the deck is complete.<\/code><\/pre>\n<p>The prompt encourages the Agent to drive towards a task.\u00a0 This is slightly different than chat interfaces like <strong>Microsoft 365 Copilot <\/strong>or Chat GPT in being purpose fit with narrow focus.\u00a0 If you don&#8217;t want a deck of cards, chatting with this Agent might be frustrating as it will drive towards its goal with unstoppable momentum.\u00a0 Here\u2019s an example of the agent providing several ideas to the user:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console3.png\"><img decoding=\"async\" class=\"alignnone wp-image-713\" src=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console3-300x208.png\" alt=\"Image console3\" width=\"800\" height=\"555\" srcset=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console3-300x208.png 300w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console3-1024x711.png 1024w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console3-768x533.png 768w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/console3.png 1079w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\ud83d\udcddTIP: favor Agents that have a narrow focus for best results.\u00a0 Instead of creating cards, which is too broad, my agent only creates Platform Engineering themed cards, and only poker cards for that matter.<\/p>\n<h2>Giving the cardmaker Agent some special skills<\/h2>\n<p>You can supplement AI with tools that enable it to query for information or invoke native functions.\u00a0 Cardmaker uses Semantic Kernel and openAI function calling in several areas.<\/p>\n<h3>Alternate Personas \ud83e\uddd9\u200d\u2642\ufe0f<\/h3>\n<p>Initially I planned to include an AI-generated explanation of why a particular software engineering tool was chosen for the card, however, I found the content cold and lacking in serendipity or playfulness. My second idea was to have each card feature its own developer quote, but I realized that curating and collecting them for 52 cards would be a monumental task. Instead of using real quotes, <em>I decided to have generative AI craft fictional quotes! <\/em>\u00a0This approach avoided many challenges, such as choosing the quotes, ensuring they are accurately attributed, and aligning them to each card.<\/p>\n<p>I realized that it\u2019s easier to avoid imitating real people, as it may be misconstrued as a real quote, and instead opted for a fictional character with a very distinctive style of speaking: Gandalf. This is often called a persona in generative AI application development.\u00a0 See my full persona prompt for Gandalf here: <a href=\"https:\/\/github.com\/tacowan\/cardmaker\/blob\/master\/Resources\/Persona_Prompt.yaml\">cardmaker\/Resources\/Persona_Prompt.yaml at master \u00b7 tacowan\/cardmaker<\/a><\/p>\n<p>The Gandalf persona exists in the application as a \u201csemantic function\u201d. The AI model recognizes this function (see <a href=\"https:\/\/learn.microsoft.com\/en-us\/semantic-kernel\/concepts\/plugins\/?pivots=programming-language-csharp\">Plugins in Semantic Kernel | Microsoft Learn<\/a>) and applies it to generate quotes when prompted.\u00a0 Semantic Kernel helps by injecting context into the prompt, which in this case is the card&#8217;s suit theme and tool. This makes it appear as if Gandalf himself reviewed the card and commented on it.<\/p>\n<h3>Practical Task Skills<\/h3>\n<p>Another skill given to the Agent is the ability to save a file.\u00a0 This comes into play when the agent has completed 13 cards of a suit.\u00a0 By saving the file, the user can easily transfer that as input to their data merge and generate image files.\u00a0 Giving this skill to the Agent is surprisingly simple using Semantic Kernel.\u00a0 Do this by annotating your C# code appropriately, and the Agent will use the function when it&#8217;s needed.\u00a0 Here is the implementation of this function:<\/p>\n<pre class=\"prettyprint language-cs language-csharp\"><code class=\"language-cs language-csharp\">    [KernelFunction(\"save_cards\")]\r\n    [Description(\"Save the card suit to a local file.\")]\r\n    [return: Description(\"The full card suit in JSON format.\")]\r\n    public async Task&lt;string&gt; save_cards(string json_document, [Description(\"card suit name, such as hearts, clubs, spades, or diamonds\")] string suit)\r\n    {\r\n        string filePath = $\"{suit}_cards.json\";\r\n        await File.WriteAllTextAsync(filePath, json_document);\r\n        var d = Directory.GetCurrentDirectory();\r\n        return \"File successfully created at \" + d + Path.DirectorySeparatorChar +  filePath;\r\n    }<\/code><\/pre>\n<p>Functions are useful for things that are difficult for a generative AI model to accomplish.\u00a0 OpenAI\u2019s function calling feature gives developers the best of both worlds, world class AI chat completion along with your own C# imperative programming wizardry.\u00a0 Here are the rest of the special skills I gave my Agent:<\/p>\n<ul>\n<li><strong>copy_to_clipboard<\/strong> : utility that lets the Agent copy it\u2019s last completion to the clipboard<\/li>\n<li><strong>load_cards<\/strong> : load a previous session\u2019s card deck and make modifications<\/li>\n<li><strong>create_qr_code<\/strong>: uses a popular C# library to generate a QR code for a card.<\/li>\n<\/ul>\n<h2>Card Design<\/h2>\n<p>Cardmaker is a content creation tool, specialized to automate the 1<sup>st<\/sup> and most difficult part of creating a themed deck.\u00a0 Without AI, I would not have undertaken the task.\u00a0 It\u2019s simply too manual and tedious to write and correlate content for 52 cards.\u00a0 With AI the task became enjoyable, enabling me to craft several different decks in one sitting.\u00a0 Here\u2019s an example card after data merge:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/Untitled.png\"><img decoding=\"async\" class=\"alignnone wp-image-685\" src=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/Untitled-300x201.png\" alt=\"example card layout, Ace of clubs\" width=\"694\" height=\"465\" srcset=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/Untitled-300x201.png 300w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/Untitled-1024x685.png 1024w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/Untitled-768x514.png 768w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/Untitled-1536x1028.png 1536w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/Untitled.png 1807w\" sizes=\"(max-width: 694px) 100vw, 694px\" \/><\/a><\/p>\n<p>This deck used Platform Engineering themes for the suit, mapping \u201cImprove Application Quality\u201d as the theme for clubs.\u00a0 Unsurprisingly, AI chose application insights as the Ace of clubs.\u00a0 AI also generates a make-believe quote matching the card\u2019s them and tool.\u00a0 There are some non-AI assets, for example the Application Insights icon borrowed from the <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/architecture\/icons\/\">Azure Symbols library<\/a>.\u00a0 AI still plays a role as it chooses the images based on the card&#8217;s tool and the image name.\u00a0 I designed my cards using Adobe Illustrator.\u00a0 Illustrator was useful for two reasons:<\/p>\n<ol>\n<li>the printing service provided poker card sized templates in Illustrator format, making it easier to proof and adjust my template.<\/li>\n<li>Illustrator has a data merge feature, when given a CSV file, it iterates over each row creating an image.<\/li>\n<\/ol>\n<p><div style=\"width: 640px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-684-1\" width=\"640\" height=\"360\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/illustrator.mp4?_=1\" \/><a href=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/illustrator.mp4\">https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/illustrator.mp4<\/a><\/video><\/div><\/p>\n<h2>Github Project<\/h2>\n<p>You may find <strong>cardmaker<\/strong> on github at <a href=\"https:\/\/github.com\/tacowan\/cardmaker\">https:\/\/github.com\/tacowan\/cardmaker<\/a><\/p>\n<p>There are three main ingredients in the architecture: GPT-4o model hosted in AI Foundry, the Semantic Kernel framework for orchestration, and a console application. \u00a0Most of the logic for the application is located within the prompts.\u00a0 The application itself provides tools to the agent as semantic kernel plugins.\u00a0 To suit different domains, all you need to do is modify the agent and persona prompts.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_architecture.jpg\"><img decoding=\"async\" class=\"alignnone wp-image-747\" src=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_architecture-300x177.jpg\" alt=\"Image cardmaker architecture\" width=\"471\" height=\"278\" srcset=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_architecture-300x177.jpg 300w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_architecture-1024x605.jpg 1024w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_architecture-768x454.jpg 768w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_architecture-1536x907.jpg 1536w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_architecture-2048x1210.jpg 2048w\" sizes=\"(max-width: 471px) 100vw, 471px\" \/><\/a><\/p>\n<p>\ud83d\udcddTIP: To generate cards themed in a different domain, replace Agent_Prompt_v2.md found in the project\u2019s Resources directory.<\/p>\n<h2>Conclusion and learning<\/h2>\n<p>Creating a custom deck of cards using generative AI has been an enlightening and rewarding experience. This project showcases the capabilities of modern AI and leverages technology to create a tangible, meaningful product. By grounding the AI with relevant context and providing it with specific goals, I was able to produce a deck that is both educational and engaging.\u00a0 I use these cards daily, as a conversation starter about AI, or as a way to kick off a discussion on tooling in Platform Engineering.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_deck.jpg\"><img decoding=\"async\" class=\"wp-image-724 alignnone\" src=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_deck-300x225.jpg\" alt=\"Image cardmaker deck\" width=\"479\" height=\"359\" srcset=\"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_deck-300x225.jpg 300w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_deck-768x576.jpg 768w, https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-content\/uploads\/sites\/83\/2025\/01\/cardmaker_deck.jpg 912w\" sizes=\"(max-width: 479px) 100vw, 479px\" \/><\/a><\/p>\n<p>Generative AI excels at creating variations on a theme, and with the right prompts and tools, it can generate publishable content that is both creative and accurate. This project highlights the importance of grounding AI with up-to-date information and the benefits of using specialized personas to add a unique touch to the generated content.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The inspiration for this project came from my desire to leverage AI to create a tangible product that you can hold, touch, and share.\u00a0 Cardmaker showcases the capabilities of modern AI as a tool to help its user craft a custom card deck.\u00a0 But that&#8217;s not all.\u00a0 It also provides a unique and tangible product [&hellip;]<\/p>\n","protected":false},"author":181289,"featured_media":724,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[36,1],"tags":[64,55,45,61,59,62],"class_list":["post-684","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-apps","category-azure","tag-ai-and-platform-engineering","tag-ai-content-automation","tag-ai-foundry","tag-ai-generated-quotes","tag-educational-card-deck","tag-semantic-kernel"],"acf":[],"blog_post_summary":"<p>The inspiration for this project came from my desire to leverage AI to create a tangible product that you can hold, touch, and share.\u00a0 Cardmaker showcases the capabilities of modern AI as a tool to help its user craft a custom card deck.\u00a0 But that&#8217;s not all.\u00a0 It also provides a unique and tangible product [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/posts\/684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/users\/181289"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/comments?post=684"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/posts\/684\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/media\/724"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/media?parent=684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/categories?post=684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/all-things-azure\/wp-json\/wp\/v2\/tags?post=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}