FREE BOILERPLATE

Structured Output Starter for .NET

Turn messy text into typed C# objects with a local model, and don’t trust the model more than you should. The model reads, your code checks.

Free · zip, 45 KB
Structured Output Starter in .NET: a C# record filled from text by IChatClient, with validated JSON output.

What you get

  • A generic extractor built on GetResponseAsync<T>: JSON schema from your C# type, and one retry when the JSON comes back broken
  • A normalizer that checks the model’s draft in code: values copied from the text must really be in the text, formats are checked by code, and every change is reported with a reason
  • A ticket API as the example: category, priority, order number, customer, product, language and summary from a support email
  • 10 sample emails with traps: a phone number that looks like an order number, German and Turkish emails, and an email that tries to set its own priority
  • Tests that run without Ollama, and a short guide to use the extractor for your own type

Tested with .NET 10 · Ollama 0.40.3 · OllamaSharp 5.5.0 · qwen3:4b-instruct

FREE DOWNLOAD

Get the Structured Output Starter for .NET

You'll get the download link by email, plus a short weekly tip on AI engineering with .NET and a spot on the course waitlist. Unsubscribe anytime.