<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hadar Dashty on Medium]]></title>
        <description><![CDATA[Stories by Hadar Dashty on Medium]]></description>
        <link>https://medium.com/@hadards?source=rss-818db97b9c14------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rINJv9pBYTa4ZeP451ix5A@2x.jpeg</url>
            <title>Stories by Hadar Dashty on Medium</title>
            <link>https://medium.com/@hadards?source=rss-818db97b9c14------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 08:15:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hadards/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Copilot Studio Agent on Azure Databricks Data: What the Official Docs Don’t Fully…]]></title>
            <link>https://medium.com/philips-technology-blog/building-a-copilot-studio-agent-on-azure-databricks-data-what-the-official-docs-dont-fully-3a08859d90ab?source=rss-818db97b9c14------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a08859d90ab</guid>
            <dc:creator><![CDATA[Hadar Dashty]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 09:11:00 GMT</pubDate>
            <atom:updated>2026-07-06T09:11:00.851Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Copilot Studio Agent on Azure Databricks Data: What the Official Docs Don’t Fully Explain</h3><h4>The real challenge is not only connecting the data. It is preserving the reasoning and sharing the agent with users.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5l-2JeVy1iFEZda2rv-Lg.png" /><figcaption>The Challenge</figcaption></figure><p>You have a curated Databricks business gold layer.</p><p>You want stakeholders in the business to ask questions in natural language.</p><p>Not data engineers. Not only analysts.<br>Real business users.</p><p>They want to open an AI chat and ask questions like:</p><pre>Which customer renewals are at risk?<br>Why did this account move to high risk?<br>Is this claim eligible for approval?<br>Which cases need escalation this week?<br>What changed compared to last month?</pre><p>At first, this sounds like a simple integration problem: Connect Copilot Studio to Databricks and let users chat with the gold layer.</p><p>But after trying this across GPT, Copilot Microsoft 365, APIs with JSON, Power Automate, Databricks, and Copilot Studio, my conclusion is different:</p><p>The hard part is not connecting to Databricks.<br>The hard part is building an agent that can reason correctly, be governed properly, and be shared with business stakeholders.</p><p>That last part matters. I had already succeeded with GPT in the past. In some ways, it was easier to prototype. The reasoning was strong, the prompt behavior was flexible, and I could get results quickly.</p><p>But the enterprise distribution model was the blocker. Sharing GPTs depends on the plan, workspace settings, role permissions, and workspace access.</p><p>Copilot Studio solved a different problem: not only building the agent, but publishing it into the Microsoft enterprise environment. <a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/requirements-licensing">Microsoft states that users of published Copilot Studio agents do not need a special license</a>; after publishing, anyone who can access the published agent can interact with it.</p><p>So the real question became:</p><blockquote><em>Can I build an agent that reliably reasons over my Azure Databricks business gold layer, produces decisions stakeholders can trust, and can actually be shared with business users at scale?</em></blockquote><p>The answer is: yes, but not in the naive way.</p><h3>The official story: topics, knowledge, tools, and Databricks</h3><p>Microsoft and Databricks now officially document the Power Platform integration with Azure Databricks. The documentation says you can use Azure Databricks data in Power Apps, Power Automate, and Copilot Studio. For Copilot Studio specifically, <a href="https://learn.microsoft.com/en-us/azure/databricks/integrations/msft-power-platform/usage">the docs describe two paths</a>: build agents using Azure Databricks as a knowledge source, or connect Databricks Genie Spaces as tools.</p><p>This fits the broader Copilot Studio model:</p><pre>Topics<br>  → control conversation flows<br><br>Knowledge<br>  → ground generative answers in enterprise data<br><br>Tools<br>  → call external systems or perform actions</pre><p>That is the official promise: Connect governed Databricks data, use Copilot Studio’s agent capabilities, and publish the agent to business channels.</p><p>This is real.</p><p>But it is not the full story.</p><p>Once the business question becomes analytical, multi-step, and decision-oriented, the implementation becomes much more complex.</p><h3>The example: a business gold layer agent</h3><p>Let’s use a generic example.</p><p>Imagine your Databricks gold layer contains customer renewal-risk data:</p><pre>gold_customer_profile<br>gold_contracts<br>gold_product_usage<br>gold_support_cases<br>gold_invoice_status<br>gold_renewal_policy<br>gold_risk_exceptions<br>gold_prior_decisions</pre><p>A user asks:</p><blockquote><em>Is this customer at high renewal risk, and why?</em></blockquote><p>This is not a simple lookup. The agent needs to:</p><pre>1. Identify the customer.<br>2. Retrieve the current contract.<br>3. Check renewal date and value.<br>4. Analyze product usage trends.<br>5. Check support cases and escalations.<br>6. Check invoice or payment issues.<br>7. Apply renewal-risk policy.<br>8. Apply exception rules.<br>9. Compare current status to previous decisions.<br>10. Return a clear recommendation with evidence.</pre><p>That is not just “chat with a table.” That is structured reasoning over multiple governed datasets.</p><p>This is where the architecture matters.</p><h3>Reality check 1: OAuth vs Service Principal</h3><p>Before the AI reasoning even starts, you need a stable Databricks connection.</p><p>The official Databricks Power Platform documentation says you must create an Azure Databricks connection on Microsoft Power Platform before using it from Power Apps, Power Automate, or Copilot Studio. See <a href="https://learn.microsoft.com/en-us/azure/databricks/integrations/msft-power-platform/setup">Create an Azure Databricks connection on Microsoft Power Platform</a>.</p><p>This is not a minor setup step.</p><p>Create the Databricks connection first from Power Apps or Power Automate. Rename it clearly. Then use it inside Copilot Studio.</p><p>For example:</p><pre>Databricks_Renewal_Risk_SPN_Prod<br>Databricks_Customer_Analytics_OAuth_Dev</pre><p><strong>Do not create random Databricks connections while adding tools inside Copilot Studio</strong>. Once you have several environments, agents, and authentication types, unclear connections become very hard to track.</p><p>Now comes the authentication decision.</p><h4>OAuth</h4><p>OAuth sounds attractive because it uses the user’s identity.</p><p>But it does not always work well for shared business agents:</p><pre>1. OAuth requires the Power Platform deployment and Azure Databricks account to be in the same Microsoft Entra tenant.<br>2. Each user must have access to the required warehouse, catalog, schema, table, or Genie Space.<br>3. Network restrictions, private endpoints, virtual network configuration, or IP allow lists can block access.<br>4. User-based connections are harder to support when sharing an agent broadly.</pre><p>Some OAuth issues are not bugs. They are normal enterprise security behavior.</p><p>But for a shared business-facing agent, they create friction.</p><h4>Service principal</h4><p>For shared enterprise agents, I prefer a service principal.</p><p>A service principal gives you a stable application identity. You can grant it only the required Databricks permissions, only the required Unity Catalog access, and only the required SQL warehouse or Genie Space access.</p><p><a href="https://learn.microsoft.com/en-us/azure/databricks/admin/users-groups/service-principals">Databricks describes service principals</a> as specialized identities for automation and programmatic access that do not rely on individual user credentials.</p><p>My recommendation:</p><pre>For prototpyes: <br>  OAuth is acceptable.</pre><pre>For shared business agents:<br>  Use a service principal with least-privilege access.</pre><h3>Reality check 2: knowledge is not the same as reasoning</h3><p>At first, I thought Databricks as Copilot Studio knowledge would be the cleanest solution. It sounds logical:</p><pre>Gold tables in Databricks<br>  → add as Copilot Studio knowledge<br>  → business user asks a question<br>  → agent answers from tables</pre><p>But this was the wrong abstraction for complex analytical decisions.</p><p><a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/knowledge-copilot-studio">Copilot Studio knowledge</a> is designed to ground generative answers. Microsoft describes knowledge sources as a way for agents to use enterprise data, websites, documents, Dataverse, SharePoint, and external systems to provide relevant information.</p><p>For knowledge files, <a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/knowledge-unstructured-data">Microsoft explains</a> that Copilot Studio uses Dataverse to ingest raw files and create indexes and vector embeddings. Those indexes and embeddings help the agent provide grounded responses.</p><p>So the nuance is important:</p><blockquote><em>Not all Copilot Studio knowledge is just static documents.<br>But the knowledge abstraction is still primarily about grounding answers, not designing a deterministic multi-step analytical reasoning workflow.</em></blockquote><p>Knowledge is useful for questions like:</p><pre>What is the renewal policy?<br>What does this field mean?<br>Summarize the support escalation process.<br>Which document explains discount approval?</pre><p>But it is not enough for:</p><pre>Evaluate this customer’s renewal risk using usage trends,<br>support history, invoice status, policy rules, exceptions,<br>and prior decisions.</pre><p>That second question requires orchestration. The agent needs to retrieve several datasets, compare them, apply business rules, detect exceptions, and explain the result.</p><p>Knowledge can ground an answer. But knowledge does not automatically become a reliable multi-step reasoning engine over your business gold layer.</p><p>That was the second lesson:</p><blockquote><em>Databricks knowledge in Copilot Studio is useful, but it was not enough for complex decision workflows.</em></blockquote><h3>Reality check 3: Genie works, but the Copilot tool is not Agent Mode</h3><p>The next option was Databricks Genie.</p><p>This worked much better inside Databricks. Why?</p><p>Because of Genie <strong>Agent Mode</strong>.</p><p><a href="https://docs.databricks.com/aws/en/genie/agent-mode">Databricks describes Agent Mode</a> as a mode for complex questions where Genie creates a research plan, runs multiple SQL queries, learns from results, iterates, and produces a comprehensive report with citations, visualizations, and supporting tables.</p><p>That is exactly what complex gold-layer analysis needs.</p><p>But there is a critical limitation:</p><blockquote><strong><em>Genie Agent Mode is not available through the API.</em></strong></blockquote><p>Users can submit Agent Mode prompts only through the Databricks UI. In addition, agent Mode uses Sonnet models, while Genie remains a managed service that continuously evaluates models from multiple providers.</p><p>That explains why the same Genie Space can feel excellent in Databricks but weaker when called from Copilot Studio as a tool.</p><p>The Copilot Studio MCP Genie tool is useful, but it is not the same as full Genie Agent Mode.</p><p>The difference is:</p><pre>Genie Agent Mode in Databricks UI:<br>  plans<br>  runs multiple queries<br>  investigates<br>  iterates<br>  reasons across evidence<br>  produces a researched answer</pre><pre>Genie tool from Copilot Studio:<br>  calls Genie through a tool/API-style interaction<br>  retrieves useful answers or structured data<br>  does not expose the full Agent Mode loop</pre><p>So the tool was not broken. I just didn’t realize that the Copilot Genie tool call behaves like Genie Chat Mode.</p><h3>The pattern that finally worked</h3><p>The working pattern was:</p><pre>1. Build a curated Genie Space on the Databricks gold layer.<br>2. Test the real business question directly in Genie Agent Mode.<br>3. Improve the Genie Space until Agent Mode reaches the right result.<br>4. Ask Genie Agent Mode to explain the exact reasoning steps it used.<br>5. Convert those steps into Copilot Studio instructions.<br>6. Connect Copilot Studio to Databricks Genie as an MCP tool using a service principal.<br>7. Make Copilot Studio call Genie step by step.<br>8. Let Copilot Studio produce the final stakeholder-facing answer.</pre><p>The key insight is:</p><blockquote><em>Use Genie Agent Mode to discover the reasoning.<br>Use Copilot Studio instructions to preserve the reasoning.<br>Use the Genie tool to retrieve the data step by step.<br>Use Copilot Studio to share the experience with stakeholders.</em></blockquote><h3>Sample Copilot Studio instruction pattern</h3><p>Here is a generic example for a customer renewal-risk agent:</p><pre>You are a customer renewal-risk assistant.</pre><pre>You have access to a Databricks Genie tool connected to a curated Genie Space.</pre><pre>Your job is to evaluate renewal risk by retrieving structured data from Databricks and then performing the reasoning yourself.</pre><pre>Use the Databricks Genie tool.</pre><pre>Required input:<br>- customer name or customer ID</pre><pre>If the customer is missing, ask the user for it.</pre><pre>Do not ask Genie to solve the entire analysis in one question.<br>Call Genie step by step.</pre><pre>Always continue polling the Genie Space until you receive a response. Do not stop after a few seconds.</pre><pre>STEP 1 — Retrieve customer profile</pre><pre>Ask Genie to return structured JSON only:<br>- customer_id<br>- customer_name<br>- segment<br>- region<br>- country<br>- account_owner<br>- current_risk_score<br>- current_risk_category<br>- row_count<br>- filters_used<br>- generated_sql</pre><pre>STEP 2 — Retrieve contract and renewal data</pre><pre>Ask Genie to return structured JSON only:<br>- contract_id<br>- product_family<br>- contract_value<br>- start_date<br>- end_date<br>- renewal_date<br>- renewal_stage<br>- discount_level<br>- payment_terms<br>- row_count<br>- filters_used<br>- generated_sql</pre><pre>STEP 3 — Retrieve product usage trend</pre><pre>Ask Genie to return structured JSON only:<br>- month<br>- product<br>- active_users<br>- usage_volume<br>- usage_change_percent<br>- adoption_score<br>- row_count<br>- filters_used<br>- generated_sql</pre><pre>STEP 4 — Retrieve support and escalation history</pre><pre>Ask Genie to return structured JSON only:<br>- case_id<br>- opened_date<br>- closed_date<br>- severity<br>- category<br>- status<br>- escalation_flag<br>- resolution_time_days<br>- customer_sentiment<br>- row_count<br>- filters_used<br>- generated_sql</pre><pre>STEP 5 — Retrieve policy and exception rules</pre><pre>Ask Genie to return structured JSON only:<br>- rule_id<br>- rule_name<br>- condition_expression<br>- risk_impact<br>- escalation_required<br>- exception_notes<br>- effective_from<br>- effective_to<br>- row_count<br>- filters_used<br>- generated_sql</pre><pre>STEP 6 — Reason over the result</pre><pre>You, the Copilot Studio agent, must evaluate the returned data.</pre><pre>Apply these rules:<br>- Renewal date matters.<br>- Contract value matters.<br>- Product adoption trend matters.<br>- Open support escalations matter.<br>- Payment issues matter.<br>- Policy exceptions override generic rules only when conditions are met.<br>- Do not rely on a single risk score as truth.<br>- Use evidence from each retrieved dataset.</pre><pre>STEP 7 — Final response</pre><pre>Start with one clear answer:</pre><pre>HIGH RISK<br>MEDIUM RISK<br>LOW RISK<br>INCONCLUSIVE</pre><pre>Then provide:</pre><pre>Summary:<br>- customer<br>- renewal date<br>- contract value<br>- current risk score<br>- final risk decision</pre><pre>Evidence:<br>- area<br>- finding<br>- impact<br>- source</pre><pre>Recommended action:<br>- owner<br>- action<br>- urgency<br>- reason</pre><pre>Data quality notes:<br>- missing data<br>- conflicting signals<br>- assumptions</pre><p>This is the difference between “chat with Databricks” and building an actual business agent.</p><h3>The key trick: ask Genie Agent Mode to write the Copilot instructions</h3><p>This was the breakthrough.</p><p>Instead of manually guessing the best Copilot Studio instructions, first solve the scenario in Databricks Genie Agent Mode.</p><p>Then ask Genie Agent Mode:</p><pre>You solved this analysis correctly using multiple queries and reasoning steps.</pre><pre>Convert your approach into detailed Copilot Studio agent instructions.</pre><pre>The instructions must:<br>- break the analysis into sequential steps<br>- specify exactly what the Copilot agent should ask the Databricks Genie tool<br>- request structured JSON only<br>- make Copilot Studio responsible for final reasoning<br>- include business rules and exception handling<br>- include the final response format</pre><p>That gives you a practical reasoning blueprint.</p><p>Then you put that blueprint into Copilot Studio instructions.</p><p>The idea is simple:</p><blockquote><em>Let Genie Agent Mode discover the analytical method.<br>Let Copilot Studio repeat that method as an orchestrated business agent.</em></blockquote><h3>Final architecture</h3><p>The architecture I would recommend is:</p><pre>Business stakeholder<br>  → Copilot Studio agent<br>    → published in Teams / Microsoft 365 channel<br>      → instructions generated from Genie Agent Mode<br>        → Databricks Genie tool call 1<br>        → Databricks Genie tool call 2<br>        → Databricks Genie tool call 3<br>        → Databricks Genie tool call 4<br>          → Copilot Studio performs final reasoning<br>            → stakeholder gets a clear answer with evidence</pre><p>This architecture gives each platform the right job:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iWn6yv_IGhlx7m_VFIqfNA.png" /><figcaption>Final Solution Design</figcaption></figure><pre>Databricks gold layer:<br>  governed business data</pre><pre>Genie Agent Mode:<br>  discover the analytical reasoning pattern</pre><pre>Databricks Genie tool:<br>  retrieve data from the curated Genie Space</pre><pre>Copilot Studio:<br>  orchestrate the steps, format the response, and publish the agent to stakeholders</pre><pre>Service principal:<br>  stable shared enterprise access</pre><h3>Final takeaway</h3><p>The official integration is real.</p><p>Microsoft and Databricks do provide ways to connect Copilot Studio to Databricks using knowledge sources and Genie tools.</p><p>But for a serious business gold-layer agent, the real challenge is bigger:</p><blockquote><em>Can the agent reason correctly over governed data, explain the decision, and be shared with business stakeholders?</em></blockquote><p>That is why I would start with Genie Agent Mode, use it to discover the reasoning, then move that reasoning into Copilot Studio instructions and use Genie as a controlled tool.</p><p>The final lesson:</p><blockquote><em>Connecting the data is the easy part.<br>Preserving the reasoning and sharing the agent with real stakeholders is the real architecture.</em></blockquote><h3>Sources</h3><ul><li>Microsoft Learn: <a href="https://learn.microsoft.com/en-us/azure/databricks/integrations/msft-power-platform/usage">Use Azure Databricks data on Microsoft Power Platform</a></li><li>Microsoft Learn: <a href="https://learn.microsoft.com/en-us/azure/databricks/integrations/msft-power-platform/setup">Create an Azure Databricks connection on Microsoft Power Platform</a></li><li>Microsoft Learn: <a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/knowledge-copilot-studio">Knowledge sources summary — Microsoft Copilot Studio</a></li><li>Microsoft Learn: <a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/knowledge-unstructured-data">Unstructured data as a knowledge source — Microsoft Copilot Studio</a></li><li>Microsoft Learn: <a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/knowledge-real-time-connectors">Add Power Platform connectors as knowledge — Microsoft Copilot Studio</a></li><li>Databricks Docs: <a href="https://docs.databricks.com/aws/en/genie/agent-mode">Agent mode in Genie Spaces</a></li><li>Microsoft Learn: <a href="https://learn.microsoft.com/en-us/azure/databricks/admin/users-groups/service-principals">Service principals — Azure Databricks</a></li><li>Microsoft Learn: <a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/requirements-licensing">Assign user licenses and manage access — Microsoft Copilot Studio</a></li><li>OpenAI Help Center: <a href="https://help.openai.com/en/articles/8798878-building-and-publishing-a-gpt">Sharing and publishing GPTs</a></li><li>OpenAI Help Center: <a href="https://help.openai.com/en/articles/9083988-how-to-share-gpts-within-workspaces">Managing GPT access in Enterprise and Edu workspaces</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a08859d90ab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/philips-technology-blog/building-a-copilot-studio-agent-on-azure-databricks-data-what-the-official-docs-dont-fully-3a08859d90ab">Building a Copilot Studio Agent on Azure Databricks Data: What the Official Docs Don’t Fully…</a> was originally published in <a href="https://medium.com/philips-technology-blog">Philips Technology Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI isn’t here to decide, it’s here to understand]]></title>
            <link>https://medium.com/philips-technology-blog/agentic-ai-isnt-here-to-decide-it-s-here-to-understand-60892c296448?source=rss-818db97b9c14------2</link>
            <guid isPermaLink="false">https://medium.com/p/60892c296448</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Hadar Dashty]]></dc:creator>
            <pubDate>Wed, 05 Nov 2025 04:22:38 GMT</pubDate>
            <atom:updated>2025-11-26T08:36:03.734Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The real usage of large language models in logic systems</em></p><p>Everyone’s talking about AI Agents that can reason, plan and act.</p><p>But when you tackle a real world problem that depends on precise logic, you quickly learn what agentic AI is actually meant for: interpreting, not deciding.</p><p>This was my first opportunity to test that in a real world scenario, a practical experiment to see what agentic AI can genuinely handle, and where it completely breaks down.</p><h3>The Problem: When rules outgrow the human brain</h3><p>I’ve been working on a problem that sits right between logic and language:</p><p>In manufacturing and configuration processes, every customer’s order represents a list of materials that should be produced together, a specific combination defined by features, regions, and technical parameters.</p><p>But whether a material should or shouldn’t be included in an order isn’t a simple yes/no. It’s controlled by a complex web of conditions, rules and dependencies. Unfortunately, these rules are written in free text, inconsistent, scattered, and full of exceptions. Different people write them in different formats over time.</p><p>It’s not a clean data model; it’s a messy collection of human logic.</p><p>So the question became:</p><p><strong>Can an AI agent actually understand these textual rules and automatically decide if an order configuration is valid?</strong></p><h3>The Experiment: Giving It to an AI Agent</h3><p>I didn’t expect miracles, I expected exactly what happened. But I still wanted to see whether an LLM, acting as an agent, could handle this reasoning task.</p><p>I gave it about 200 rules and tested one order at a time. Not thousands, just enough to see how it handled structured conditions written in text.</p><p>But then when it didn’t work as expected, I went down the classic path:</p><p>Maybe I just need to tune the system prompt. So I did.</p><p>Rewrote, restructured, added context, split logic into steps, adjusted temperature, changed tone.</p><p>But no matter what I did, the outcome was the same. It made wrong decisions, including materials that shouldn’t be there, excluding ones that should, and skipping parts of the logic entirely.</p><p>It didn’t fail because it lacked the information, it failed because it’s not built to apply logic deterministically.</p><h3>Why Agentic AI Couldn’t Solve It</h3><p>Even with one order and a few hundred rules, the limits became clear.</p><h4>1. Focus Is a Limitation</h4><p>The model received all the rules, every single one was included in the prompt. The problem wasn’t that it couldn’t see them. It was that it couldn’t stay consistent across them. LLMs don’t truly hold a coherent set of logic. They process text in segments, and once the reasoning path grows too wide, earlier parts lose their weight.</p><p>It’s not a lack of data; it’s a lack of structured focus.</p><h4>2. It Knew the Rules but Couldn’t Follow Them</h4><p>This wasn’t a surprise, it’s exactly what I expected.</p><p>The model could restate the rules beautifully, explain dependencies, even paraphrase the entire logic in clear English. But when asked to decide which materials belong in an order, it didn’t apply the rules, It generated a response that fit the <em>linguistic pattern</em> of correctness, not the actual logic behind it.</p><p>The LLM didn’t execute something like:</p><pre>if A and not B:<br>  include X</pre><p>It generated text tokens that statistically fit the pattern of “correct” language. That’s reasoning through probability, not computation.</p><p>Even when it sounds confident, it’s not executing, it’s guessing.</p><h4>3. Cost and Efficiency</h4><p>Even if it had been accurate, it would have been inefficient.</p><p>Running an LLM validation for every order means endless token consumption, time, money, and compute, for something that deterministic logic can handle in milliseconds.</p><h4>4. Determinism</h4><p>Running the same order multiple times produced different results. Different inconsistencies, different conclusions.</p><p>That’s not logic. That’s probability pretending to be precision.</p><h3>What Agentic AI is actually good at</h3><p>Agentic AI isn’t the miracle it’s marketed to be. It shines when the problem is about <em>understanding words</em>.</p><p>An AI agent can:</p><ul><li>Read and interpret long, messy, human-written text.</li><li>Extract explicit rules from natural language.</li><li>Rephrase or normalize them into structured, machine-readable formats (like JSON or SQL conditions).</li><li>Automate the process of preparing logic for deterministic systems.</li></ul><p>What it can’t do - and didn’t do in my case - is reason relationally across all rules. It couldn’t identify subtle dependencies or resolve contradictions between them. It understood each rule in isolation but not the system of rules as a whole.</p><p>In short: Agentic AI can interpret logic, but not enforce it. It’s a translator and orchestrator, but never the final decision maker.</p><h3>Let AI Handle the Language, and Code Handle the Logic</h3><p>The solution wasn’t to blend AI and code into one system — it was to let each do what it’s good at: The LLM interprets and structures the text; the deterministic engine makes the decisions.</p><p>The Correct Architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*Dh7trNBu1KUi0ttX5tCmwA.png" /><figcaption>Source: Philips</figcaption></figure><p>The agent runs once, to translate human logic into structure. From there, my own code applies it deterministically - fast, transparent and cost free.</p><p>The deterministic layer became the real engine of the solution. It’s where every structured rule, once normalized by the LLM, is programmatically evaluated against the data.</p><p>Each rule follows explicit logic: conditions, dependencies, inclusions, and exclusions, all executed by code, not guessed by probability.</p><p>This approach allows me to:</p><ul><li>Run validation across thousands of orders in seconds. Trace exactly why a material was included or excluded.</li><li>Guarantee identical results every time the same data is processed.</li><li>Adjust or extend logic safely without retraining or prompt tuning.</li></ul><p>In other words, once the rules were structured, the system became fully explainable and repeatable. This approach keeps AI in the right place: interpreting but not deciding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*ufFembLbF0qt0YgJPXw0QA.png" /><figcaption>Input Data Sample. Source: Philips</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*vtAx0cKnT4gnRaVMIhKHlA.png" /><figcaption>Deterministic output from the LLM Sample. Source: Philips</figcaption></figure><p>Agentic AI systems can plan, reason and act with impressive autonomy, but their power has limits. They excel at understanding and reasoning through language, not at executing data-driven, deterministic validation.</p><p>The line between “AI reasoning” and “programmatic logic” must stay clear. That is how you build trustworthy automation.</p><h3>Takeaway: Use AI Where Language Ends, Not Where Logic Begins</h3><p>LLMs should be used where <strong>language understanding</strong> is required, to interpret, extract, and structure information from unstructured text.<br>But they can’t (and shouldn’t) replace <strong>deterministic, business logic driven systems</strong>.<br>True solutions are built in code, where every rule, dependency, and decision can be tested, controlled, and trusted.</p><p>The real value of AI isn’t replacing logic, it’s making logic understandable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60892c296448" width="1" height="1" alt=""><hr><p><a href="https://medium.com/philips-technology-blog/agentic-ai-isnt-here-to-decide-it-s-here-to-understand-60892c296448">Agentic AI isn’t here to decide, it’s here to understand</a> was originally published in <a href="https://medium.com/philips-technology-blog">Philips Technology Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Your Own AI English Tutor Telegram Bot — Local & Free]]></title>
            <link>https://medium.com/philips-technology-blog/build-your-own-ai-english-tutor-telegram-bot-local-free-d739621e7b1c?source=rss-818db97b9c14------2</link>
            <guid isPermaLink="false">https://medium.com/p/d739621e7b1c</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[n8n]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Hadar Dashty]]></dc:creator>
            <pubDate>Thu, 05 Jun 2025 06:39:43 GMT</pubDate>
            <atom:updated>2025-06-05T06:39:43.522Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build Your Own AI English Tutor Telegram Bot — Local &amp; Free</h3><h4>Complete Windows Tutorial with Docker, n8n, Ollama, and PostgreSQL</h4><h3>Introduction</h3><p>We’re living in a time where AI agents are no longer limited to big tech companies or expert developers. Thanks to recent breakthroughs, anyone — even with zero technical background — can now create their private powerful AI assistants that automate, teach, help, and inspire. These tools are easy to use, often completely free, and incredibly powerful.</p><p>Now, imagine having your own AI English tutor living inside your Telegram account — a bot that chats naturally, corrects your grammar, explains mistakes simply, and remembers your conversation history. All of this running locally on your Windows machine, keeping your data completely private.</p><p>In this tutorial, we’ll build a sophisticated Telegram bot using:</p><ul><li><strong>n8n</strong>: A powerful no-code workflow automation platform</li><li><strong>Ollama</strong>: Local AI language models (like ChatGPT but private)</li><li><strong>PostgreSQL</strong>: Database for storing conversation history</li><li><strong>Docker</strong>: To run everything in containers</li><li><strong>Ngrok</strong>: To expose your local bot to the internet</li><li><strong>Telegram</strong>: Where your bot will live</li></ul><p>The best part? You won’t write a single line of code!</p><h3>What You’ll Build</h3><p>Your AI tutor will:</p><ul><li>Correct grammar and vocabulary mistakes</li><li>Explain errors in simple terms</li><li>Ask follow-up questions to keep conversations flowing</li><li>Remember your conversation history</li><li>Run completely locally on your machine</li></ul><h3>Prerequisites</h3><ul><li>Windows 10/11</li><li>Basic computer skills (no coding required!)</li></ul><h3>Installations</h3><h4>Step 1: Install Docker Desktop</h4><p>Docker lets us run applications in containers, making setup much easier.</p><ol><li>Download Docker Desktop for Windows from: <a href="https://www.docker.com/products/docker-desktop">https://www.docker.com/products/docker-desktop</a></li><li>Run the installer and follow the installation wizard</li><li>Restart your computer when prompted</li><li>Open Docker Desktop and wait for it to start (you’ll see “Docker Desktop is running” in the system tray)</li></ol><p><strong>Important</strong>: Make sure WSL2 is enabled. Docker Desktop will prompt you if it’s not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*qbTIq-El8MB0bcZFoPgwWg.png" /></figure><h4>Step 2: Create Docker Network</h4><p>We need all our services to communicate with each other. Let’s create a shared network:</p><ol><li>Open Command Prompt (CMD) as Administrator</li></ol><ul><li>Press Windows key, type “cmd”</li><li>Right-click on “Command Prompt” and select “Run as administrator”</li></ul><p>2. Run this command:</p><pre>docker network create n8n-network</pre><p>You should see a long ID returned — this means the network was created successfully.</p><h4>Step 3: Install and Run PostgreSQL</h4><p>PostgreSQL will store your conversation history, allowing the bot to remember previous chats.</p><ol><li>In the same CMD window (running as Administrator), run:</li></ol><pre>docker run --name my-postgres --network n8n-network -e POSTGRES_PASSWORD=123456 -e POSTGRES_DB=postgres -p 5432:5432 -d postgres</pre><p>This command:</p><ul><li>Creates a PostgreSQL container named my-postgres</li><li>Connects it to our n8n-network</li><li>Sets the password to 123456 (you can change this)</li><li>Makes it accessible on port 5432</li></ul><ol><li>Verify it’s running:</li></ol><pre>docker ps</pre><p>You should see my-postgres in the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UAYQqQ6xnSm2jC9N89Xthw.png" /></figure><h4>Step 4: Install Ollama</h4><p>Ollama runs AI models locally on your machine.</p><ol><li>Download Ollama for Windows: <a href="https://ollama.com/download">https://ollama.com/download</a></li><li>Install Ollama and let it start</li><li>Open a new CMD window and run the model:</li></ol><pre>ollama run mistral</pre><p>This downloads the AI model (about 4GB depending on the model).</p><p>Keep Ollama running in the background.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oy4H66QnjH3C-A-Mb5EicA.png" /></figure><h4>Step 5: Set Up Ngrok</h4><p>Ngrok creates a secure tunnel from the internet to your local machine, allowing Telegram to send messages to your bot.</p><ol><li>Go to <a href="https://ngrok.com/">https://ngrok.com</a> and create a free account</li><li>After signing up, you’ll be taken to your dashboard</li><li>In the dashboard, look for “Your Authtoken” section (usually on the getting started page)</li><li>You’ll see a long string that looks like: 2YourAuthTokenHere_randomcharacters</li><li>Click the “Copy” button next to your authtoken</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OyCogu4AJ2aTUF01v2ew8g.png" /><figcaption>Ngrok dashboard showing authtoken location</figcaption></figure><p>6. Download Ngrok for Windows from the download page</p><p>7. Extract the zip file to a folder (e.g., C:\ngrok)</p><p>8. Open CMD, navigate to the ngrok folder and authenticate:</p><pre>cd C:\ngrok<br>ngrok authtoken 2YourAuthTokenHere_randomcharacters</pre><p>9. Replace 2YourAuthTokenHere_randomcharacters with your actual token you copied from the dashboard.</p><p>You should see: “Authtoken saved to configuration file”</p><h4>Step 6: Create Your Telegram Bot</h4><ol><li>Open Telegram (desktop or mobile app)</li><li>In the search bar, type @BotFather and click on the verified BotFather account (it has a blue checkmark)</li><li>Click “Start” or send /start to begin conversation with BotFather</li><li>Type the command: /newbot</li><li>BotFather will ask you for a name for your bot. This is the display name (e.g., “My English Tutor”)</li><li>Next, BotFather will ask for a username. This must:</li></ol><ul><li>Be unique</li><li>End with the word “bot”</li><li>Use only letters, numbers, and underscores</li><li>Example: MyEnglishTutor_bot or SuperTutor2024_bot</li></ul><p>(If the username is taken, try another one)</p><p>7. Once successful, BotFather will send you a message with your bot’s token (looks like: 1234567890:AAFabcdefGHIjklmnoPQRsTUvwxyz)</p><blockquote><strong>IMPORTANT</strong>: Copy and save this token somewhere safe — you’ll need it soon!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MBfwWqQL86kxz5qV3RcBA.png" /></figure><h4>Step 7: Pull n8n Docker Image</h4><p>Before we can run n8n, we need to download its Docker image.</p><ol><li>In CMD (as Administrator), run:</li></ol><pre>docker pull n8nio/n8n</pre><p>This downloads the n8n image (might take a few minutes depending on your internet speed).</p><h4>Step 8: Create the Startup Script</h4><p>Let’s create a batch file that starts everything properly:</p><ol><li>Create a folder for n8n data: C:\n8n_data (this will store your workflows)</li><li>In C:\n8n-data, create a file called start-bot.bat with this content:</li></ol><pre>@echo off<br>setlocal enabledelayedexpansion<br><br>REM Start ngrok in a new window<br>start &quot;ngrok&quot; cmd /k ngrok http 5678<br><br>REM Wait for ngrok to start (increase if needed)<br>timeout /t 10 &gt;nul<br><br>REM Use PowerShell to get the forwarding URL from ngrok API<br>for /f &quot;delims=&quot; %%u in (&#39;powershell -Command ^<br>    &quot;(Invoke-RestMethod -Uri http://127.0.0.1:4040/api/tunnels).tunnels | Where-Object { $_.proto -eq &#39;https&#39; } | Select-Object -First 1 -ExpandProperty public_url&quot;&#39;) do set WEBHOOK_URL=%%u<br><br>echo Ngrok forwarding URL is: !WEBHOOK_URL!<br><br>REM Start n8n docker with the extracted URL in a new cmd window<br>start &quot;n8n&quot; cmd /k docker run --network n8n-network -it --rm -p 5678:5678 -v C:\n8n_data:/home/node/.n8n -e WEBHOOK_URL=!WEBHOOK_URL! -e N8N_BASIC_AUTH_ACTIVE=false -e N8N_DIAGNOSTICS_ENABLED=false -e N8N_HOOKS_ENABLED=false n8nio/n8n<br><br>endlocal</pre><p>3. Save the file and run it by double-clicking</p><p>Wait about 30 seconds for n8n to fully start.</p><p>This script:</p><ul><li>Starts Ngrok and gets the public URL</li><li>Starts n8n with the correct webhook URL</li><li>Opens both in separate windows so you can monitor them</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DzzF7Up_Aw3PMyAnSLjC7A.png" /><figcaption>Both command windows running</figcaption></figure><h4>Step 9: Access n8n</h4><ol><li>Look at the n8n command window (titled “n8n”)</li><li>You’ll see output showing n8n is starting, and near the bottom you’ll see:</li></ol><pre>Editor is now accessible via:<br>https://abc123xyz.ngrok-free.app</pre><blockquote><strong>IMPORTANT</strong>: You’ll also see your Ngrok URL in the output, something like:</blockquote><pre>Webhook URL: https://abc123xyz.ngrok-free.app</pre><p>This is your public webhook URL that Telegram will use to send messages to your bot. This it also the URL to load n8n:</p><ol><li>Open your browser and go to: <a href="https://abc123xyz.ngrok-free.app/">https://abc123xyz.ngrok-free.app</a></li><li>Once you get this screen click on ‘Visit Site’:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vnQRg3y6D3i4rEiFzmvzvQ.png" /></figure><p>3. Create an account (this is just for your local instance — use any email/password you want)</p><p>4. Once logged in, you’ll see the n8n workflow editor</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x3ZQweeB73eiEAExAF83Lw.png" /></figure><p>5. Click on ‘Create Workflow’ to create a new workflow.</p><h3>Build the n8n Workflow Step by Step</h3><p>Now that we have completed to set up the environment, we’ll create the workflow from scratch. Don’t worry, it’s easier than it looks!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JckI6F2DMLAKZOYOnni-gA.png" /></figure><h4>Step 1: Add Telegram Trigger</h4><ol><li>In the n8n editor, click the “+” button to add a new node</li><li>Search for “Telegram” and select “Telegram Trigger”</li><li>Click on the node to configure it:</li></ol><ul><li>Click “Create New Credential”</li><li>Paste your bot token from BotFather under “Access Token”</li><li>Enter Base URL: “<a href="https://api.telegram.org/">https://api.telegram.org</a>”</li><li>Name it “Telegram account” and click “Create”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*awrWPuW0e35aFzlbL8hInQ.png" /></figure><p>4. In the Telegram Trigger settings:</p><ul><li>Make sure “Message” is checked under “Trigger On”</li><li>Leave other settings as default</li></ul><p>5. Click “Listen for Test Event” to get your webhook URL</p><p>Copy the webhook URL shown (it will look like: <a href="https://abc123xyz.ngrok-free.app/webhook/telegram-trigger)">https://abc123xyz.ngrok-free.app/webhook)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*5vdVUYLGVUgnYtyrFioWrg.png" /><figcaption>Telegram Trigger configuration</figcaption></figure><h4>Step 2: Add AI Agent Node</h4><ol><li>Back in n8n, click the “+” button again</li><li>Search for “AI Agent” and select it</li><li>Connect it to the Telegram Trigger by dragging from the trigger’s output to the AI Agent’s input</li><li>Click on the AI Agent to configure:</li></ol><ul><li>Prompt Type: “Define below”</li><li>Text: {{ $json.message.text }}</li><li>Click “Add Option” → “System Message”</li><li>Paste this:</li></ul><blockquote>You are a professional but friendly English tutor. Your main goal is to help the learner improve their English by correcting grammar, vocabulary, and sentence structure in a clear and concise way. Keep responses short, focused, and helpful. When the learner makes a mistake, correct it, explain it briefly, and then ask a follow-up question to continue the conversation naturally. Do not overtalk or go off-topic. Stay focused on teaching and improving the learner’s English through conversation.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*dCQLN4SaHvgRoZlTX7I1qw.png" /></figure><h4>Step 3: Add Ollama Chat Model</h4><ol><li>You’ll notice the AI Agent has a connection point at the bottom for “Chat Model”</li><li>Click the “+” on that connection point</li><li>Search for “Ollama” and select “Ollama Chat Model”</li><li>Configure Ollama:</li></ol><ul><li>Click “Create New Credential”</li><li>Base URL: <a href="http://host.docker.internal:11434/">http://host.docker.internal:11434</a></li><li>Name it “Ollama account” and click “Create”</li><li>Model: llama3.2:latest</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vb9bmeNa-lzK5SATAzMPZA.png" /><figcaption>Ollama configuration</figcaption></figure><h4>Step 4: Add PostgreSQL Chat Memory</h4><ol><li>On the AI Agent, you’ll see another connection point for “Memory”</li><li>Click the “+” on that connection point</li><li>Search for “Postgres” and select “Postgres Chat Memory”</li><li>Configure PostgreSQL:</li></ol><ul><li>Click “Create New Credential”</li><li>Host: my-postgres</li><li>Database: postgres</li><li>User: postgres</li><li>Password: 123456</li><li>Port: 5432</li><li>SSL: Leave unchecked</li><li>Name it “Postgres account” and click “Create”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W99cHoO7QGPew7q3FqfhmA.png" /></figure><p>5. In the Postgres Chat Memory settings:</p><ul><li>Session ID: “Custom”</li><li>Session Key: {{ $(&#39;Telegram Trigger&#39;).item.json.message.chat.id }}</li><li>This ensures each Telegram chat has a unique ID</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*8bsjpfSRx15z-hTC2OtRjw.png" /></figure><h4>Step 5: Add Telegram Send Message Node</h4><ol><li>Click the “+” button in the main canvas</li><li>Search for “Telegram” and select “Telegram” (not the trigger)</li><li>Connect the AI Agent output to this node</li><li>Configure:</li></ol><ul><li>Resource: “Message”</li><li>Operation: “Send Message”</li><li>Use the same Telegram credential from before</li><li>Chat ID: {{ $(&#39;Telegram Trigger&#39;).item.json.message.chat.id }}</li><li>Text: {{ $json.output }}</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*bZsm2B_z7I0h4V5If5ItGQ.png" /></figure><h4>Step 6: Final Workflow Check</h4><p>Your workflow should now look like this:</p><ul><li>Telegram Trigger → AI Agent → Telegram</li><li>With Ollama Chat Model connected to AI Agent’s bottom</li><li>With Postgres Chat Memory connected to AI Agent’s side</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JckI6F2DMLAKZOYOnni-gA.png" /></figure><h4>Step 7: Activate and Test Your Bot</h4><ol><li>Click the “Save” button to save your workflow</li><li>Click “Activate” in the top right corner</li><li>The workflow is now live!</li><li>Open Telegram and find your bot (search for the username you created)</li><li>Send a message with grammar mistakes and see how your bot respond with corrections and a follow-up question!</li></ol><h3>Conclusion</h3><p>Congratulations! You’ve built a sophisticated AI tutor bot that:</p><ul><li>Runs completely locally</li><li>Remembers conversation history</li><li>Provides natural, helpful corrections</li><li>All tools are free and cost nothing to run</li></ul><p>This same setup can be adapted for many other use cases:</p><ul><li>Customer service bots</li><li>Personal assistants</li><li>Language translation bots</li><li>Study helpers</li></ul><p>The possibilities are endless with n8n’s no-code approach!</p><h3>Next Steps</h3><ol><li>Experiment with different AI models in Ollama</li><li>Customize the bot’s personality</li><li>Add more sophisticated workflows</li></ol><p>Happy learning! 🚀</p><p><em>All images owned by author, Hadar Dashty</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d739621e7b1c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/philips-technology-blog/build-your-own-ai-english-tutor-telegram-bot-local-free-d739621e7b1c">Build Your Own AI English Tutor Telegram Bot — Local &amp; Free</a> was originally published in <a href="https://medium.com/philips-technology-blog">Philips Technology Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leveraging AI Chatbot to Visualize Software Architecture with PlantUML]]></title>
            <link>https://medium.com/philips-technology-blog/leveraging-ai-chatbot-to-visualize-software-architecture-with-plantuml-a1500c060f5b?source=rss-818db97b9c14------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1500c060f5b</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[plantuml]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Hadar Dashty]]></dc:creator>
            <pubDate>Fri, 25 Oct 2024 13:59:42 GMT</pubDate>
            <atom:updated>2024-11-18T13:26:26.942Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first started learning about the <strong>Azure Lakehouse</strong> architecture, I found myself trying to wrap my head around the relationships between all the different components involved: Unity Catalog, Databricks, Spark, Azure Data Lake, and so on. I was eager to understand how they all connected and worked together. As a tech enthusiast, I’m always looking for ways to simplify complicated workflows such as this.</p><p>As usual, I turned to <strong>AI Chatbot </strong>for explanations. It gave me detailed descriptions of how these components interacted. However, I believe the best way to learn is through visuals — diagrams help me make sense of complex ideas. So, I thought, “Why not turn these explanations into diagrams?”</p><p>That’s when I decided to use AI<strong> </strong>to automatically generate diagrams, using the information I got from the Chatbot. This way, I could not only understand the connections better but also create useful visuals to share with others.</p><p>In this article, I’ll explain how I used AI Chatbot and <strong>PlantUML</strong> to create a block diagram that shows the relationships between components — in just a few minutes.</p><h3>The AI Chatbot + PlantUML Solution</h3><p>To create my diagrams, I decided to combine ChatGPT’s explanations with a tool called PlantUML, which lets you create diagrams using text. Here’s the simple process I followed:</p><p><strong>1. Installed the PlantUML extension in VS Code:</strong> PlantUML is a handy tool that converts simple text commands into diagrams. Primarily, it is used to generate UML diagrams. It integrates seamlessly with Visual Studio Code. Until that point I wasn’t familiar with PlantUML, but its usage is very simple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FEb88W_l5OEbMfseFKah4w.png" /></figure><p><strong>2. Next, I asked ChatGPT for help creating a diagram</strong> that showed how all these components relate to each other. My prompt was simple:</p><blockquote>“i need PlantUML block diagram code that explains the relations and hierarchy of databricks and data lake. show the relations, and object hierarchy with each other. lets say i have data stored on Azure Data Lake Storage or on mongodb. i want to see how it is connected to azure databricks and how is it connected to databricks delta lake and unity catalog and python and spark — and eventually have the data displayed on power bi, or .net api. i want that each rectangle will contain brief explanation about the object.”</blockquote><p><strong>3. ChatGPT provided me with a ready-made PlantUML script</strong> that I could use to create the diagram. All I had to do was copy it into a new file which I created in VS Code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hSkaBhVFlwICtBoq2Y30bw.png" /></figure><p><strong>4. Then I created the diagram in PlantUML:</strong> I saved the script into a new .puml file, pressed ALT+D, and just like that, the diagram appeared:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AzYRY3sQi4GUQZ9yH8z_eQ.png" /></figure><h3>The Results — My First Diagram</h3><p>The AI-generated diagram wasn’t perfect the first time, but it gave me a solid starting point. The cool part is that it only took about <strong>10 minutes</strong> to get the first diagram — something that would have taken much longer if I’d tried to make sense of everything manually just from reading the GPT text.</p><p>By getting a visual right away, I could immediately see how everything connected, which made learning the architecture far more intuitive.</p><p>Here’s the <strong>PlantUML code</strong> I got from ChatGPT:</p><pre>@startuml<br><br>!define RECTANGLE_COLOR #ADD8E6<br>!define TEXT_COLOR #000000<br><br>&#39; Define colors for rectangles and text<br>skinparam rectangle {<br>    BackgroundColor RECTANGLE_COLOR<br>    BorderColor TEXT_COLOR<br>    FontColor TEXT_COLOR<br>}<br><br>rectangle &quot;Azure Data Lake Storage\nStores large-scale data&quot; as ADLS<br>rectangle &quot;MongoDB\nNoSQL database for unstructured data&quot; as MongoDB<br>rectangle &quot;Azure Databricks\nUnified analytics platform&quot; as Databricks<br>rectangle &quot;Databricks Delta Lake\nOptimized storage format&quot; as DeltaLake<br>rectangle &quot;Unity Catalog\nData governance and cataloging&quot; as UnityCatalog<br>rectangle &quot;Python\nProgramming language for data processing&quot; as Python<br>rectangle &quot;Spark\nBig data processing engine&quot; as Spark<br>rectangle &quot;Power BI\nBusiness analytics and visualization&quot; as PowerBI<br>rectangle &quot;.NET API\nApplication programming interface&quot; as DotNetAPI<br><br>ADLS -[hidden]-&gt; Databricks<br>MongoDB -[hidden]-&gt; Databricks<br><br>ADLS --&gt; Databricks : Load data<br>MongoDB --&gt; Databricks : Load data<br>Databricks --&gt; DeltaLake : Use Delta Lake format<br>Databricks --&gt; UnityCatalog : Catalog and govern data<br>Databricks --&gt; Spark : Process data with Spark<br>Databricks --&gt; Python : Code and data manipulation<br><br>DeltaLake --&gt; PowerBI : Visualize data<br>UnityCatalog --&gt; PowerBI : Data governance for Power BI<br>Python --&gt; PowerBI : Data analysis and scripting<br>Python --&gt; DotNetAPI : Custom data processing<br>Spark --&gt; PowerBI : Data processing and transformation<br>Spark --&gt; DotNetAPI : Big data processing tasks<br><br>@enduml</pre><p>This gave me a clear picture of how all the parts of the Azure Lakehouse architecture are connected:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*MIHGvP1plM0P2GCMSI3r9w.png" /><figcaption>first diagram</figcaption></figure><h3>Iterating and Improving</h3><p>After seeing the first diagram, I could easily tweak and refine it to make it more precise. What’s great is that I now have a workflow where I can quickly make changes, ask ChatGPT for improvements, and regenerate the diagram quickly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJ3VQZ4Mbl7D-tkpSLaszA.png" /><figcaption>final refined diagram</figcaption></figure><p>To summarize, if you’re diving into any new software architecture, I highly recommend trying out this approach. With AI tools like ChatGPT and PlantUML, you can quickly understand and create diagrams for any tech stack — not just Azure Lakehouse but also architectures like <strong>AWS Lambda</strong>, <strong>Kubernetes clusters</strong>, <strong>microservices</strong> setups, <strong>data pipelines</strong>, and <strong>IoT systems</strong>. And it’s not just for learning - this method is also useful for creating accurate, professional diagrams to use in your own software projects, saving you hours while delivering clear, insightful visuals in just minutes.</p><p>You can also experiment with different AI chatbots like <strong>ClaudeAI</strong>, <strong>Gemini</strong>, or <strong>Copilot</strong> to compare the quality of the diagrams and find which works best for your needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1500c060f5b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/philips-technology-blog/leveraging-ai-chatbot-to-visualize-software-architecture-with-plantuml-a1500c060f5b">Leveraging AI Chatbot to Visualize Software Architecture with PlantUML</a> was originally published in <a href="https://medium.com/philips-technology-blog">Philips Technology Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I preffer Visual Studio 2022 AI intellisense over Jetbrains ReSharper]]></title>
            <link>https://medium.com/@hadards/why-i-preffer-visual-studio-2022-ai-intellisense-over-jetbrains-resharper-a76928105e61?source=rss-818db97b9c14------2</link>
            <guid isPermaLink="false">https://medium.com/p/a76928105e61</guid>
            <category><![CDATA[vs2022]]></category>
            <category><![CDATA[intellisense]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Hadar Dashty]]></dc:creator>
            <pubDate>Thu, 16 Feb 2023 10:55:51 GMT</pubDate>
            <atom:updated>2023-02-23T19:24:58.053Z</atom:updated>
            <content:encoded><![CDATA[<h4>Or, 3 reasons why you should use VS2022 AI intellisense for C# code</h4><p>I’ll start with a disclosure regarding my subjective opinion— I am a big fan of using software in it’s original form and keeping it simple.</p><p>I’ve been writing code using Microsoft IDEs for about 2 decades, and I’m fully aware of the evolution of VS intellisense over the years, and I have to say — I’m very impressed with Microsoft’s AI version of intellisense.</p><p>Last year I used Jerbrains ReSharper on VS2019 while writing C# code for a while. I really wanted to give it a try, but the more I used it, I missed more and more VS intellisense snippets that I was used to and were gone.</p><p>So if you are a freak of keyboard shortcuts, and tend to use less of mouse operations, like I do — you probably noticed that even if changing ReSharper’s shortcuts settings — some original VS shortcuts are still replaced.</p><p>It looks like Jetbrain took a very strange user experience decision, which was to overwrite VS original shortcuts keys with completely different features of their own. This can be very frustrating for people who are used to using certain shortcuts over the years.</p><p>Imagine that the common shortcut CTRL+C on windows OS, will not copy to clipboard anymore, but instead, it will open a command line window. Wouldn’t it be strange?</p><p>Anyway, I guess that by this, they lost Generation Y developers :)</p><p>Here are some of the shortcuts that I found different while using ReSharper:</p><ul><li>ALT+Shift+F10 to get suggestions (especially used to import namespaces):</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*XEHB0KzF3lIPO7yOe__vPQ.png" /><figcaption>ALT+Shift+F10 on DllImport suggets the namespace to add</figcaption></figure><p>I searched the settings a lot in order to find this missing part with no luck. This shortcut is completely blocked when using ReSharper.</p><ul><li>CTRL+. to Extract method</li></ul><p>So instead of opening this menu when selecting CTRL+.:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*J0G--WgGwGJWaT3i51t9oQ.png" /></figure><p>ReSharper opens this menu when selecting CTRL+.:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/157/1*un6iSDHnx8D8Yyx-QXA1XA.png" /></figure><p>I couldn’t find how to bring back the old Extract method menu too.</p><p>One really really great feature that ReSharper has, which is definitely an advantage over VS intellisense, is the ‘search everywhere’ menu. By pressing CTRL+T, you are getting a free text field. When the search is performed, results are updated while typing the characters on this field. This makes the search process much quicker:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*w99BpW19Bq7toTBJ.png" /><figcaption>From: <a href="https://www.jetbrains.com/resharper/features/navigation_search.html">https://www.jetbrains.com/resharper/features/navigation_search.html</a></figcaption></figure><p>Read more about it here: <a href="https://www.jetbrains.com/resharper/features/navigation_search.html">https://www.jetbrains.com/resharper/features/navigation_search.html</a></p><p>Here are 3 reasons why you should use VS2022 AI intellisense instead of installing any other 3rd party assistance:</p><h3>Repeated Copy\Paste</h3><p>Let’s say I have this class, with hard-coded strings written in it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*rRG-lRKrtF2YgKH8fW2VGg.png" /><figcaption>Hard-coded strings on lines 12, 16, 20, 24</figcaption></figure><p>And now I want to copy the ‘LibraryName’ variable in line 9, and place it instead of DLLImport hard-coded strings.</p><p>So I copy it from line 9, and paste it instead of the string on line 12, and then on line 16. And on the third time, once I select the line (line number 20) — VS intellisense understands that I am pasting the same string, and suggests to tab and accept the paste:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*aIvfsH3LGNbfgiswpvGWdA.png" /><figcaption>intellisense on line #20</figcaption></figure><p>Than on the next lines — just click and tab. Very cool.</p><h3>Whole line Auto Completion</h3><p>When you write a line of code, you will notice that VS intellisense suggests the next line of code. And in many cases — you will find that the suggested string is exactly what you want to write next.</p><p>Check out this simple method. Once you finish to write ‘client.ClientId’, VS intellisense suggests to compare it with the method’s argument, which is exactly the desired code here.</p><p>By hitting ‘tab’, this code will be automatically written.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*88rSBxNqXLZMvtOhyy_RQg.png" /></figure><h3>Auto suggestions for common coding</h3><p>In the following example you can see this nice suggestion on a simlpe method which is meant to delete an item from a list when the item is found.</p><p>Once I write the ‘if’ statement, the intellisense suggests to add the line:</p><pre>clientsFiles.Remove(client);</pre><p>Once I click on ‘tab’, the suggestion is accepted and the line is added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*uFTH7WVAIGEhblkK-KnU5A.png" /><figcaption>Once I wrote the ‘if’ statement, the intellisense suggests to add the line</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*JS5ieKXHlKU1Pu-BIhZGsQ.png" /><figcaption>Name of a field as a suggestion</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*lJKC4p3anng00lXlZ8_NdA.png" /><figcaption>Another member as a suggestion</figcaption></figure><h3>The bottom line</h3><p>If you are not using it yet, I strongly advise you to upgrade to VS2022, and don’t install any 3rd party assistance extension. Use the VS2022 intellisense and give it a try. You are not going to regret it.</p><p>Read more on: <a href="https://visualstudio.microsoft.com/services/intellicode/">https://visualstudio.microsoft.com/services/intellicode/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a76928105e61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Walkthrough: HTTP & SignalR web application using .net 7 and angular 14]]></title>
            <link>https://medium.com/@hadards/walkthrough-http-signalr-web-application-using-net-7-and-angular-14-42a9fcacd0d8?source=rss-818db97b9c14------2</link>
            <guid isPermaLink="false">https://medium.com/p/42a9fcacd0d8</guid>
            <category><![CDATA[signalr]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[web-application-developer]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Hadar Dashty]]></dc:creator>
            <pubDate>Tue, 03 Jan 2023 09:58:52 GMT</pubDate>
            <atom:updated>2023-01-08T13:52:41.958Z</atom:updated>
            <content:encoded><![CDATA[<h3>Walkthrough: HTTP &amp; SignalR web application using .net 7 and angular 14</h3><h4>Create your first web application using HTTP and signalR with asp.net core code as a server and angular code as a client</h4><p><em>Code is uploaded to github; link is at the bottom of this page.</em></p><p>Every web project I start, I always think how convenient it could have been if I only had a template project as a reference, instead of starting a new project from scratch every time.</p><p>So finally I found the time to do that and here it is, explained step by step.</p><p>Microsoft has a very nice skeleton project for creating a web application - The server side is a C# code used by asp.net core. This server serves the client side which is implemented as a Single Page Application (SPA) in angular.</p><p>Let’s say we want to create a project which handles cars that enter and exit a parking lot.</p><h3>Part 1: Web API HTTP REST between client and server</h3><p>Open VS2022, Click on ‘Create a new project’ and search for ‘ASP.NET with Angular’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yXh4y9mFVofsZ_kQDrNVGg.png" /><figcaption>VS2022 project template</figcaption></figure><p>Click ‘Next’ in all up-coming screens and chose a name and path for your project.</p><p>When the project is created, add 2 folders to your project structure:</p><ol><li>Models</li><li>Services</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*p-YWwGiHoQViRFDciz1Pdw.png" /><figcaption>Project’s folders structure</figcaption></figure><p>This structure will help us keeping our project well organized.</p><p>Let’s start with ‘Models’ and define our first Model. Create a new class under ‘Models’ folder, and call it ‘CarModel’. In this class we will describe the car object with its properties. This class will also be used to transfer data between the client and the server.</p><pre>namespace AspAngularTemplate.Models<br>{<br>    public class CarModel<br>    {<br>        public string Id { get; set; }<br>        public string Description { get; set; }<br>    }<br>}</pre><p>Now, we’ll define our CarService. This service will handle cars data and it will simulate a usage of a database server (in this example we’ll not be using a database, we will use a collection in server’s side in-memory instead).</p><p>Create a new class called ‘CarService’ under ‘Services’ folder:</p><pre>using AspAngularTemplate.Models;<br><br>namespace AspAngularTemplate.Services<br>{<br>    public class CarsService<br>    {<br>        List&lt;CarModel&gt; lst = new();<br><br>        public void AddCar(CarModel car)<br>        {<br>            lst.Add(car);<br>        }<br><br>        public void DeleteCar(string carId)<br>        {<br>            foreach (var item in lst)<br>            {<br>                if (item.Id == carId)<br>                {<br>                    lst.Remove(item);<br>                    break;<br>                }<br>            }<br>        }<br><br>        public List&lt;CarModel&gt; GetAllCars()<br>        {<br>            return lst;<br>        }<br><br>        public CarModel GetCar(string carId)<br>        {<br>            return lst.Find(c =&gt; c.Id == carId);<br>        }<br>    }<br>}</pre><p>Now that we have the service and the model, we can start creating the controller which will be function as HTTP communication layer with the client.</p><p>We will create ‘post’ and ‘get’ commands only. That will be enough for this simple example.</p><p>Right click ‘Controllers’ folder -&gt; Add -&gt; Controller</p><p>In the next screen select ‘API controller with read/write actions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y7jKm8KFVfFcpqD3WAlktg.png" /></figure><p>Click ‘Add’ and save it under the name ‘CarsController’.</p><p>Now .Net created a nice skeleton of REST commands. But we actually don’t need those commands. We will write commands of our own instead, that are suitable for this project.</p><p>First we will inject CarsService to the controller’s constructor so we can use its methods:</p><pre>CarsService carsService = null;<br>public CarsController(CarsService service)<br>{<br>    carsService = service;<br>}</pre><p>Afterwards, we will implement post, get and delete REST commands as follow (we won’t implement ‘put’ method for now):</p><pre>// GET: api/&lt;CarsController&gt;<br>[HttpGet]<br>public IEnumerable&lt;CarModel&gt; Get()<br>{<br>    return carsService.GetAllCars();<br>}<br><br>// GET api/&lt;CarsController&gt;/5<br>[HttpGet(&quot;{id}&quot;)]<br>public ActionResult&lt;CarModel&gt; Get(string id)<br>{<br>    return carsService.GetCar(id);<br>}<br><br>// POST api/&lt;CarsController&gt;<br>[HttpPost]<br>public void Post([FromBody] CarModel car)<br>{<br>    carsService.AddCar(car);<br>}<br><br>// DELETE api/&lt;CarsController&gt;/5<br>[HttpDelete(&quot;{id}&quot;)]<br>public void Delete(string id)<br>{<br>    carsService.DeleteCar(id);<br>}</pre><p>Last on the server side, we must declare our ‘CarsService’ so the dependency injection mechanism of .net will be able to use our service in the application. In program.cs file, we will use the builder and type:</p><pre>builder.Services.AddSingleton&lt;CarsService&gt;();</pre><p>Now that we have a server to start with, let’s move on to implement client side. Open vs code from ‘ClientApp’ folder within your asp.net project folder.</p><p>First of all, we need to add the ‘cars’ controller to ‘proxy.conf.js’ file under ‘ClientApp’ file. This is a very important step. If we will not do that, the client will not find this route on server side. I have spent 2 hours on this issue until I figured out why the client cannot find the routes on server side…</p><p>So the file should look like this:</p><pre>const PROXY_CONFIG = [{<br>    context: [<br>        &quot;/weatherforecast&quot;,<br>        &quot;/api/cars&quot;<br>    ],<br>    target: target,<br>    secure: false,<br>    headers: {<br>        Connection: &#39;Keep-Alive&#39;<br>    }<br>}]</pre><p>Open terminal Under ‘ClientApp’ folder, and type ‘ng g c cars — module app — spec=false’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*VSxfmrH_cwcLIVZrLZWICw.png" /><figcaption>Generates cars component</figcaption></figure><p>This command will generate a new angular component called ‘cars’ under app.module.</p><p><em>If you get errors with ‘ng’ command and angular cli is not installed in your machine, you need to install it by typing: ‘</em><strong><em>npm i @angular/cli</em></strong><em>’ in terminal.</em></p><p>Create a new file: ‘cars.model.ts’ under ‘Cars’ folder which will contain our car fields:</p><pre>export interface ICarModel {<br>    id: string;<br>    description: string;<br>}</pre><p>Now let’s create a service under ‘Cars’ new folder, by typing ‘ng g s cars — spec=false’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*40XjnZ0dYbOqExfNifEwVA.png" /><figcaption>Generates cars service under cars folder</figcaption></figure><p>Cars folder under ClientApp should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*xKRHQWjzNmVciwW3br_MnA.png" /><figcaption>folder structure on client</figcaption></figure><p>Ok, now we are going to create the http communication between the client and the server. We have the API in our C# CarsController, and we need to write the client side which will communicate with this layer.</p><p>In ‘CarsService’ constructor, add ‘HttpClient’ and inject ‘BaseUrl’ which defines the server’s url to route the requests to. Then add the following methods:</p><pre>baseUrl!: string;<br>constructor(private http: HttpClient, @Inject(&#39;BASE_URL&#39;) baseUrl: string) {<br>  this.baseUrl = baseUrl;<br>}<br><br>  addCar(car: ICarModel): Observable&lt;any&gt; {<br>    return this.http.post(this.baseUrl + &#39;api/cars&#39;, car);<br>  }<br><br>  getCar(id: string): Observable&lt;ICarModel&gt; {<br>    return this.http.get&lt;ICarModel&gt;(this.baseUrl + `api/cars/${id}`);<br>  }<br><br>  getAllCars(): Observable&lt;ICarModel[]&gt; {<br>    return this.http.get&lt;ICarModel[]&gt;(this.baseUrl + &#39;api/cars&#39;);<br>  }</pre><p>Inject this service to cars component:</p><pre>constructor(private carsService: CarsService) { }</pre><p>and in the component, define an empty list of cars, to request later on from the server:</p><pre>cars: ICarModel[] = [];</pre><p>Let’s create a simple html code in template file, to represent the client’s fields. Type this in ‘cars.component.html’:</p><pre>&lt;p&gt;cars works!&lt;/p&gt;<br><br>&lt;form&gt;<br>    &lt;label&gt;Car id:&lt;/label&gt;&lt;br&gt;<br>    &lt;input type=&quot;text&quot; id=&quot;carId&quot; #carId&gt;&lt;br&gt;<br>    &lt;label&gt;Car Type:&lt;/label&gt;&lt;br&gt;<br>    &lt;input type=&quot;text&quot; id=&quot;carName&quot; #carName&gt;&lt;br&gt;<br>    &lt;button (click)=&quot;onAddCarClick(carId.value, carName.value)&quot;&gt;Add Car&lt;/button&gt;<br>&lt;/form&gt;<br>&lt;br&gt; Cars List:<br>&lt;div *ngFor=&quot;let car of cars&quot;&gt;<br>    id = {{car.id}}, type = {{car.description}}<br>&lt;/div&gt;</pre><p>Change the code in ‘app.component.html’ to call our cars component:</p><pre>&lt;app-cars&gt;&lt;/app-cars&gt;</pre><p>Let’s create the methods to add a car, and once we get the response from the server — we will request get cars from the server in the component. We will add this on ‘cars.component.ts’:</p><pre>onAddCarClick(id: string, description: string): void {<br>  this.carsService.addCar({ id: id, description: description } as ICarModel).subscribe(res =&gt; {<br>    this.carsService.getAllCars().subscribe(res =&gt; {<br>      this.cars = res;<br>    });<br>  });<br>}</pre><p>This piece of code is called when clicking the ‘Add Car’ button in the browser.</p><p>Let’s see what we’ve done so far. Hit F5 on VS2022 and the C# code will be compiled, and ‘npm install’ command will run on our angular code. That will the environment ready to run.</p><p>Wait for application to launch in browser. Your application should now work and look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*znTFjUvMQjW5ZN2xVo85Rw.png" /><figcaption>The application running on browser</figcaption></figure><h3>Part 2: push data from server to client using signalR</h3><p>When we use HTTP between server and client, the client sends requests to server and the server responses to those requests.</p><p>But what if we want the server to notify the client with some new value, with a periodic message, regardless of whether the client has sent a request or not? for those cases we can use signalR which wraps a websocket session between the client and the server. Read more about signlaR here:</p><p><a href="https://learn.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-7.0">Overview of ASP.NET Core SignalR</a></p><p>For example, let’s add a feature to our web application, that displays the status of a car in a parking lot. And for this example let’s say that this status can change rapidly every few seconds.</p><p>We’ll start by creating a new folder called ‘Hubs’ under our main project in VS2022. Under this folder, create a new class called ‘CarsHub’. In this class we will create a task that every 2 seconds sends a new status to client via ‘onCarStatus’ with a specific car’s id. This task will be starting by demand — whenever the client calls ‘StartSendingCarStatus’ with a specific carId:</p><pre>namespace AspAngularTemplate.Hubs<br>{<br>    using AspAngularTemplate.Models;<br>    using Microsoft.AspNetCore.SignalR;<br><br>    public class CarsHub : Hub<br>    {<br>        public void StartSendingCarStatus(string id)<br>        {<br>            ISingleClientProxy client = Clients.Client(Context.ConnectionId);<br>            Task.Run(() =&gt;<br>            {<br>                Random random = new Random();<br>                // send message every 2 seconds to client<br>                while (true)<br>                {<br>                    // randomize car state <br>                    double randNum = random.NextDouble();<br>                    string randState = randNum &gt;= 0.5 ? &quot;Enter&quot; : &quot;Exit&quot;;<br>                    client.SendAsync(&quot;onCarStatus&quot;, new { CarId = id, CarStatus = randState });<br>                    Thread.Sleep(2000);<br>                }<br>            });<br>        }<br>    }<br>}</pre><p>To summarize, the client calls the method ‘StartSendingCarStatus’ and the server calls the method ‘onCarStatus’ which is on the client.</p><p>Another important step to perform on server is to enable signlaR on ‘program.cs’. Add signlaR service:</p><pre>builder.Services.AddSignalR();</pre><p>and add the hub mapping:</p><pre>app.MapHub&lt;CarsHub&gt;(&quot;/carshub&quot;);</pre><p>Without those 2 lines of code, the client will not be able to reach out to the server and create the signlarR connection.</p><p>On client side, first we need to install signlar npm package. Open terminal window on vs code and type:</p><pre>npm install @microsoft/signalr</pre><p>After signlar package installation, we can go to ‘cars.service.ts’ and start the connection with our server side hub.</p><p>Add private member for hub connection:</p><pre>hubConnection!: signalR.HubConnection;</pre><p>Add a method that opens connection:</p><pre>public startSignlaRConnection(): void {<br>  this.hubConnection = new signalR.HubConnectionBuilder()<br>    .withUrl(&#39;https://localhost:7166/carshub&#39;, {<br>      skipNegotiation: true,<br>      transport: signalR.HttpTransportType.WebSockets<br>    })<br>    .build();<br>  this.hubConnection<br>    .start()<br>    .then(() =&gt; console.log(&#39;Connection started&#39;))<br>    .catch(err =&gt; console.log(&#39;Error while starting connection: &#39; + err));<br>}</pre><p>Change the URL in the line ‘.withUrl’ to the HTTPS URL of your server. If you are not sure what the URL is, you can find it under applicationUrl property in ‘launchSettings.json’ file.</p><p>Let’s add another property which is called ‘carStatus’ to ‘ICarModel’ on client:</p><pre>carStatus: string;</pre><p>and add it to the html as well:</p><pre>id = {{car.id}}, type = {{car.description}}, status = {{car.carStatus}}</pre><p>Now we need to connect this status field to the data which is coming from the server via our signalR hub.</p><p>First, in the component constructor, we will call ‘startSignlaRConnection’:</p><pre>constructor(private carsService: CarsService) {<br>  carsService.startSignlaRConnection();<br>}</pre><p>in ‘cars.service.ts’ we will add the code which tells the server to start sending, and its listener:</p><pre>public addCarStatusListener(carId: string): void {<br>  this.hubConnection.send(&quot;StartSendingCarStatus&quot;, carId);<br>  this.hubConnection.on(&#39;onCarStatus&#39;, (data) =&gt; {<br>    this.carStatusSubject.next(data);<br>  });<br>}</pre><p>Notice that we are returning the result to the component by using a subject which is defined in the service as well:</p><pre>carStatusSubject = new Subject&lt;{carId: string, carStatus: string}&gt;();</pre><p>and a public method for the component to use:</p><pre>public getCarStatus(): Observable&lt;any&gt; {<br>  return this.carStatusSubject.asObservable();<br>}</pre><p>Now in the component, we can go back to the method which calls the server to add a new car, and we will add the subscription for this subject:</p><pre>onAddCarClick(id: string, description: string): void {<br>  this.carsService.addCar({ id: id, description: description } as ICarModel).subscribe(res =&gt; {<br>    this.carsService.getAllCars().subscribe(res =&gt; {<br>      this.cars = res;<br>    });<br><br>    this.carsService.addCarStatusListener(id);<br>    this.carsService.getCarStatus().subscribe(innerRes =&gt; {<br>      let car = this.cars.filter(car =&gt; car.id === innerRes.carId);<br>      car[0].carStatus = innerRes.carStatus;<br>    });<br>  });</pre><p>The result from the observable, which is actually the result from the hub listener — is inserted directly to the ‘carStatus’ (which is bind to the html template) in these lines of code:</p><pre>let car = this.cars.filter(car =&gt; car.id === innerRes.carId);<br>car[0].carStatus = innerRes.carStatus;</pre><p>Now your web application keeps updated with the cars status whenever you add a new car to the list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*uhxALlc5lafW3ZEnuofGXw.gif" /></figure><p>That’s it, I hope you liked it, below is the link of the complete project in a github repository:</p><p><a href="https://github.com/hadards/Asp7Angular14Template">GitHub - hadards/Asp7Angular14Template: Asp.net core 7 with angular 14 example of HTTP and signalr</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42a9fcacd0d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Change default ‘ng serve’ proxy in .net7 project with angular launch]]></title>
            <link>https://medium.com/@hadards/change-default-ng-serve-proxy-in-net7-project-with-angular-launch-998b1cdcaea2?source=rss-818db97b9c14------2</link>
            <guid isPermaLink="false">https://medium.com/p/998b1cdcaea2</guid>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[web-server]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Hadar Dashty]]></dc:creator>
            <pubDate>Sat, 10 Dec 2022 17:21:59 GMT</pubDate>
            <atom:updated>2022-12-15T14:12:43.056Z</atom:updated>
            <content:encoded><![CDATA[<h3>Change default ‘ng serve’ proxy launch in .net7 project with angular</h3><p>And save time waiting for the client to load in the browser every time you hit F5</p><p>Few weeks ago I started a new project with asp.net core 7 (.net7) as a server side, which serves angular 13 on client side.</p><p>I noticed that every time I hit F5 in order to debug, kestrel is loading the server on a specific URL (as defined in launchSettings.json — https://localhost:7240):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*7N-v0roZfqRNUMHYQOKBTg.png" /></figure><p>and <strong>another </strong>terminal window is opened, with angular client ‘ng serve — port 44448’ command, in order to make client side work with proxy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SgTaWWpZX4uK_O8bvqf_zg.png" /></figure><p>That launch process can be very long, and I found myself staring at this screen for some long time until the client appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uFsmVZ3gc9S7hw6r9UmsSA.png" /></figure><p>Imagine you are working on .net 7 server side, and debugging an issue in your c# code. There is no reason to build angular client side on every launch, and wait even up to one minute (on my old machine…) in order to debug something you only changed on server side.</p><p>In the past, when I used to work with .netcore 3.1 or earlier versions, that was a very easy problem to solve.</p><p>instead of calling ‘start’ script (which is defined in ‘package.json’) from startup.cs Configure method, like this:</p><pre>if (env.IsDevelopment())<br>{<br>    spa.UseAngularCliServer(npmScript: &quot;start&quot;);<br>}</pre><p>I just replaced the line with this one:</p><pre>if (env.IsDevelopment())<br>{<br>    spa.UseProxyToSpaDevelopmentServer(&quot;http://localhost:4200&quot;);<br>}</pre><p>This caused the proxy server to work with 4200 port.</p><p>Then I launched client code with ‘ng serve’ command from ClientApp folder, opened the browser on localhost:4200 and Voila! My web site is there and it transfers all requests to server’s URL. No need to build client side code over and over again every time I hit F5, and that was very convenient.</p><p>You can read more about it in this thread:</p><p><a href="https://stackoverflow.com/questions/52768852/how-does-spa-useangularcliserver-middleware-serve-a-webpage">https://stackoverflow.com/questions/52768852/how-does-spa-useangularcliserver-middleware-serve-a-webpage</a></p><p>But that’s not the case in .net6 or .net7.</p><p>in .net6 or .net7, Spa parameters were added to *.csproj:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*o2vdTLe7VysIAfbrjvZxFw.png" /></figure><p>SpaProxyServerUrl is automatically used with 44448 port, as defined in this file.</p><p>Whenever I hit F5, SpaProxy launches ‘npm start’ command which is defined in ‘package.json’ like this:</p><pre>&quot;start:windows&quot;: &quot;ng serve --port 44448 --ssl --ssl-cert \&quot;%APPDATA%\\ASP.NET\\https\\%npm_package_name%.pem\&quot; --ssl-key \&quot;%APPDATA%\\ASP.NET\\https\\%npm_package_name%.key\&quot;&quot;</pre><p>So the browser opens up with this URL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ceu2QyMbb2700nhzgzsH0g.png" /></figure><p>and routes the commands to the URL which is defined in the file ‘proxy.conf.js’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rp2xBIjG8kXkmnNmGf1fLw.png" /></figure><p>This flow happens every time I debug the server.</p><h3><strong>How to break server’s debugging dependency with client?</strong></h3><ol><li>Copy the content of the file ‘proxy.conf.js’ to a new file ‘proxy.conf.debug.js’.</li><li>In the new file ‘proxy.conf.debug.js’, change ‘target’ to point to the <strong>https </strong>URL that the asp.netcore server is launched on:</li></ol><pre>const target = &#39;https://localhost:7240&#39;;</pre><p>This URL that the asp.netcore server is launched on, can be found in the file ‘launchSettings.json’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*HadS2laYERM-6nLGEFKMCg.png" /></figure><p>3. Create a ‘debug’ script in ‘package.json’ under ‘scripts’ section:</p><pre>&quot;debug&quot;: &quot;ng serve --proxy-config proxy.conf.debug.js&quot;</pre><p>Your ‘package.json’ file should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0KosGWdIaVMW4eW1xQW4_w.png" /></figure><p>4. Browse to ClientApp folder in cmd or vscode’s terminal screen and type:</p><pre>npm start debug</pre><p>5. Hit F5 to launch server side. Now you don’t need to wait for ‘ng serve’ to finish serving the client. Once you see this screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*OcZeNeNmnqvwVXL3FjRSRA.png" /></figure><p>The server is up and running and you can proceed.</p><p>6. Open the browser on ‘localhost:4200’ and you will see your client on the browser. All requests to the server will be route to ‘localhost:7240’ as you defined in ‘proxy.conf.debug.js’ file.</p><p>Now you can ignore the other cmd screen that opens once you hit F5, which is the proxy that is automatically done by .net SpaProxy. But if you wish, you can completely disable it by removing this line from ‘launchSettings.json’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jYqL0e5-Y08KuLLvG6EnQQ.png" /></figure><p>That’s it, this is how you can change ‘ng serve’ proxy in .net 7 with angular.</p><p>I hope this information will save you precious seconds of waiting while debugging :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=998b1cdcaea2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>