<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: YousufAmre</title>
    <description>The latest articles on DEV Community by YousufAmre (@yousufamre).</description>
    <link>https://dev.to/yousufamre</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F884499%2F430d7659-a999-4d51-9210-7476fa129401.png</url>
      <title>DEV Community: YousufAmre</title>
      <link>https://dev.to/yousufamre</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yousufamre"/>
    <language>en</language>
    <item>
      <title>From Prompt to Production: Practical Lessons from Generative AI in .NET</title>
      <dc:creator>YousufAmre</dc:creator>
      <pubDate>Wed, 03 Jun 2026 18:48:42 +0000</pubDate>
      <link>https://dev.to/yousufamre/from-prompt-to-production-practical-lessons-from-generative-ai-in-net-1a4m</link>
      <guid>https://dev.to/yousufamre/from-prompt-to-production-practical-lessons-from-generative-ai-in-net-1a4m</guid>
      <description>&lt;p&gt;Everyone is excited about Generative AI, but after building AI features into a .NET application using Microsoft's Semantic Kernel and Azure AI, I've learned that the real challenge isn't calling an LLM, it's controlling the context you send to it.&lt;/p&gt;

&lt;p&gt;A few lessons that made a significant difference:&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Don't send everything to the model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The temptation is to dump an entire object graph or database response into the prompt. Resist it.&lt;/p&gt;

&lt;p&gt;With Semantic Kernel, create dedicated context builders that extract only the data relevant to the user's question. Every unnecessary token increases cost, latency, and the chances of the model getting distracted.&lt;/p&gt;

&lt;p&gt;The best prompt is often the shortest prompt that still contains the necessary context.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Token optimization matters more than model selection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Many teams spend days debating GPT versions while sending thousands of unnecessary tokens on every request.&lt;/p&gt;

&lt;p&gt;Before upgrading models:&lt;/p&gt;

&lt;p&gt;✅ Remove redundant fields&lt;br&gt;
✅ Summarize large datasets before injection&lt;br&gt;
✅ Chunk documents intelligently&lt;br&gt;
✅ Cache reusable context&lt;/p&gt;

&lt;p&gt;A 30% reduction in tokens often provides a bigger ROI than switching models.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Temperature is not just a number&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Different use cases require different settings.&lt;/p&gt;

&lt;p&gt;📊 Product facts, analytics, rankings, reports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Temperature: 0 - 0.2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 Brainstorming and ideation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Temperature: 0.7+&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If users complain that AI is "making things up", the first place I check is the temperature setting.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Vague prompts produce vague answers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the user asks:&lt;/p&gt;

&lt;p&gt;"Tell me about this Thing."&lt;/p&gt;

&lt;p&gt;The model doesn't know whether they want:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A summary&lt;/li&gt;
&lt;li&gt;Its history&lt;/li&gt;
&lt;li&gt;The attributes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The quality of the response is directly proportional to the specificity of the request.&lt;/p&gt;

&lt;p&gt;Guide users with suggested prompts rather than relying on free-form questions.&lt;/p&gt;

&lt;p&gt;However, a well-engineered system prompt can significantly reduce this problem. Instead of forcing users to ask perfect questions, the system prompt can instruct the model to:&lt;br&gt;
Infer likely intent from the conversation context&lt;br&gt;
Ask clarifying questions when ambiguity is high&lt;br&gt;
Default to a predefined response structure&lt;br&gt;
Prioritize the most relevant information based on the application domain&lt;br&gt;
The goal isn't to train users to write better prompts—it's to design the AI experience so that even imperfect prompts produce useful results.&lt;br&gt;
A strong system prompt often contributes more to response quality than adding additional context or increasing model size.&lt;br&gt;
This addition introduces an important engineering principle: good AI products compensate for imperfect user inputs rather than expecting users to become prompt engineers.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Feedback loops are critical&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The most valuable AI telemetry isn't token usage.&lt;/p&gt;

&lt;p&gt;It's:&lt;/p&gt;

&lt;p&gt;👍 Helpful&lt;/p&gt;

&lt;p&gt;👎 Not Helpful&lt;/p&gt;

&lt;p&gt;Every thumbs-up and thumbs-down becomes training data for prompt engineering.&lt;/p&gt;

&lt;p&gt;The fastest way to improve an AI assistant is to learn where users disagree with it.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Maintain conversation state carefully&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A chatbot without memory feels broken.&lt;/p&gt;

&lt;p&gt;A chatbot with too much memory becomes expensive and confused.&lt;/p&gt;

&lt;p&gt;Maintain session history, but periodically summarize older conversations and inject the summary instead of the entire chat history.&lt;/p&gt;

&lt;p&gt;Semantic Kernel makes this pattern relatively straightforward.&lt;/p&gt;

&lt;p&gt;🔹 *&lt;em&gt;Turn on Debug Mode&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
One of the most underrated features while developing AI solutions.&lt;/p&gt;

&lt;p&gt;Track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prompt tokens&lt;/li&gt;
&lt;li&gt;Completion tokens&lt;/li&gt;
&lt;li&gt;Total cost&lt;/li&gt;
&lt;li&gt;Latency&lt;/li&gt;
&lt;li&gt;Retrieved context&lt;/li&gt;
&lt;li&gt;Function calls&lt;/li&gt;
&lt;li&gt;Model selection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a response looks wrong, the answer is usually hiding in the prompt or retrieved context.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;RAG is not always required&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Many AI projects immediately jump to vector databases and Retrieval-Augmented Generation.&lt;/p&gt;

&lt;p&gt;Ask yourself first:&lt;/p&gt;

&lt;p&gt;Can the required data already be loaded from an API, database, or domain object?&lt;/p&gt;

&lt;p&gt;If yes, simply inject the relevant data into the prompt.&lt;/p&gt;

&lt;p&gt;RAG becomes valuable when:&lt;/p&gt;

&lt;p&gt;✅ Knowledge is large&lt;br&gt;
✅ Data is unstructured&lt;br&gt;
✅ Documents change frequently&lt;br&gt;
✅ Users need semantic search across thousands of records&lt;/p&gt;

&lt;p&gt;Not every chatbot needs a vector database.&lt;/p&gt;

&lt;p&gt;Sometimes a well-designed query against SQL is all you need.&lt;/p&gt;

&lt;p&gt;My biggest takeaway:&lt;/p&gt;

&lt;p&gt;Building AI features is becoming easier.&lt;/p&gt;

&lt;p&gt;Building AI features that are fast, reliable, cost-effective, and trustworthy is where the real engineering begins.&lt;/p&gt;

&lt;h1&gt;
  
  
  dotnet #SemanticKernel #OpenAI #AzureOpenAI #GenerativeAI #LLM #SoftwareArchitecture #RAG #AIEngineering #CSharp
&lt;/h1&gt;

</description>
      <category>ai</category>
      <category>openai</category>
      <category>dotnet</category>
      <category>llm</category>
    </item>
    <item>
      <title>Redis Is Not Free Performance</title>
      <dc:creator>YousufAmre</dc:creator>
      <pubDate>Wed, 24 Dec 2025 08:20:29 +0000</pubDate>
      <link>https://dev.to/yousufamre/redis-is-not-free-performance-1cie</link>
      <guid>https://dev.to/yousufamre/redis-is-not-free-performance-1cie</guid>
      <description>&lt;p&gt;&lt;strong&gt;Why adding Redis often shifts complexity instead of removing it and what that means for correctness.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You’re building an application.&lt;br&gt;
You care about fast pages.&lt;br&gt;
You want to protect your database.&lt;br&gt;
You don’t want to keep recalculating the same results on every request.&lt;br&gt;
So you introduce Redis.&lt;br&gt;
Responses speed up.&lt;br&gt;
Latency drops.&lt;br&gt;
The database finally gets a break.&lt;br&gt;
You deploy feeling confident.&lt;br&gt;
Performance feels “solved.”&lt;br&gt;
Then the product evolves.&lt;br&gt;
User traffic grows.&lt;br&gt;
Features multiply.&lt;br&gt;
Caching starts to look like the obvious solution everywhere.&lt;br&gt;
And slowly, production feels… off.&lt;br&gt;
Some users see outdated data.&lt;br&gt;
Counts stop lining up.&lt;br&gt;
Memory usage keeps rising for Redis servers.&lt;br&gt;
A single cache miss suddenly overwhelms the database.&lt;br&gt;
Nothing is outright failing.&lt;br&gt;
But the system feels brittle.&lt;br&gt;
What’s really happened is simple.&lt;br&gt;
You didn’t eliminate complexity.&lt;br&gt;
You relocated it.&lt;br&gt;
&lt;em&gt;Redis isn’t “free performance.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It’s: &lt;br&gt;
• Another data layer&lt;br&gt;
• With its own structure&lt;br&gt;
• Its own edge cases&lt;br&gt;
• And its own failure scenarios&lt;/p&gt;

&lt;p&gt;That fundamentally changes your system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before Redis:&lt;/strong&gt; App → Database&lt;br&gt;
One authority.&lt;br&gt;
&lt;u&gt;Clear consistency.&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After Redis:&lt;/strong&gt; App → Redis → Database&lt;/p&gt;

&lt;p&gt;Now Redis is: &lt;br&gt;
• The primary read path&lt;br&gt;
• A buffer in front of the database&lt;br&gt;
• A possible source of stale or incorrect data&lt;br&gt;
• A core part of system correctness&lt;br&gt;
Cache invalidation stops being theoretical.&lt;/p&gt;

&lt;p&gt;You now have to decide: &lt;br&gt;
• What should expire&lt;br&gt;
• What must stay consistent&lt;br&gt;
• What’s allowed to be slightly out of date&lt;/p&gt;

&lt;p&gt;Redis won’t guide those choices.&lt;br&gt;
It will faithfully do exactly what you configure — even if that leads to subtle bugs over time.&lt;/p&gt;

&lt;p&gt;The fundamentals of performance don’t change.&lt;/p&gt;

&lt;p&gt;Key design matters.&lt;br&gt;
TTL decisions matter.&lt;br&gt;
Data shape matters.&lt;br&gt;
Redis helps avoid redundant work.&lt;br&gt;
It reduces unnecessary database pressure.&lt;br&gt;
But it doesn’t remove accountability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You still need to:&lt;/strong&gt; &lt;br&gt;
• Choose carefully what gets cached&lt;br&gt;
• Understand read and write behavior&lt;br&gt;
• Design for cache misses&lt;br&gt;
• Treat Redis as an optimization, not a system of record&lt;/p&gt;

&lt;p&gt;Redis enables fast systems, no doubt. Making them correct, stable,&lt;br&gt;
and maintainable over time, well&lt;br&gt;
that responsibility never leaves you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgb3q51jifsn6x8ptup5g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgb3q51jifsn6x8ptup5g.png" alt=" " width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>redis</category>
      <category>webdev</category>
      <category>performance</category>
      <category>database</category>
    </item>
  </channel>
</rss>
