<?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: KAMAL KISHOR</title>
    <description>The latest articles on DEV Community by KAMAL KISHOR (@koolkamalkishor).</description>
    <link>https://dev.to/koolkamalkishor</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1372052%2Fcc05edd7-e6c0-42f5-b52c-8dd7a6f826e7.webp</url>
      <title>DEV Community: KAMAL KISHOR</title>
      <link>https://dev.to/koolkamalkishor</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/koolkamalkishor"/>
    <language>en</language>
    <item>
      <title>Pydantic for LLM Structured Output</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Thu, 12 Nov 2026 11:42:51 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/pydantic-for-llm-structured-output-4hae</link>
      <guid>https://dev.to/koolkamalkishor/pydantic-for-llm-structured-output-4hae</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; This article explains how to use Pydantic to get strictly structured JSON output from Large Language Models. Readers will learn to define Pydantic models, prompt LLMs for structured data, and validate the results for robust AI applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Integrating large language models (LLMs) into software systems often hits a snag: LLMs are fantastic at generating human-like text, but when your application needs a specific data format, like JSON, they can be unreliable. You might ask for JSON, only to get a slightly malformed string, a missing field, or an unexpected data type, leading to frustrating parsing errors and fragile integrations.&lt;/p&gt;

&lt;p&gt;This is where Pydantic comes in. It's a Python library for data validation and settings management that allows you to define data schemas using standard Python type hints. When you combine Pydantic with LLMs, you can enforce strict output formats, ensuring that the data you receive is always predictable and programmatically usable. Frankly, I think most AI agent projects break in production because of weak validation and error handling, not because of the underlying model. This technique directly addresses that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up Your Environment
&lt;/h2&gt;

&lt;p&gt;First, you'll need Pydantic. If you don't have it, a quick &lt;code&gt;pip&lt;/code&gt; command handles it. Pydantic v2.14.3 is the latest stable release at the time of writing, offering performance improvements and new features over v1.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install pydantic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For interacting with LLMs, you'll typically use an SDK like OpenAI's or a framework like LangChain. While the direct LLM interaction part isn't strictly Pydantic, the principle is the same: you'll instruct the LLM to return JSON that matches your defined schema.&lt;/p&gt;

&lt;h2&gt;
  
  
  Defining Your Output Schema
&lt;/h2&gt;

&lt;p&gt;The core of this technique involves defining a Pydantic model that represents the exact structure and types you expect from the LLM. Think of this as a contract for your data.&lt;/p&gt;

&lt;p&gt;Let's say you're building a system that extracts key details from product reviews. You might want the LLM to return the product name, the sentiment of the review, and any detected features.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pydantic&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Literal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Optional&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ReviewAnalysis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"The name of the product being reviewed."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;sentiment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Literal&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"positive"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"negative"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"neutral"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"The overall sentiment of the review."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;features_mentioned&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default_factory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"A list of product features explicitly mentioned in the review."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;reviewer_rating&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ge&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;le&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"The numerical rating given by the reviewer, if any, on a scale of 1 to 5."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# You can even nest models for more complex structures&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ProductOverview&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;analyses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;ReviewAnalysis&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;ReviewAnalysis&lt;/code&gt; specifies that &lt;code&gt;product_name&lt;/code&gt; must be a string, &lt;code&gt;sentiment&lt;/code&gt; can only be "positive", "negative", or "neutral", &lt;code&gt;features_mentioned&lt;/code&gt; is a list of strings (defaulting to an empty list), and &lt;code&gt;reviewer_rating&lt;/code&gt; is an optional integer between 1 and 5. Pydantic handles type checking, default values, and even value constraints (like &lt;code&gt;ge=1, le=5&lt;/code&gt; for "greater than or equal to 1" and "less than or equal to 5").&lt;/p&gt;

&lt;h2&gt;
  
  
  Guiding the LLM and Parsing Output
&lt;/h2&gt;

&lt;p&gt;Once you have your Pydantic model, the next step is to tell the LLM exactly what you want. Many modern LLM APIs and frameworks (like LangChain) have built-in support for Pydantic or JSON Schema. They can automatically generate a schema from your Pydantic model and pass it to the LLM.&lt;/p&gt;

&lt;p&gt;If your LLM integration doesn't have direct Pydantic support, you can still get a JSON schema from your model using &lt;code&gt;ReviewAnalysis.model_json_schema()&lt;/code&gt; and include it directly in your prompt. This tells the LLM the exact JSON structure it should return.&lt;/p&gt;

&lt;p&gt;Here's an illustrative sketch of how you might prompt an LLM and then parse its response (not using a specific LLM SDK, but showing the conceptual flow):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="c1"&gt;# ... (ReviewAnalysis model definition from above) ...&lt;/span&gt;

&lt;span class="c1"&gt;# This is the prompt you'd send to the LLM&lt;/span&gt;
&lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"""
Analyze the following product review and extract the specified information as a JSON object.
Adhere strictly to the following JSON schema:
{ReviewAnalysis.model_json_schema_json(indent=2)}

Product Review: "This vacuum cleaner is amazing! The suction power is incredible (5/5 stars), and it's surprisingly quiet. The only downside is the battery life, which is a bit short. Definitely a positive experience overall."
"""&lt;/span&gt;

&lt;span class="c1"&gt;# Imagine 'llm_response_text' is the raw string output from your LLM&lt;/span&gt;
&lt;span class="c1"&gt;# Example of a good response:&lt;/span&gt;
&lt;span class="n"&gt;llm_response_text_good&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"""
{
  "product_name": "Vacuum Cleaner",
  "sentiment": "positive",
  "features_mentioned": ["suction power", "quiet operation", "battery life"],
  "reviewer_rating": 5
}
"""&lt;/span&gt;

&lt;span class="c1"&gt;# Example of a potentially bad response (e.g., LLM hallucinated 'color')&lt;/span&gt;
&lt;span class="n"&gt;llm_response_text_bad&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"""
{
  "product_name": "Vacuum Cleaner",
  "sentiment": "positive",
  "features_mentioned": ["suction power"],
  "color": "blue",
  "reviewer_rating": 5
}
"""&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Attempt to parse the LLM's raw text response using Pydantic&lt;/span&gt;
    &lt;span class="n"&gt;parsed_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ReviewAnalysis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model_validate_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;llm_response_text_good&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Successfully parsed data:"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parsed_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model_dump_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;indent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Product name: {parsed_data.product_name}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Sentiment: {parsed_data.sentiment}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# You can now safely access attributes with correct types&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Validation Error: {e}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# This will raise a ValidationError because 'color' is not in the schema&lt;/span&gt;
    &lt;span class="n"&gt;parsed_data_bad&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ReviewAnalysis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model_validate_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;llm_response_text_bad&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"\nCaught expected validation error for bad response: {e}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# cite: 12&lt;/span&gt;
    &lt;span class="c1"&gt;# Specific error handling for structured output issues is crucial,&lt;/span&gt;
    &lt;span class="c1"&gt;# as I discussed in [Validating AI Agent Outputs with Explicit Pass Conditions](https://dev.to/koolkamalkishor/validating-ai-agent-outputs-with-explicit-pass-conditions-5hm)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When using &lt;code&gt;model_validate_json()&lt;/code&gt;, Pydantic attempts to parse the JSON string and then validates it against your &lt;code&gt;ReviewAnalysis&lt;/code&gt; model. If the data types don't match, or if required fields are missing, or if extra unexpected fields are present, Pydantic raises a &lt;code&gt;ValidationError&lt;/code&gt; with clear details. This means you get explicit failure signals instead of silent errors further down your processing pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical Limitation
&lt;/h2&gt;

&lt;p&gt;While Pydantic is powerful for ensuring structured output, it's not a magic bullet. The LLM still needs to be capable enough to follow the instructions and generate &lt;em&gt;some&lt;/em&gt; form of valid JSON. Smaller or less capable models might struggle more consistently, leading to more frequent &lt;code&gt;ValidationError&lt;/code&gt; exceptions. In such cases, you might need to iterate on your prompt engineering or consider using a more robust LLM. It's a trade-off between model capability and the strictness you need for downstream systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Primary Source: &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFauA6Vjianiym_ak00NKvZJY_XmeilgkgpOrh8AmOIuEW9rGLrEhdYDuagZzY8G4KzQkFvGTPu4Z96bwpAtMobj3yPWGqHOkFSo_MsfOaQzllds_PgDmUyplN1NK38fYWjaKWk24_x4HRgaqPMU1OjugVBWpNYAD0oUXKm4fb1" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFauA6Vjianiym_ak00NKvZJY_XmeilgkgpOrh8AmOIuEW9rGLrEhdYDuagZzY8G4KzQkFvGTPu4Z96bwpAtMobj3yPWGqHOkFSo_MsfOaQzllds_PgDmUyplN1NK38fYWjaKWk24_x4HRgaqPMU1OjugVBWpNYAD0oUXKm4fb1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH80NIrvJYhxvVJKD0UR4Ld1oUdQOlsRPtW6jZaTZeS2ENYjmyLunNIRqp--1ZMYnrNZVZ2or53yF0sRfeTx5hUZla1wCwQMnProcxH5SQxdY3RvfbTV3ewXbW-RXcjPBJ8HNs0puyF6K3yZss6AQ==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH80NIrvJYhxvVJKD0UR4Ld1oUdQOlsRPtW6jZaTZeS2ENYjmyLunNIRqp--1ZMYnrNZVZ2or53yF0sRfeTx5hUZla1wCwQMnProcxH5SQxdY3RvfbTV3ewXbW-RXcjPBJ8HNs0puyF6K3yZss6AQ==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHN7ZFk9QNUBD07qkDHAzwiZJjlu8TdV2r6vJGg-AN4kWOU9CzLVLAj2nFgW_scg15LEaa2ZOVffrENMW70lgTm2E28Tj2e2jXpfKh0PwRM-Lx8yVgI7nw1SvipfUv7QVRxtHJyjaTW9NH1aHZA2hUjPQX8Sx2kBM6bN2Y5zuX9MCaEj2ddrfNkhD4kN-Nqlsc6pvtfd8yh8A==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHN7ZFk9QNUBD07qkDHAzwiZJjlu8TdV2r6vJGg-AN4kWOU9CzLVLAj2nFgW_scg15LEaa2ZOVffrENMW70lgTm2E28Tj2e2jXpfKh0PwRM-Lx8yVgI7nw1SvipfUv7QVRxtHJyjaTW9NH1aHZA2hUjPQX8Sx2kBM6bN2Y5zuX9MCaEj2ddrfNkhD4kN-Nqlsc6pvtfd8yh8A==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH6z5z-59HvV-_NCB2ksxsFV0GNVZouGe_TTD0mEGwQTdUjWls4Ccb2UjiUIxnipm0DXuZmsKxukdxlEj9OCQsIO6sj0s2TSyqFpr6OjUxuVeqgpJLsPNc8eNB2uP7C1C3sW5myqlkwtSA4g3-cRF97OgGRBQi24_x3_e9Wnis50oedR0H_JY5d" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH6z5z-59HvV-_NCB2ksxsFV0GNVZouGe_TTD0mEGwQTdUjWls4Ccb2UjiUIxnipm0DXuZmsKxukdxlEj9OCQsIO6sj0s2TSyqFpr6OjUxuVeqgpJLsPNc8eNB2uP7C1C3sW5myqlkwtSA4g3-cRF97OgGRBQi24_x3_e9Wnis50oedR0H_JY5d&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGJH9WkY-ZbH14SELLkP4lgwgNyuHJJJVz2UG5h9lSBq2fuggonxYHEYZOgQtejNERAzYeY_n-QxNzPq8dU00Mej_4eL5TWGQczbl2oLksouqXEeA5U8Ol1Z0x_1MB4XwRFbf3LqZEQCr_Nr-LAYByrOUiV-c8ygp77JZZLAnMMVqnrBeEKGLD8Px-3iq7_C7ue5-Mflug=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGJH9WkY-ZbH14SELLkP4lgwgNyuHJJJVz2UG5h9lSBq2fuggonxYHEYZOgQtejNERAzYeY_n-QxNzPq8dU00Mej_4eL5TWGQczbl2oLksouqXEeA5U8Ol1Z0x_1MB4XwRFbf3LqZEQCr_Nr-LAYByrOUiV-c8ygp77JZZLAnMMVqnrBeEKGLD8Px-3iq7_C7ue5-Mflug=&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGi_h6x_rd22Iy23a-CpFSAXBe8rkpe9XsL8iwL8EJvNcqZWK89rJb4In9EAbtHvcnn4gPkxst90dRYoadOkdl1_nc9kT3T7xitYjJZm6_ZU9kvmnGc0j8ZKIDTNkMENSmBdUQr7bXsX981CfCP4vnUMYKhvZkhAwimrAM=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGi_h6x_rd22Iy23a-CpFSAXBe8rkpe9XsL8iwL8EJvNcqZWK89rJb4In9EAbtHvcnn4gPkxst90dRYoadOkdl1_nc9kT3T7xitYjJZm6_ZU9kvmnGc0j8ZKIDTNkMENSmBdUQr7bXsX981CfCP4vnUMYKhvZkhAwimrAM=&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGaKdTKRwdxYBTRTLdgqUJCjK6qr1-XsfVV50yfgQt2W1QAVkWnlNrVsJdBmK8Xwv-DFxUTbYaaJPhPBhAq7FiFJvMgomhnMeQ7bNmtIKjAYBspEmO4jKesfp2g89gtABSOTbxZM-Ir7Rl7Dtm2mJT4XggDdxI28joqmY_gJA==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGaKdTKRwdxYBTRTLdgqUJCjK6qr1-XsfVV50yfgQt2W1QAVkWnlNrVsJdBmK8Xwv-DFxUTbYaaJPhPBhAq7FiFJvMgomhnMeQ7bNmtIKjAYBspEmO4jKesfp2g89gtABSOTbxZM-Ir7Rl7Dtm2mJT4XggDdxI28joqmY_gJA==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHMTy2cM-ZZWhYARK9ltTaOEV5RpDneMEGM72PY8QXNV5QnnTJSra-w7u3ExwFfuUO6HuWqRZ3hT10uvr3HwBbFZavUtxJ0bpQM58L90Qh9qBIWR7afNvyiiHvQ9hk=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHMTy2cM-ZZWhYARK9ltTaOEV5RpDneMEGM72PY8QXNV5QnnTJSra-w7u3ExwFfuUO6HuWqRZ3hT10uvr3HwBbFZavUtxJ0bpQM58L90Qh9qBIWR7afNvyiiHvQ9hk=&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH3QQlhknSqyKIG9nKH0RQLJL6KrcfBi31AG30ybte5Z7rvxdyjYu8vR_RViQlAQsTkz5z2ckZXMDhbgSBINgzGOAC1G5EA13lTC4MySWmpMe_vsz9Dr3bSoAX3peXq2ir_Sk7KNYw=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH3QQlhknSqyKIG9nKH0RQLJL6KrcfBi31AG30ybte5Z7rvxdyjYu8vR_RViQlAQsTkz5z2ckZXMDhbgSBINgzGOAC1G5EA13lTC4MySWmpMe_vsz9Dr3bSoAX3peXq2ir_Sk7KNYw=&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEa7Jh3sqU2l7kvPZ_03BYL5B396-Ip5bEdh6dN_G7eS8NlaJDS3e8z4LA6ZUmmCXrJtPmMvDK2KcKz1rMVisTJhkPK-opJJE4wmR1hhHlFo0UmTY9M4dGXiJJmGbmBnpczRGi0Ug==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEa7Jh3sqU2l7kvPZ_03BYL5B396-Ip5bEdh6dN_G7eS8NlaJDS3e8z4LA6ZUmmCXrJtPmMvDK2KcKz1rMVisTJhkPK-opJJE4wmR1hhHlFo0UmTY9M4dGXiJJmGbmBnpczRGi0Ug==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFzyY8jFYEtYUfJ2H3QspAVEDkx2jQM9YvPtDn7LRIMsvpynFPFkykaYWQ76jw9qCPVn9FnSgjeGqK1gC69coXwWi5ENBSLAmdRbw4GZ9EL2aEinmgeeT5Sg-IN1rcRR0dx8cm_4RaCXQ==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFzyY8jFYEtYUfJ2H3QspAVEDkx2jQM9YvPtDn7LRIMsvpynFPFkykaYWQ76jw9qCPVn9FnSgjeGqK1gC69coXwWi5ENBSLAmdRbw4GZ9EL2aEinmgeeT5Sg-IN1rcRR0dx8cm_4RaCXQ==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGtc5F_7fM5gTYCeHMgm-OvjWvfumd2aeCpueG7TWc-PoMwzCu8n0MBvxraxnskUNnOo9W96eQIPhRImv-nS6RoyEPr1IC-uXt6Zj7V3Lnyuf9vPknN3MPAMlJOexxfVKvxKibvS55NYcI3dJmdXX373nWyalxtlRCeG4zfs1CSb2VcctvvqpU4Dcos51-BSC4hyhkXFqdkSPE0kTpi_LKkJVr4" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGtc5F_7fM5gTYCeHMgm-OvjWvfumd2aeCpueG7TWc-PoMwzCu8n0MBvxraxnskUNnOo9W96eQIPhRImv-nS6RoyEPr1IC-uXt6Zj7V3Lnyuf9vPknN3MPAMlJOexxfVKvxKibvS55NYcI3dJmdXX373nWyalxtlRCeG4zfs1CSb2VcctvvqpU4Dcos51-BSC4hyhkXFqdkSPE0kTpi_LKkJVr4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHBYSH9bKWAgQySXGe5eRdSeSXFGET1kSVMqw67kzB3DVG8j-ZsbtVwltTYy6N5vrY-Gf9KfEaVrJwS-HgrpwctVE43ShRQ5GzTHd7wbGH6ioomrR60p1nFMch5w6gkajeV37ulE1aXSyDeQRr3BR_Ir2PLDho8OYmm2l0ZLuAkmzTNZdTldZwbwtr_GHcjdXwhhobLsNfS8oNRPBDl0jwCIvfSGcsQJwhEYs5Smgw==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHBYSH9bKWAgQySXGe5eRdSeSXFGET1kSVMqw67kzB3DVG8j-ZsbtVwltTYy6N5vrY-Gf9KfEaVrJwS-HgrpwctVE43ShRQ5GzTHd7wbGH6ioomrR60p1nFMch5w6gkajeV37ulE1aXSyDeQRr3BR_Ir2PLDho8OYmm2l0ZLuAkmzTNZdTldZwbwtr_GHcjdXwhhobLsNfS8oNRPBDl0jwCIvfSGcsQJwhEYs5Smgw==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFGTCWqMEyqWd64ZqI0eJ_4Bvi1Sx2CzBtsgWtC2CL8vdJYRiG40yir_olLHF8kdtBrpZE8Xk7zY8G4Q-y9oPEjiD51a11xjtSQROTz27PJxUkRFU24j2o2c6NZd4TBe0_JJWj-zMfwX3n6y7Hhb78NqZMZ3Dv-Ykf0dH3-Y_-fc8bfJRuMwKaEsfauXljxV-WKECY7BEBQAshF2JrSmXnD9o9J6X32ueWPOLQDQfTZOJiy4NFQHY9zTA==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFGTCWqMEyqWd64ZqI0eJ_4Bvi1Sx2CzBtsgWtC2CL8vdJYRiG40yir_olLHF8kdtBrpZE8Xk7zY8G4Q-y9oPEjiD51a11xjtSQROTz27PJxUkRFU24j2o2c6NZd4TBe0_JJWj-zMfwX3n6y7Hhb78NqZMZ3Dv-Ykf0dH3-Y_-fc8bfJRuMwKaEsfauXljxV-WKECY7BEBQAshF2JrSmXnD9o9J6X32ueWPOLQDQfTZOJiy4NFQHY9zTA==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFa8e5qpJSlEaOZO9vTEogXAUHtOOaa20XN1hnh_pwR1by6h-L1PrA8Ap9FhR9QklEBvmcseYyvFtN9x8c2bWfMVtzMyLRxF43GWUYMFBG63PwqgFGTPojmi4iJCi8Mdtfw3ant3KvAEVPlZN6Sam6Vw4mv" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFa8e5qpJSlEaOZO9vTEogXAUHtOOaa20XN1hnh_pwR1by6h-L1PrA8Ap9FhR9QklEBvmcseYyvFtN9x8c2bWfMVtzMyLRxF43GWUYMFBG63PwqgFGTPojmi4iJCi8Mdtfw3ant3KvAEVPlZN6Sam6Vw4mv&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGSiF0R8lBM9J1A65j0ivA2QLt1eItEd1a4-IxeFlKEBXC4-skb2k-elR7-Rai0QqpE0XbwC2Pxhj8REks37BiAnDyesGgMOOHZJS3zONeTsYcj2qi6urzBs4G2OSxJXQWbgv96MB7XfiZvEgDegjI2h2RGeRLCLg==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGSiF0R8lBM9J1A65j0ivA2QLt1eItEd1a4-IxeFlKEBXC4-skb2k-elR7-Rai0QqpE0XbwC2Pxhj8REks37BiAnDyesGgMOOHZJS3zONeTsYcj2qi6urzBs4G2OSxJXQWbgv96MB7XfiZvEgDegjI2h2RGeRLCLg==&lt;/a&gt;
TITLE: Pydantic for LLM Structured Output
DESCRIPTION: Learn how Pydantic ensures large language models return predictable, validated JSON, preventing common parsing failures in software integrations.
TAGS: python, ai, programming, tutorial
TLDR: This article explains how to use Pydantic to get strictly structured JSON output from Large Language Models. Readers will learn to define Pydantic models, prompt LLMs for structured data, and validate the results for robust AI applications.
---&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Integrating large language models (LLMs) into software systems often hits a snag: LLMs are fantastic at generating human-like text, but when your application needs a specific data format, like JSON, they can be unreliable. You might ask for JSON, only to get a slightly malformed string, a missing field, or an unexpected data type, leading to frustrating parsing errors and fragile integrations.&lt;/p&gt;

&lt;p&gt;This is where Pydantic comes in. It's a Python library for data validation and settings management that allows you to define data schemas using standard Python type hints. When you combine Pydantic with LLMs, you can enforce strict output formats, ensuring that the data you receive is always predictable and programmatically usable. Frankly, I think most AI agent projects break in production because of weak validation and error handling, not because of the underlying model. This technique directly addresses that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up Your Environment
&lt;/h2&gt;

&lt;p&gt;First, you'll need Pydantic. If you don't have it, a quick &lt;code&gt;pip&lt;/code&gt; command handles it. Pydantic v2.14.3 is the latest stable release at the time of writing, offering performance improvements and new features over v1.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install pydantic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For interacting with LLMs, you'll typically use an SDK like OpenAI's or a framework like LangChain. While the direct LLM interaction part isn't strictly Pydantic, the principle is the same: you'll instruct the LLM to return JSON that matches your defined schema.&lt;/p&gt;

&lt;h2&gt;
  
  
  Defining Your Output Schema
&lt;/h2&gt;

&lt;p&gt;The core of this technique involves defining a Pydantic model that represents the exact structure and types you expect from the LLM. Think of this as a contract for your data.&lt;/p&gt;

&lt;p&gt;Let's say you're building a system that extracts key details from product reviews. You might want the LLM to return the product name, the sentiment of the review, and any detected features.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pydantic&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Literal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Optional&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ReviewAnalysis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"The name of the product being reviewed."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;sentiment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Literal&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"positive"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"negative"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"neutral"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"The overall sentiment of the review."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;features_mentioned&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default_factory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"A list of product features explicitly mentioned in the review."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;reviewer_rating&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ge&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;le&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"The numerical rating given by the reviewer, if any, on a scale of 1 to 5."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# You can even nest models for more complex structures&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ProductOverview&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;analyses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;ReviewAnalysis&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;ReviewAnalysis&lt;/code&gt; specifies that &lt;code&gt;product_name&lt;/code&gt; must be a string, &lt;code&gt;sentiment&lt;/code&gt; can only be "positive", "negative", or "neutral", &lt;code&gt;features_mentioned&lt;/code&gt; is a list of strings (defaulting to an empty list), and &lt;code&gt;reviewer_rating&lt;/code&gt; is an optional integer between 1 and 5. Pydantic handles type checking, default values, and even value constraints (like &lt;code&gt;ge=1, le=5&lt;/code&gt; for "greater than or equal to 1" and "less than or equal to 5").&lt;/p&gt;

&lt;h2&gt;
  
  
  Guiding the LLM and Parsing Output
&lt;/h2&gt;

&lt;p&gt;Once you have your Pydantic model, the next step is to tell the LLM exactly what you want. Many modern LLM APIs and frameworks (like LangChain) have built-in support for Pydantic or JSON Schema. They can automatically generate a schema from your Pydantic model and pass it to the LLM.&lt;/p&gt;

&lt;p&gt;If your LLM integration doesn't have direct Pydantic support, you can still get a JSON schema from your model using &lt;code&gt;ReviewAnalysis.model_json_schema()&lt;/code&gt; and include it directly in your prompt. This tells the LLM the exact JSON structure it should return.&lt;/p&gt;

&lt;p&gt;Here's an illustrative sketch of how you might prompt an LLM and then parse its response (not using a specific LLM SDK, but showing the conceptual flow):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="c1"&gt;# ... (ReviewAnalysis model definition from above) ...&lt;/span&gt;

&lt;span class="c1"&gt;# This is the prompt you'd send to the LLM&lt;/span&gt;
&lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"""
Analyze the following product review and extract the specified information as a JSON object.
Adhere strictly to the following JSON schema:
{ReviewAnalysis.model_json_schema_json(indent=2)}

Product Review: "This vacuum cleaner is amazing! The suction power is incredible (5/5 stars), and it's surprisingly quiet. The only downside is the battery life, which is a bit short. Definitely a positive experience overall."
"""&lt;/span&gt;

&lt;span class="c1"&gt;# Imagine 'llm_response_text' is the raw string output from your LLM&lt;/span&gt;
&lt;span class="c1"&gt;# Example of a good response:&lt;/span&gt;
&lt;span class="n"&gt;llm_response_text_good&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"""
{
  "product_name": "Vacuum Cleaner",
  "sentiment": "positive",
  "features_mentioned": ["suction power", "quiet operation", "battery life"],
  "reviewer_rating": 5
}
"""&lt;/span&gt;

&lt;span class="c1"&gt;# Example of a potentially bad response (e.g., LLM hallucinated 'color')&lt;/span&gt;
&lt;span class="n"&gt;llm_response_text_bad&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"""
{
  "product_name": "Vacuum Cleaner",
  "sentiment": "positive",
  "features_mentioned": ["suction power"],
  "color": "blue",
  "reviewer_rating": 5
}
"""&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Attempt to parse the LLM's raw text response using Pydantic&lt;/span&gt;
    &lt;span class="n"&gt;parsed_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ReviewAnalysis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model_validate_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;llm_response_text_good&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Successfully parsed data:"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parsed_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model_dump_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;indent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Product name: {parsed_data.product_name}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Sentiment: {parsed_data.sentiment}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# You can now safely access attributes with correct types&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Validation Error: {e}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# This will raise a ValidationError because 'color' is not in the schema&lt;/span&gt;
    &lt;span class="n"&gt;parsed_data_bad&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ReviewAnalysis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model_validate_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;llm_response_text_bad&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"\nCaught expected validation error for bad response: {e}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Specific error handling for structured output issues is crucial,&lt;/span&gt;
    &lt;span class="c1"&gt;# as I discussed in [Validating AI Agent Outputs with Explicit Pass Conditions](https://dev.to/koolkamalkishor/validating-ai-agent-outputs-with-explicit-pass-conditions-5hm)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When using &lt;code&gt;model_validate_json()&lt;/code&gt;, Pydantic attempts to parse the JSON string and then validates it against your &lt;code&gt;ReviewAnalysis&lt;/code&gt; model. If the data types don't match, or if required fields are missing, or if extra unexpected fields are present, Pydantic raises a &lt;code&gt;ValidationError&lt;/code&gt; with clear details. This means you get explicit failure signals instead of silent errors further down your processing pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical Limitation
&lt;/h2&gt;

&lt;p&gt;While Pydantic is powerful for ensuring structured output, it's not a magic bullet. The LLM still needs to be capable enough to follow the instructions and generate &lt;em&gt;some&lt;/em&gt; form of valid JSON. Smaller or less capable models might struggle more consistently, leading to more frequent &lt;code&gt;ValidationError&lt;/code&gt; exceptions. In such cases, you might need to iterate on your prompt engineering or consider using a more robust LLM. It's a trade-off between model capability and the strictness you need for downstream systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Primary Source: &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFauA6Vjianiym_ak00NKvZJY_XmeilgkgpOrh8AmOIuEW9rGLrEhdYDuagZzY8G4KzQkFvGTPu4Z96bwpAtMobj3yPWGqHOkFSo_MsfOaQzllds_PgDmUyplN1NK38fYWjaKWk24_x4HRgaqPMU1OjugVBWpNYAD0oUXKm4fb1" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFauA6Vjianiym_ak00NKvZJY_XmeilgkgpOrh8AmOIuEW9rGLrEhdYDuagZzY8G4KzQkFvGTPu4Z96bwpAtMobj3yPWGqHOkFSo_MsfOaQzllds_PgDmUyplN1NK38fYWjaKWk24_x4HRgaqPMU1OjugVBWpNYAD0oUXKm4fb1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH80NIrvJYhxvVJKD0UR4Ld1oUdQOlsRPtW6jZaTZeS2ENYjmyLunNIRqp--1ZMYnrNZVZ2or53yF0sRfeTx5hUZla1wCwQMnProcxH5SQxdY3RvfbTV3ewXbW-RXcjPBJ8HNs0puyF6K3yZss6AQ==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH80NIrvJYhxvVJKD0UR4Ld1oUdQOlsRPtW6jZaTZeS2ENYjmyLunNIRqp--1ZMYnrNZVZ2or53yF0sRfeTx5hUZla1wCwQMnProcxH5SQxdY3RvfbTV3ewXbW-RXcjPBJ8HNs0puyF6K3yZss6AQ==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHN7ZFk9QNUBD07qkDHAzwiZJjlu8TdV2r6vJGg-AN4kWOU9CzLVLAj2nFgW_scg15LEaa2ZOVffrENMW70lgTm2E28Tj2e2jXpfKh0PwRM-Lx8yVgI7nw1SvipfUv7QVRxtHJyjaTW9NH1aHZA2hUjPQX8Sx2kBM6bN2Y5zuX9MCaEj2ddrfNkhD4kN-Nqlsc6pvtfd8yh8A==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHN7ZFk9QNUBD07qkDHAzwiZJjlu8TdV2r6vJGg-AN4kWOU9CzLVLAj2nFgW_scg15LEaa2ZOVffrENMW70lgTm2E28Tj2e2jXpfKh0PwRM-Lx8yVgI7nw1SvipfUv7QVRxtHJyjaTW9NH1aHZA2hUjPQX8Sx2kBM6bN2Y5zuX9MCaEj2ddrfNkhD4kN-Nqlsc6pvtfd8yh8A==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH6z5z-59HvV-_NCB2ksxsFV0GNVZouGe_TTD0mEGwQTdUjWls4Ccb2UjiUIxnipm0DXuZmsKxukdxlEj9OCQsIO6sj0s2TSyqFpr6OjUxuVeqgpJLsPNc8eNB2uP7C1C3sW5myqlkwtSA4g3-cRF97OgGRBQi24_x3_e9Wnis50oedR0H_JY5d" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH6z5z-59HvV-_NCB2ksxsFV0GNVZouGe_TTD0mEGwQTdUjWls4Ccb2UjiUIxnipm0DXuZmsKxukdxlEj9OCQsIO6sj0s2TSyqFpr6OjUxuVeqgpJLsPNc8eNB2uP7C1C3sW5myqlkwtSA4g3-cRF97OgGRBQi24_x3_e9Wnis50oedR0H_JY5d&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGJH9WkY-ZbH14SELLkP4lgwgNyuHJJJVz2UG5h9lSBq2fuggonxYHEYZOgQtejNERAzYeY_n-QxNzPq8dU00Mej_4eL5TWGQczbl2oLksouqXEeA5U8Ol1Z0x_1MB4XwRFbf3LqZEQCr_Nr-LAYByrOUiV-c8ygp77JZZLAnMMVqnrBeEKGLD8Px-3iq7_C7ue5-Mflug=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGJH9WkY-ZbH14SELLkP4lgwgNyuHJJJVz2UG5h9lSBq2fuggonxYHEYZOgQtejNERAzYeY_n-QxNzPq8dU00Mej_4eL5TWGQczbl2oLksouqXEeA5U8Ol1Z0x_1MB4XwRFbf3LqZEQCr_Nr-LAYByrOUiV-c8ygp77JZZLAnMMVqnrBeEKGLD8Px-3iq7_C7ue5-Mflug=&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGi_h6x_rd22Iy23a-CpFSAXBe8rkpe9XsL8EJvNcqZWK89rJb4In9EAbtHvcnn4gPkxst90dRYoadOkdl1_nc9kT3T7xitYjJZm6_ZU9kvmnGc0j8ZKIDTNkMENSmBdUQr7bXsX981CfCP4vnUMYKhvZkhAwimrAM=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGi_h6x_rd22Iy23a-CpFSAXBe8rkpe9XsL8EJvNcqZWK89rJb4In9EAbtHvcnn4gPkxst90dRYoadOkdl1_nc9kT3T7xitYjJZm6_ZU9kvmnGc0j8ZKIDTNkMENSmBdUQr7bXsX981CfCP4vnUMYKhvZkhAwimrAM=&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGaKdTKRwdxYBTRTLdgqUJCjK6qr1-XsfVV50yfgQt2W1QAVkWnlNrVsJdBmK8Xwv-DFxUTbYaaJPhPBhAq7FiFJvMgomhnMeQ7bNmtIKjAYBspEmO4jKesfp2g89gtABSOTbxZM-Ir7Rl7Dtm2mJT4XggDdxI28joqmY_gJA==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGaKdTKRwdxYBTRTLdgqUJCjK6qr1-XsfVV50yfgQt2W1QAVkWnlNrVsJdBmK8Xwv-DFxUTbYaaJPhPBhAq7FiFJvMgomhnMeQ7bNmtIKjAYBspEmO4jKesfp2g89gtABSOTbxZM-Ir7Rl7Dtm2mJT4XggDdxI28joqmY_gJA==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHMTy2cM-ZZWhYARK9ltTaOEV5RpDneMEGM72PY8QXNV5QnnTJSra-w7u3ExwFfuUO6HuWqRZ3hT10uvr3HwBbFZavUtxJ0bpQM58L90Qh9qBIWR7afNvyiiHvQ9hk=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHMTy2cM-ZZWhYARK9ltTaOEV5RpDneMEGM72PY8QXNV5QnnTJSra-w7u3ExwFfuUO6HuWqRZ3hT10uvr3HwBbFZavUtxJ0bpQM58L90Qh9qBIWR7afNvyiiHvQ9hk=&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH3QQlhknSqyKIG9nKH0RQLJL6KrcfBi31AG30ybte5Z7rvxdyjYu8vR_RViQlAQsTkz5z2ckZXMDhbgSBINgzGOAC1G5EA13lTC4MySWmpMe_vsz9Dr3bSoAX3peXq2ir_Sk7KNYw=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH3QQlhknSqyKIG9nKH0RQLJL6KrcfBi31AG30ybte5Z7rvxdyjYu8vR_RViQlAQsTkz5z2ckZXMDhbgSBINgzGOAC1G5EA13lTC4MySWmpMe_vsz9Dr3bSoAX3peXq2ir_Sk7KNYw=&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEa7Jh3sqU2l7kvPZ_03BYL5B396-Ip5bEdh6dN_G7eS8NlaJDS3e8z4LA6ZUmmCXrJtPmMvDK2KcKz1rMVisTJhkPK-opJJE4wmR1hhHlFo0UmTY9M4dGXiJJmGbmBnpczRGi0Ug==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEa7Jh3sqU2l7kvPZ_03BYL5B396-Ip5bEdh6dN_G7eS8NlaJDS3e8z4LA6ZUmmCXrJtPmMvDK2KcKz1rMVisTJhkPK-opJJE4wmR1hhHlFo0UmTY9M4dGXiJJmGbmBnpczRGi0Ug==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFzyY8jFYEtYUfJ2H3QspAVEDkx2jQM9YvPtDn7LRIMsvpynFPFkykaYWQ76jw9qCPVn9FnSgjeGqK1gC69coXwWi5ENBSLAmdRbw4GZ9EL2aEinmgeeT5Sg-IN1rcRR0dx8cm_4RaCXQ==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFzyY8jFYEtYUfJ2H3QspAVEDkx2jQM9YvPtDn7LRIMsvpynFPFkykaYWQ76jw9qCPVn9FnSgjeGqK1gC69coXwWi5ENBSLAmdRbw4GZ9EL2aEinmgeeT5Sg-IN1rcRR0dx8cm_4RaCXQ==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGtc5F_7fM5gTYCeHMgm-OvjWvfumd2aeCpueG7TWc-PoMwzCu8n0MBvxraxnskUNnOo9W96eQIPhRImv-nS6RoyEPr1IC-uXt6Zj7V3Lnyuf9vPknN3MPAMlJOexxfVKvxKibvS55NYcI3dJmdXX373nWyalxtlRCeG4zfs1CSb2VcctvvqpU4Dcos51-BSC4hyhkXFqdkSPE0kTpi_LKkJVr4" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGtc5F_7fM5gTYCeHMgm-OvjWvfumd2aeCpueG7TWc-PoMwzCu8n0MBvxraxnskUNnOo9W96eQIPhRImv-nS6RoyEPr1IC-uXt6Zj7V3Lnyuf9vPknN3MPAMlJOexxfVKvxKibvS55NYcI3dJmdXX373nWyalxtlRCeG4zfs1CSb2VcctvvqpU4Dcos51-BSC4hyhkXFqdkSPE0kTpi_LKkJVr4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHBYSH9bKWAgQySXGe5eRdSeSXFGET1kSVMqw67kzB3DVG8j-ZsbtVwltTYy6N5vrY-Gf9KfEaVrJwS-HgrpwctVE43ShRQ5GzTHd7wbGH6ioomrR60p1nFMch5w6gkajeV37ulE1aXSyDeQRr3BR_Ir2PLDho8OYmm2l0ZLuAkmzTNZdTldZwbwtr_GHcjdXwhhobLsNfS8oNRPBDl0jwCIvfSGcsQJwhEYs5Smgw==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHBYSH9bKWAgQySXGe5eRdSeSXFGET1kSVMqw67kzB3DVG8j-ZsbtVwltTYy6N5vrY-Gf9KfEaVrJwS-HgrpwctVE43ShRQ5GzTHd7wbGH6ioomrR60p1nFMch5w6gkajeV37ulE1aXSyDeQRr3BR_Ir2PLDho8OYmm2l0ZLuAkmzTNZdTldZwbwtr_GHcjdXwhhobLsNfS8oNRPBDl0jwCIvfSGcsQJwhEYs5Smgw==&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFGTCWqMEyqWd64ZqI0eJ_4Bvi1Sx2CzBtsgWtC2CL8vdJYRiG40yir_olLHF8kdtBrpZE8Xk7zY8G4Q-y9oPEjiD51a11xjtSQROTz27PJxUkRFU24j2o2c6NZd4TBe0_JJWj-zMfwX3n6y7Hhb78NqZMZ3Dv-Ykf0dH3-" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFGTCWqMEyqWd64ZqI0eJ_4Bvi1Sx2CzBtsgWtC2CL8vdJYRiG40yir_olLHF8kdtBrpZE8Xk7zY8G4Q-y9oPEjiD51a11xjtSQROTz27PJxUkRFU24j2o2c6NZd4TBe0_JJWj-zMfwX3n6y7Hhb78NqZMZ3Dv-Ykf0dH3-&lt;/a&gt;
Y_-fc8bfJRuMwKaEsfauXljxV-WKECY7BEBQAshF2JrSmXnD9o9J6X32ueWPOLQDQfTZOJiy4NFQHY9zTA==&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFa8e5qpJSlEaOZO9vTEogXAUHtOOaa20XN1hnh_pwR1by6h-L1PrA8Ap9FhR9QklEBvmcseYyvFtN9x8c2bWfMVtzMyLRxF43GWUYMFBG63PwqgFGTPojmi4iJCi8Mdtfw3ant3KvAEVPlZN6Sam6Vw4mv" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFa8e5qpJSlEaOZO9vTEogXAUHtOOaa20XN1hnh_pwR1by6h-L1PrA8Ap9FhR9QklEBvmcseYyvFtN9x8c2bWfMVtzMyLRxF43GWUYMFBG63PwqgFGTPojmi4iJCi8Mdtfw3ant3KvAEVPlZN6Sam6Vw4mv&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGSiF0R8lBM9J1A65j0ivA2QLt1eItEd1a4-IxeFlKEBXC4-skb2k-elR7-Rai0QqpE0XbwC2Pxhj8REks37BiAnDyesGgMOOHZJS3zONeTsYcj2qi6urzBs4G2OSxJXQWbgv96MB7XfiZvEgDegjI2h2RGeRLCLg==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGSiF0R8lBM9J1A65j0ivA2QLt1eItEd1a4-IxeFlKEBXC4-skb2k-elR7-Rai0QqpE0XbwC2Pxhj8REks37BiAnDyesGgMOOHZJS3zONeTsYcj2qi6urzBs4G2OSxJXQWbgv96MB7XfiZvEgDegjI2h2RGeRLCLg==&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Kamal Kishor&lt;/em&gt;* (&lt;a href="https://dev.to/koolkamalkishor"&gt;@koolkamalkishor&lt;/a&gt;) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="https://github.com/koolkamalkishor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://kamalkishor.vercel.app" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;*&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Published: 12 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>CocoIndex for Fresh RAG Data: A Step-by-Step Guide</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Wed, 11 Nov 2026 11:22:41 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/cocoindex-for-fresh-rag-data-a-step-by-step-guide-3cd8</link>
      <guid>https://dev.to/koolkamalkishor/cocoindex-for-fresh-rag-data-a-step-by-step-guide-3cd8</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; This article explains CocoIndex, a tool that automates incremental data updates for AI pipelines, saving computation by only reprocessing changed inputs. You will learn how to set it up and use its declarative Python API to keep your RAG and AI agent data current.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you're building RAG systems or AI agents, you know the pain of stale data. Your agent's performance hinges on fresh information, but fully reprocessing entire datasets or embeddings every time a small change occurs is slow, resource-intensive, and frankly, unnecessary. This is where tools that handle incremental updates become critical.&lt;/p&gt;

&lt;p&gt;CocoIndex tackles this directly. It provides a declarative Python API, powered by a Rust engine, to automate these incremental updates. This means it tracks your function inputs and outputs, re-running only the parts of your pipeline that are affected by actual changes. It's particularly useful for keeping embeddings up-to-date for RAG and agent workflows, even supporting local embedding models like those from Ollama or &lt;code&gt;sentence-transformers&lt;/code&gt; without needing powerful GPUs. I prefer free, local AI tools over paid subscriptions when the quality is good enough, so seeing this kind of local support is a big plus for me, especially since I've written about running local LLMs with Ollama before.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting Up CocoIndex
&lt;/h3&gt;

&lt;p&gt;Getting started with CocoIndex is straightforward. You'll need Python installed. A dedicated virtual environment is always a good idea to manage your dependencies.&lt;/p&gt;

&lt;p&gt;First, create and activate a virtual environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python -m venv venv
&lt;span class="nb"&gt;source&lt;/span&gt; venv/bin/activate &lt;span class="c"&gt;# On Windows use `venv\Scripts\activate`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, install CocoIndex using pip. The official documentation provides the exact command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install cocoindex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command pulls in the CocoIndex library, ready for use in your Python projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using CocoIndex for Incremental Updates
&lt;/h3&gt;

&lt;p&gt;Let's look at a quick example from the official documentation to see CocoIndex in action. Imagine a function that processes some input data. We'll use a simple addition, but in a real RAG pipeline, this could be an embedding generation function or a data transformation step.&lt;/p&gt;

&lt;p&gt;Create a Python file, say &lt;code&gt;incremental_example.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;coco&lt;/span&gt;

&lt;span class="nd"&gt;@coco&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Adding {a} and {b} (this should only run on input change)"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="c1"&gt;# First run: Should print the message&lt;/span&gt;
&lt;span class="n"&gt;result1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Result 1: {result1}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Second run with same inputs: Should use cached result, no print&lt;/span&gt;
&lt;span class="n"&gt;result2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Result 2: {result2}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Third run with changed inputs: Should print the message again&lt;/span&gt;
&lt;span class="n"&gt;result3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Result 3: {result3}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# To clear the cache for a fresh start or testing&lt;/span&gt;
&lt;span class="n"&gt;coco&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clear_cache&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Cache cleared."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Fourth run after cache clear: Should print the message again&lt;/span&gt;
&lt;span class="n"&gt;result4&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Result 4: {result4}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, run this script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python incremental_example.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll observe that the print statement inside &lt;code&gt;add_numbers&lt;/code&gt; only executes when the inputs change or the cache is explicitly cleared. The second call to &lt;code&gt;add_numbers(5, 3)&lt;/code&gt; reuses the previously computed result without re-running the function, demonstrating the core incremental update mechanism.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Considerations
&lt;/h3&gt;

&lt;p&gt;While CocoIndex simplifies incremental processing, there are a few things to keep in mind. The tool shines when your data pipelines involve expensive computations (like generating embeddings) where re-running everything is a significant time or cost burden. For very small datasets that change constantly and completely, or for functions that are inherently fast to recompute, the overhead of tracking changes might not always be worth the benefit. You also need to ensure that your functions are deterministic; given the same inputs, they should always produce the same output for CocoIndex to function correctly.&lt;/p&gt;

&lt;p&gt;If you encounter unexpected behavior, like a function always re-running even with seemingly identical inputs, consider using &lt;code&gt;coco.clear_cache()&lt;/code&gt; to reset the state and verify your inputs are truly identical. This is often helpful during development or debugging.&lt;/p&gt;

&lt;p&gt;CocoIndex automates a common problem in data-intensive AI applications, allowing developers to focus on building features rather than managing complex caching logic. For more on building RAG applications, you might find my article on &lt;a href="https://dev.to/koolkamalkishor/building-a-retrieval-augmented-generation-rag-application-using-deep-seek-r1-4mkk"&gt;Building a RAG (Retrieval-Augmented Generation) Application Using Deep Seek R1 from Scratch&lt;/a&gt; useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  CocoIndex Documentation: Quickstart. &lt;a href="https://cocoindex.io/docs/getting_started/quickstart" rel="noopener noreferrer"&gt;https://cocoindex.io/docs/getting_started/quickstart&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Kamal Kishor&lt;/em&gt;* (&lt;a href="https://dev.to/koolkamalkishor"&gt;@koolkamalkishor&lt;/a&gt;) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="https://github.com/koolkamalkishor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://kamalkishor.vercel.app" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;*&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Published: 11 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>automation</category>
      <category>python</category>
      <category>rag</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>OpenJarvis: Local-First AI Agents for Developers</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Tue, 10 Nov 2026 11:34:13 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/openjarvis-local-first-ai-agents-for-developers-1b8e</link>
      <guid>https://dev.to/koolkamalkishor/openjarvis-local-first-ai-agents-for-developers-1b8e</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; OpenJarvis is an open-source framework designed to build AI agents that run primarily on your local device rather than relying heavily on cloud APIs. It focuses on privacy, cost efficiency, and low latency by enabling on-device inference and providing tools to measure energy and computational perfor&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The current state of AI agents often means your "personal" AI relies heavily on external cloud APIs. This setup frequently leads to privacy concerns because your data leaves your device, drives up operational costs, and introduces latency as requests travel back and forth. OpenJarvis tackles these issues head-on by making local-first AI a practical reality for developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  What OpenJarvis Is
&lt;/h2&gt;

&lt;p&gt;OpenJarvis is an open-source framework for building personal AI agents designed to run directly on your hardware, with cloud APIs becoming an optional fallback. Developed by researchers at Stanford University and Lambda Labs, it's a foundational stack that prioritizes on-device inference, memory, and learning. It defines five core primitives: &lt;strong&gt;Intelligence&lt;/strong&gt; (for model management), &lt;strong&gt;Engine&lt;/strong&gt; (for inference runtime), &lt;strong&gt;Agents&lt;/strong&gt; (for multi-step reasoning and tool use), &lt;strong&gt;Tools &amp;amp; Memory&lt;/strong&gt; (for data integration and persistent storage), and &lt;strong&gt;Learning&lt;/strong&gt; (for system optimization). This modular design helps developers avoid complex, hard-to-reproduce codebases often seen in local AI projects.&lt;/p&gt;

&lt;p&gt;The project emerges from the "Intelligence Per Watt" research initiative, which found that local language models can already handle a significant portion (88.7%) of single-turn chat and reasoning queries at interactive latencies, with intelligence efficiency improving rapidly. OpenJarvis aims to be both a research platform and a production-ready foundation for local AI, much like PyTorch for deep learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;OpenJarvis operates by making local inference the default. It supports a variety of local inference engines like Ollama, vLLM, SGLang, and llama.cpp, and can also integrate with cloud APIs if necessary. The framework uses a "spec," which is a declarative configuration object that composes its five primitives. This spec defines everything from the choice of model and inference runtime to agent logic and tool-use policies.&lt;/p&gt;

&lt;p&gt;A key innovation is its focus on efficiency-aware evaluation. OpenJarvis treats energy consumption, FLOPs, latency, and dollar cost as first-class constraints alongside traditional accuracy metrics. It includes a hardware-agnostic telemetry system that profiles energy usage across different GPUs (NVIDIA, AMD, Apple Silicon) and provides a &lt;code&gt;jarvis bench&lt;/code&gt; command for standardized benchmarking of latency, throughput, and energy per query. This means you can tangibly see what each query costs in terms of energy and compare it to cloud alternatives, with reports showing up to 800x lower marginal API cost and 4x lower end-to-end latency for local configurations compared to cloud baselines like Claude Opus 4.6.&lt;/p&gt;

&lt;p&gt;For instance, installing OpenJarvis typically involves a single command that sets up dependencies, Ollama (if not present), and a starter model, then launches a local UI. You can then interact with it via a CLI or a browser-based graphical interface. For a local coding agent, you might use a command like &lt;code&gt;jarvis init --preset code-assistant&lt;/code&gt;, configuring it to write and run Python code on your device.&lt;/p&gt;

&lt;p&gt;I've personally found that the ability to run powerful LLMs locally with tools like Ollama is a game-changer for developer productivity, as I highlighted in my article on &lt;a href="https://dev.to/koolkamalkishor/running-llama-32-on-android-a-step-by-step-guide-using-ollama-54ig"&gt;running Llama 3.2 on Android: A Step-by-Step Guide Using Ollama&lt;/a&gt;. The promise of OpenJarvis, with its structured approach to on-device AI and built-in efficiency metrics, aligns perfectly with my preference for free, local AI tools over paid cloud subscriptions, especially after replacing a paid coding assistant with a local alternative, which I documented in &lt;a href="https://dev.to/koolkamalkishor/i-replaced-cursor-with-a-free-local-ai-coding-assistant-and-saved-240year-4c3j"&gt;I Replaced Cursor with a Free Local AI Coding Assistant (And Saved $240/Year)&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who Should Care
&lt;/h2&gt;

&lt;p&gt;Developers building AI agents and applications where &lt;strong&gt;privacy is paramount&lt;/strong&gt; should pay close attention to OpenJarvis. By keeping inference and data on-device, it offers a verifiable privacy-by-design approach, eliminating concerns about personal data routing through third-party servers. If you're building applications that handle sensitive user information, this is a significant advantage.&lt;/p&gt;

&lt;p&gt;Secondly, anyone looking to &lt;strong&gt;reduce operational costs&lt;/strong&gt; for AI workloads will find OpenJarvis compelling. The framework's ability to run models locally drastically cuts down on marginal API costs, potentially saving hundreds of dollars a month depending on usage. This is particularly relevant for projects with high query volumes.&lt;/p&gt;

&lt;p&gt;Thirdly, developers aiming for &lt;strong&gt;low-latency AI interactions&lt;/strong&gt; will benefit. Local execution removes network overhead, leading to significantly faster response times, which is crucial for interactive applications and real-time agentic workflows.&lt;/p&gt;

&lt;p&gt;Finally, OpenJarvis is for those who appreciate a &lt;strong&gt;modular, inspectable, and production-ready foundation&lt;/strong&gt; for personal AI. Its five-primitive architecture and emphasis on benchmarked performance (including energy efficiency) provide a robust platform for building reliable on-device agents. This framework is ideal for creating agents that handle tasks like morning briefs, code review, email triage, or deep research, all running 24/7 on local hardware.&lt;/p&gt;

&lt;p&gt;One honest limitation to consider is the initial hardware requirement. While OpenJarvis strives for efficiency, running larger models locally still demands a capable device with sufficient RAM and GPU VRAM. Tiny local models are suitable for testing, but serious agentic workflows often require more robust local hardware, such as a Linux box with vLLM for real use cases. If your target users universally have very limited compute resources and simpler models aren't sufficient, a purely local-first approach might face adoption hurdles without some cloud fallback or client-side model optimization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/open-jarvis/OpenJarvis" rel="noopener noreferrer"&gt;https://github.com/open-jarvis/OpenJarvis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/koolkamalkishor/running-llama-32-on-android-a-step-by-step-guide-using-ollama-54ig"&gt;https://dev.to/koolkamalkishor/running-llama-32-on-android-a-step-by-step-guide-using-ollama-54ig&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/koolkamalkishor/i-replaced-cursor-with-a-free-local-ai-coding-assistant-and-saved-240year-4c3j"&gt;https://dev.to/koolkamalkishor/i-replaced-cursor-with-a-free-local-ai-coding-assistant-and-saved-240year-4c3j&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Kamal Kishor&lt;/em&gt;* (&lt;a href="https://dev.to/koolkamalkishor"&gt;@koolkamalkishor&lt;/a&gt;) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="https://github.com/koolkamalkishor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://kamalkishor.vercel.app" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;*&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Published: 10 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>opensource</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Locally Uncensored AI Desktop App: Run DeepSeek v4.1 Flash Locally</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Mon, 09 Nov 2026 11:59:29 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/locally-uncensored-ai-desktop-app-run-deepseek-v41-flash-locally-5cp0</link>
      <guid>https://dev.to/koolkamalkishor/locally-uncensored-ai-desktop-app-run-deepseek-v41-flash-locally-5cp0</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; This guide walks you through setting up the Locally Uncensored AI Desktop App, which brings the DeepSeek v4.1 Flash model to your desktop. You'll learn how to get a multi-modal AI agent running locally for free, without complex setups or cloud dependencies.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Dealing with cloud AI services often means worrying about data privacy, rate limits, or ongoing subscription costs. For developers, this can be a real friction point when you just need a capable AI agent for quick coding tasks, content generation, or local data processing without sending everything off your machine.&lt;/p&gt;

&lt;p&gt;That's where the Locally Uncensored AI Desktop App comes in. It's a free, open-source application that brings the DeepSeek v4.1 Flash model directly to your Windows or Linux desktop. This isn't another CLI tool or a complex Docker setup; it's a straightforward desktop application designed for ease of use. It handles chat, image and video generation, and coding assistance entirely on your local hardware. As someone who prefers free, local AI tools when the quality is good enough, I've found that cutting down on cloud dependencies makes a lot of sense, especially for sensitive data or iterative development. I even wrote about how I replaced a paid cloud service with a free local coding assistant.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting the Application Running
&lt;/h3&gt;

&lt;p&gt;First, you'll need the application itself. Head over to the official download page to get the installer for your operating system.&lt;/p&gt;

&lt;p&gt;The app is available as a desktop installer for Windows (NSIS .exe or .msi) and as AppImage, .deb, and .rpm packages for Linux. You can find these on the project's GitHub Releases page. The core idea behind Locally Uncensored is that local AI should install like a normal program, without requiring command lines, Docker, or configuration files.&lt;/p&gt;

&lt;p&gt;To get started:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Download the installer&lt;/strong&gt;: Visit the official download page at &lt;code&gt;https://locallyuncensored.app/download&lt;/code&gt; and select the appropriate package for your operating system.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Run the installer&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Windows&lt;/strong&gt;: Double-click the downloaded &lt;code&gt;.exe&lt;/code&gt; or &lt;code&gt;.msi&lt;/code&gt; file and follow the on-screen prompts like any other software installation.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Linux&lt;/strong&gt;: For an AppImage, you might need to make it executable (&lt;code&gt;chmod +x YourApp.AppImage&lt;/code&gt;) and then run it. For .deb or .rpm packages, use your distribution's package manager (e.g., &lt;code&gt;sudo dpkg -i your-package.deb&lt;/code&gt; for Debian/Ubuntu or &lt;code&gt;sudo rpm -i your-package.rpm&lt;/code&gt; for Fedora/RHEL).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Initial Setup Wizard&lt;/strong&gt;: On the first launch, a setup wizard will appear. This wizard automatically detects if an AI engine (like Ollama or LM Studio) is already running on your machine. If not, it can install one for you with a single click. It also handles the setup for ComfyUI, which the app uses for image and video generation.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Pick a model&lt;/strong&gt;: Open the model manager within the app. It will show you which models are compatible with your hardware and allow you to download them in one click. If you already use an engine like Ollama or LM Studio, it can link to models already stored by those tools without duplicating them. The DeepSeek v4.1 Flash model will be available here.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Using the App for AI Tasks
&lt;/h3&gt;

&lt;p&gt;Once the app and a model like DeepSeek v4.1 Flash are installed, you'll find different tabs in the main window: Chat, Create, Code, and Agent. The models you've picked carry across these different functionalities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick Example: Coding Assistance&lt;/strong&gt;&lt;br&gt;
To use it for coding, navigate to the "Code" tab. You can paste code snippets, describe a problem, or ask for help with refactoring. For instance, you could paste a React component and ask: "Refactor this React component to use React hooks for state management and reduce boilerplate." The DeepSeek v4.1 Flash model will process your request locally and provide a revised code snippet. The app even offers a file explorer with preview and a workspace per project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Issues and Limitations
&lt;/h3&gt;

&lt;p&gt;While the Locally Uncensored AI Desktop App aims for simplicity, you might still encounter some common issues.&lt;/p&gt;

&lt;p&gt;A primary concern for any local AI application is &lt;strong&gt;hardware compatibility&lt;/strong&gt;. DeepSeek v4.1 Flash, while efficient, still requires sufficient CPU, RAM, and especially GPU VRAM to run effectively. The model manager in the app is designed to help by indicating which models fit your hardware. If a model says "Needs more VRAM," it might run slowly or struggle. I've found that ensuring your GPU drivers are up-to-date can often resolve performance issues with local LLMs, as I've covered in my guide on running Llama 3.2 on Android.&lt;/p&gt;

&lt;p&gt;Another common problem can be related to &lt;strong&gt;download failures&lt;/strong&gt; when fetching models. The app includes a download manager with features like pausing, canceling, and resuming, which uses HTTP Range headers for proper resumable downloads. This helps prevent restarting large downloads if your connection drops.&lt;/p&gt;

&lt;p&gt;It's also worth noting an honest trade-off: while it offers chat, image/video generation, and coding assistance in one place, for highly specialized tasks, dedicated tools might offer more advanced features or finer control. For example, if you're deep into complex image generation workflows, a standalone ComfyUI installation might provide more granular control than the integrated version. However, for most day-to-day developer needs, the convenience of an all-in-one local studio like this often outweighs the slight loss of deep customization.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Locally Uncensored AI App - Download &amp;amp; Setup&lt;/li&gt;
&lt;li&gt;  Locally Uncensored download | SourceForge.net&lt;/li&gt;
&lt;li&gt;  GitHub - PurpleDoubleD/locally-uncensored: The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.&lt;/li&gt;
&lt;li&gt;  How to Run AI Locally in 2026: 5-Minute Beginner Guide&lt;/li&gt;
&lt;li&gt;  Locally Uncensored v1.5.5 — Zero-Config AI Models, VRAM Detection &amp;amp; Production-Ready Desktop App - DEV Community&lt;/li&gt;
&lt;li&gt;  Install, Chat, Agent, Code, Create, Cloud - Locally Uncensored Handbook&lt;/li&gt;
&lt;li&gt;  Plug and Play Local AI: One Installer, Zero Setup - Locally Uncensored&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Kamal Kishor&lt;/em&gt;* (&lt;a href="https://dev.to/koolkamalkishor"&gt;@koolkamalkishor&lt;/a&gt;) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="https://github.com/koolkamalkishor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://kamalkishor.vercel.app" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;*&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Published: 09 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Prompt Chaining for LLMs: Build Reliable Workflows</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Sun, 08 Nov 2026 10:42:12 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/prompt-chaining-for-llms-build-reliable-workflows-4n2a</link>
      <guid>https://dev.to/koolkamalkishor/prompt-chaining-for-llms-build-reliable-workflows-4n2a</guid>
      <description>&lt;p&gt;Liquid syntax error: 'raw' tag was never closed&lt;/p&gt;
</description>
      <category>ai</category>
      <category>llm</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>NVIDIA Nemotron 3.5 Bolt E4B CPU: Run Locally with Ollama</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Sat, 07 Nov 2026 10:37:06 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/nvidia-nemotron-35-bolt-e4b-cpu-run-locally-with-ollama-lb3</link>
      <guid>https://dev.to/koolkamalkishor/nvidia-nemotron-35-bolt-e4b-cpu-run-locally-with-ollama-lb3</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; This guide explains how to get NVIDIA Nemotron 3.5 Bolt E4B running on your laptop's CPU using Ollama. You'll learn the setup and commands to enable local multimodal AI vision capabilities without needing a dedicated GPU.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Running advanced AI models often feels like an exclusive club, requiring expensive GPUs and specialized hardware. But what if you want to experiment with a recently released vision-language model, like NVIDIA's Nemotron 3.5 Bolt E4B, right on your standard laptop's CPU? This is where Ollama steps in, making powerful multimodal AI accessible locally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Ready
&lt;/h2&gt;

&lt;p&gt;To run NVIDIA Nemotron 3.5 Bolt E4B locally, you'll need a machine running Linux, macOS, or Windows with Ollama installed. The key here is &lt;strong&gt;Ollama version 0.40.15 or newer&lt;/strong&gt;, as this release added support for the Nemotron 3.5 Bolt E4B model. Since we're targeting CPU-only execution, adequate RAM is important; while exact figures can vary based on context size, aiming for 16GB or more is a good starting point for a smooth experience.&lt;/p&gt;

&lt;p&gt;As someone who leans towards free, local AI tools when their quality is good enough, this kind of development is exactly what I appreciate. My past experiences, including running models like Llama 3.2 on Android with Ollama, have shown me the value of having these capabilities without relying on cloud APIs or dedicated hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup and Running the Model
&lt;/h2&gt;

&lt;p&gt;First, ensure you have Ollama installed. If you don't, you can grab it directly from the official Ollama website. The installation process is straightforward, typically involving a single command for Linux/macOS or a dedicated installer for Windows.&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;macOS&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://ollama.com/install.sh | sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For &lt;strong&gt;Linux&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://ollama.com/install.sh | sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For &lt;strong&gt;Windows&lt;/strong&gt;, download the installer from the Ollama website.&lt;/p&gt;

&lt;p&gt;Once Ollama is installed and running, you can pull the Nemotron 3.5 Bolt E4B model. This command will download the model weights to your local machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama pull nemotron-3-5-bolt-e4b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the model is downloaded, you can run it. Nemotron 3.5 Bolt E4B is a vision-language model, meaning it can process both text and images. You'll interact with it via the command line, providing a prompt and optionally an image path.&lt;/p&gt;

&lt;p&gt;Here's a quick example. Let's say you have an image file named &lt;code&gt;my_image.jpg&lt;/code&gt; in your current directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama run nemotron-3-5-bolt-e4b
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; What is &lt;span class="k"&gt;in &lt;/span&gt;this image? /path/to/my_image.jpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model will then process the image and your text prompt, providing a textual response describing the image content. You can continue the conversation, asking follow-up questions about the image or entirely new text-based queries. If you want to understand more about how Ollama handles multimodal inputs, I've covered the general concept previously in &lt;a href="https://dev.to/koolkamalkishor/ollama-multimodal-models-run-vision-ai-locally-2fj3"&gt;Ollama Multimodal Models: Run Vision AI Locally&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Issues and Considerations
&lt;/h2&gt;

&lt;p&gt;Running vision-language models like Nemotron 3.5 Bolt E4B on a CPU comes with inherent trade-offs, primarily in &lt;strong&gt;performance&lt;/strong&gt;. While it's fantastic for local experimentation and development, don't expect real-time responses comparable to GPU-accelerated inference. Depending on your CPU's power and the size of the image or complexity of the prompt, responses might take several seconds or even minutes.&lt;/p&gt;

&lt;p&gt;Another common issue is &lt;strong&gt;insufficient RAM&lt;/strong&gt;. Even without a dedicated GPU, LLMs and VLMs consume significant system memory. If your system frequently crashes or the &lt;code&gt;ollama run&lt;/code&gt; command fails, check your memory usage. You might need to close other applications or upgrade your RAM.&lt;/p&gt;

&lt;p&gt;This approach is particularly valuable for developers who need to integrate multimodal AI into applications where privacy is critical, or for those in environments with limited or no internet access. However, for production systems requiring high throughput, low latency, or processing very large batches of data, investing in GPU hardware or cloud-based GPU instances would still be the more practical route. For local development and testing, especially when iterating on prompts or fine-tuning application logic, CPU-only execution with Ollama is a robust and cost-effective solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Ollama v0.40.15 Release Notes: "Added &lt;code&gt;nemotron-3-5-bolt-e4b&lt;/code&gt;" (&lt;a href="https://github.com/ollama/ollama/releases/tag/v0.40.15" rel="noopener noreferrer"&gt;https://github.com/ollama/ollama/releases/tag/v0.40.15&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;  Ollama Installation Guide (&lt;a href="https://ollama.com/download" rel="noopener noreferrer"&gt;https://ollama.com/download&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Kamal Kishor&lt;/em&gt;* (&lt;a href="https://dev.to/koolkamalkishor"&gt;@koolkamalkishor&lt;/a&gt;) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="https://github.com/koolkamalkishor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://kamalkishor.vercel.app" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;*&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Published: 07 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>llm-d 1.0: Scalable LLM Inference for Production</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Fri, 06 Nov 2026 11:22:51 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/llm-d-10-scalable-llm-inference-for-production-ecl</link>
      <guid>https://dev.to/koolkamalkishor/llm-d-10-scalable-llm-inference-for-production-ecl</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; llm-d 1.0 is a new open-source project under the CNCF designed to make LLM inference scalable and cost-effective in production. It aims to reduce operational costs by 5-10x while handling complex agentic and RAG workloads.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Getting Large Language Models into production reliably and affordably is still a major headache for many teams. The challenges compound when you're dealing with diverse workloads, trying to serve multiple users from shared infrastructure, or facing unpredictable bursts of activity. Standard microservice patterns often break down here because LLM inference is highly stateful and computationally intensive, with costs soaring as demand increases.&lt;/p&gt;

&lt;h2&gt;
  
  
  What llm-d 1.0 Is
&lt;/h2&gt;

&lt;p&gt;llm-d 1.0 is a significant open-source release that tackles these exact problems for production-scale LLM inference. Announced on October 20, 2026, by project contributors including IBM, Red Hat, Google Cloud, CoreWeave, and NVIDIA, it marks a major step towards making distributed LLM inference a standard, cloud-native capability. The project, founded in 2025, is governed by the Cloud Native Computing Foundation (CNCF) and was accepted into the CNCF Sandbox maturity level on March 12, 2026.&lt;/p&gt;

&lt;p&gt;Essentially, llm-d 1.0 provides a hardened core for distributed inference, validated for day-2 production deployments. It helps organizations improve AI serving efficiency and scale enterprise workloads, with reported cost reductions of 5-10x compared to all-proprietary configurations in some use cases. In one IBM Research example, using open frontier models and llm-d enabled an 11.5 times lower inference cost. This project is a vendor-neutral alternative aimed at enterprises seeking high-performance inference without being locked into a single provider or hardware platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  How llm-d 1.0 Works
&lt;/h2&gt;

&lt;p&gt;llm-d 1.0 is engineered to bring sustained performance to the realities of running inference in production. It supports serving multiple tenants, balancing competing priorities, providing zero-downtime features, and handling emerging agentic workloads within a co-designed suite of components.&lt;/p&gt;

&lt;p&gt;At its core, llm-d's architecture revolves around three concepts: the &lt;strong&gt;Router&lt;/strong&gt;, the &lt;strong&gt;InferencePool&lt;/strong&gt;, and the &lt;strong&gt;Model Server&lt;/strong&gt;. The llm-d Router acts as the intelligent entry point for inference requests, providing LLM-aware load balancing, request queuing, and policy enforcement. It includes an Endpoint Picker (EPP) that scores and selects model server pods based on real-time metrics, KV-cache affinity, and configured policies.&lt;/p&gt;

&lt;p&gt;A key aspect is its comprehensive ecosystem for managing and reusing the KV cache across the inference pool. This includes prefix-cache aware routing to maximize cache hits, KV-cache indexing for tracking cache state, and KV offloading to tiered storage (CPU, SSD) to extend capacity. For latency-tolerant traffic, llm-d 1.0 also introduces &lt;code&gt;llm-d-async-processor&lt;/code&gt;, which routes requests from queues alongside real-time traffic, using queue and pool-dispatch gates to enforce priorities and quotas.&lt;/p&gt;

&lt;p&gt;It supports proactive, SLO-aware autoscaling using KEDA and EPP metrics, which track signals like queue depth and token backlog. Furthermore, it handles "disaggregated serving," where an inference request is split into phases (like prefill and decode) handled by specialized workers, orchestrated by the Router. This design helps prevent bursty agent loops from starving interactive users by intelligently queuing and prioritizing requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who Needs to Care
&lt;/h2&gt;

&lt;p&gt;If you're building or operating AI agents and RAG (Retrieval-Augmented Generation) systems at scale, you should pay close attention to llm-d 1.0. The project directly addresses the cost and performance bottlenecks often faced when operationalizing LLMs, especially with context-heavy, bursty agentic workloads. As a Sr. Frontend Developer currently building an AI-powered SDR agent platform and learning RAG architectures, I find the focus on multi-tenant QoS and efficient handling of complex, dynamic workloads particularly relevant. Most AI agent projects struggle in production due to issues like weak validation, but the underlying inference infrastructure's stability and cost are equally critical. Projects like llm-d that enable robust, cost-effective inference directly impact the feasibility of deploying advanced agentic systems.&lt;/p&gt;

&lt;p&gt;Organizations that need to deploy inference stacks across various hardware (NVIDIA, AMD, Intel, Google TPUs) or cloud environments will find llm-d appealing due to its vendor-neutral approach. If you're looking for an open-source alternative to managing complex AI infrastructure that emphasizes efficiency, scalability, and predictable performance, llm-d 1.0 is worth exploring.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical Consideration
&lt;/h2&gt;

&lt;p&gt;While llm-d 1.0 offers substantial benefits for scaling LLM inference, it's not a magic bullet that eliminates all operational complexity. Being a Kubernetes-native project, adopting it means embracing or deepening your team's expertise in Kubernetes orchestration, custom resources, and cloud-native practices. The 5-10x cost reduction is compelling, but achieving it requires careful configuration, understanding of its architecture, and integrating it into your existing CI/CD and monitoring pipelines. For smaller projects or those with very low inference volume, the overhead of setting up and managing a distributed inference network like llm-d might outweigh the cost savings of using a simpler, managed LLM API. The greatest benefits will likely be seen by enterprises and teams with significant, diverse, and scaling LLM inference requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://www.ibm.com/newsroom/announcements/2026/10/llm-d-1-0-advances-open-cost-efficient-ai-inference-for-production-scale" rel="noopener noreferrer"&gt;llm-d 1.0 Advances Open, Cost-Efficient AI Inference for Production Scale - IBM Newsroom&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQG5JX9Fx5TNQFFBFKTGz-MAxpbl-HXJZ7uiiS1NeUHM0Eu22dk4wwS3q69l1A5yHaRid89FWPqWhocKreiZ_27Z9junWTHjktvcP9_8lF8OFaDOYdSAK6L5caS2U5FVJzB6" rel="noopener noreferrer"&gt;llm-d Architecture - Official Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Kamal Kishor&lt;/em&gt;* (&lt;a href="https://dev.to/koolkamalkishor"&gt;@koolkamalkishor&lt;/a&gt;) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="https://github.com/koolkamalkishor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://kamalkishor.vercel.app" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;*&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Published: 06 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>infrastructure</category>
      <category>llm</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Constrained Direct Answering: Get Precise LLM Outputs</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Thu, 05 Nov 2026 11:25:40 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/constrained-direct-answering-get-precise-llm-outputs-4g41</link>
      <guid>https://dev.to/koolkamalkishor/constrained-direct-answering-get-precise-llm-outputs-4g41</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; This article explains Constrained Direct Answering, a technique for getting precise, non-reasoning responses from LLMs. Readers will learn how to implement it to achieve more accurate and reliable AI outputs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You've probably seen it: you ask an LLM a simple question, expecting a single word or a concise phrase, and it responds with a paragraph of context, a brief essay on the topic, or even a polite disclaimer. This "thinking inertia," where the model feels compelled to elaborate, is a common headache when you need truly precise, direct answers for automated systems or data extraction. It costs tokens, adds latency, and complicates downstream parsing.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;Constrained Direct Answering&lt;/strong&gt; comes in. It's a technique to explicitly guide an LLM to deliver only the requested information, free from any preamble, explanation, or conversational fluff. It essentially tells the model to bypass its typical reasoning output and go straight for the target.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Direct Answers Matter
&lt;/h3&gt;

&lt;p&gt;For many applications, especially in AI agent systems, you don't need a conversational partner; you need a data point. When I'm building AI-powered SDR agent platforms, for example, for tasks like lead qualification or personalizing outreach, I often need a specific entity, a sentiment score, or a binary "yes/no" answer. Extra text in these scenarios isn't just annoying; it can break your parsing logic or inflate API costs. I've found that weak validation and error handling on these verbose outputs are often why AI agent projects falter in production, not the models themselves. This technique helps shore up that initial output quality.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementing Constrained Direct Answering
&lt;/h3&gt;

&lt;p&gt;The core idea is to be brutally explicit in your prompt, leaving no room for the LLM to interpret your request broadly. You're effectively boxing the model into a very specific response format.&lt;/p&gt;

&lt;p&gt;Here’s a step-by-step approach you can use today:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;State Your Intent Clearly:&lt;/strong&gt; Begin your prompt by explicitly telling the LLM to output &lt;em&gt;only&lt;/em&gt; the answer and nothing else.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  "Answer ONLY with..."&lt;/li&gt;
&lt;li&gt;  "Respond with the [X] value and nothing else."&lt;/li&gt;
&lt;li&gt;  "Your entire response must be [Y]."&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Define the Output Format:&lt;/strong&gt; If you need a specific structure, like a JSON object, a comma-separated list, or a single integer, specify it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  "Return a JSON object with a single key 'city' and its value."&lt;/li&gt;
&lt;li&gt;  "List the items as a comma-separated string."&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Add Negative Constraints:&lt;/strong&gt; Tell the LLM what &lt;em&gt;not&lt;/em&gt; to do. This reinforces the directness.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  "Do NOT provide any explanation."&lt;/li&gt;
&lt;li&gt;  "No preamble, no conversational filler, no concluding remarks."&lt;/li&gt;
&lt;li&gt;  "Do not apologize or offer additional information."&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;An Illustrative Sketch (not from any project's docs):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's how this might look in a simple Python snippet using a hypothetical LLM API call:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="c1"&gt;# Assume 'llm_api_client' is an initialized client for your LLM service
# and 'LLM_MODEL' is your target model, e.g., "gemini-1.5-flash"
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_direct_answer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;LLM_MODEL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;your_default_model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
    &lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;QUESTION: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSTRUCTIONS: Your entire response must be ONLY the direct answer to the question. &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Do NOT provide any explanations, preamble, or conversational text. &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Do NOT apologize or offer additional information. Respond concisely.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# This is a placeholder for your actual LLM API call
&lt;/span&gt;        &lt;span class="c1"&gt;# Example using a hypothetical client. Replace with your LangChain, OpenAI, Anthropic, etc., call.
&lt;/span&gt;        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;llm_api_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Keep max_tokens low for brevity
&lt;/span&gt;        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error calling LLM: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

&lt;span class="c1"&gt;# Example Usage:
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get_direct_answer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What is the capital of France?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;# Expected: Paris
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get_direct_answer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Is 17 a prime number? Answer ONLY with &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Yes&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; or &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;No&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;# Expected: Yes
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By keeping &lt;code&gt;max_tokens&lt;/code&gt; low, you can also implicitly encourage brevity, though direct instruction is always more reliable.&lt;/p&gt;

&lt;h3&gt;
  
  
  When Constrained Direct Answering is Not Worth It
&lt;/h3&gt;

&lt;p&gt;This technique shines when you need objective, non-reasoning responses: extracting specific facts, classifying inputs, or performing quick lookups. For instance, when validating agent outputs with explicit pass conditions, getting a "True" or "False" directly is far more useful than an explanation.&lt;/p&gt;

&lt;p&gt;However, if your task requires the LLM to &lt;em&gt;think aloud&lt;/em&gt;, explain its reasoning, or generate creative and varied outputs, then Constrained Direct Answering is counterproductive. Don't use it for summarizing complex articles, generating marketing copy, or when you actually &lt;em&gt;want&lt;/em&gt; the LLM's thought process visible for debugging or audit. It's about precision, not deep thought.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2610.11765" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2610.11765&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptingguide.ai/techniques/zeroshot" rel="noopener noreferrer"&gt;https://www.promptingguide.ai/techniques/zeroshot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/koolkamalkishor/validating-ai-agent-outputs-with-explicit-pass-conditions-5hm"&gt;https://dev.to/koolkamalkishor/validating-ai-agent-outputs-with-explicit-pass-conditions-5hm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Kamal Kishor&lt;/em&gt;* (&lt;a href="https://dev.to/koolkamalkishor"&gt;@koolkamalkishor&lt;/a&gt;) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="https://github.com/koolkamalkishor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://kamalkishor.vercel.app" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;*&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Published: 05 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>llm</category>
    </item>
    <item>
      <title>Ollama Local TTS: Audio with LFM3-Audio on Linux &amp; Windows</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Wed, 04 Nov 2026 11:26:33 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/ollama-local-tts-audio-with-lfm3-audio-on-linux-windows-583</link>
      <guid>https://dev.to/koolkamalkishor/ollama-local-tts-audio-with-lfm3-audio-on-linux-windows-583</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; This guide demonstrates how to run local text-to-speech using Ollama and the LFM3-audio model from Liquid AI on Linux and Windows. Readers will learn the exact commands to get high-quality speech output directly on their machines without cloud dependencies.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Dealing with cloud text-to-speech (TTS) APIs can be a real pain. You're constantly thinking about latency, data privacy, and the monthly bill that creeps up. Building multimodal agents that need to speak without an internet connection, or just wanting to add an accessible voice feature to a local app, often means a compromise: either use lower-quality local options or pay for external services.&lt;/p&gt;

&lt;p&gt;Ollama's recent &lt;code&gt;v0.40.13&lt;/code&gt; update changes that, bringing Liquid AI's LFM3 family of models, including &lt;code&gt;lfm3-audio&lt;/code&gt;, to Linux and Windows users. This extends the high-performance local inference capabilities previously available only on Apple Silicon, making robust text-to-speech accessible on standard workstations. This is a compact, fully-featured 2B parameter audio model that can run locally on laptops and edge devices. It takes text or audio as input and can respond with text, speech, or both. As someone who prefers free, local AI tools when the quality is good enough, this update is a big win for offline development and reducing cloud reliance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started with LFM3-audio
&lt;/h3&gt;

&lt;p&gt;First, ensure you have Ollama installed and updated to at least version &lt;code&gt;0.40.13&lt;/code&gt;. You can check your version by running &lt;code&gt;ollama --version&lt;/code&gt;. If you need to update, the process is straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# If installed via Homebrew (macOS)&lt;/span&gt;
brew update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; brew upgrade ollama

&lt;span class="c"&gt;# If installed via script (Linux)&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://ollama.com/install.sh | sh

&lt;span class="c"&gt;# For Windows, download the latest installer from ollama.com/download&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once Ollama is up to date, pulling the &lt;code&gt;lfm3-audio&lt;/code&gt; model is a single command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama pull lfm3-audio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command downloads the 2.1 GB model to your local machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running Text-to-Speech
&lt;/h3&gt;

&lt;p&gt;With the model downloaded, you can now generate speech directly from your terminal. The &lt;code&gt;ollama run&lt;/code&gt; command plays the audio through your computer's speakers.&lt;/p&gt;

&lt;p&gt;To generate speech from a simple text prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama run lfm3-audio &lt;span class="s2"&gt;"Hello from your local text-to-speech model!"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model can handle various inputs and tasks, including multilingual speech synthesis in 18 languages. To specify a language and gender for the voice, you can use a system prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama run lfm3-audio &lt;span class="s2"&gt;"Perform TTS in English using a female voice. Hello, how are you today?"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;lfm3-audio&lt;/code&gt; model also supports streaming replies in text and speech for voice chat applications.&lt;/p&gt;

&lt;p&gt;You can also save the audio output to a WAV file instead of playing it directly. This is particularly useful for integrating TTS into applications or when working on a server without speakers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama run lfm3-audio &lt;span class="s2"&gt;"This text will be saved to a file."&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; speech.wav
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For programmatic access, Ollama provides an OpenAI-compatible &lt;code&gt;/v1/audio/speech&lt;/code&gt; endpoint. You can interact with it using &lt;code&gt;curl&lt;/code&gt; to generate audio files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://localhost:11434/v1/audio/speech &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{ "model": "lfm3-audio", "input": "This is an example from the API.", "voice": "default" }'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output&lt;/span&gt; api_speech.wav
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Common Considerations
&lt;/h3&gt;

&lt;p&gt;While running local TTS with Ollama and LFM3-audio is powerful, there are a few things to keep in mind. The &lt;code&gt;lfm3-audio&lt;/code&gt; model handles up to 32K tokens for context length (input + output). Longer texts might need to be split, though &lt;code&gt;ollama run&lt;/code&gt; often handles this automatically at paragraph and sentence breaks. Also, be aware that numbers, prices, and URLs are often spoken in expanded form, and markdown symbols or emojis are typically skipped.&lt;/p&gt;

&lt;p&gt;A potential trade-off with local models is the initial download size and the computational resources required. While &lt;code&gt;lfm3-audio&lt;/code&gt; is a compact 2B parameter model, a 2.1 GB download might take a little time depending on your internet connection. On the resource front, it's designed to run on laptops and edge devices, but its performance will still scale with your hardware, especially if you're running other models concurrently. For agentic coding or complex multi-step reasoning, LFM3-Audio-2B is not recommended due to its small size; it's better suited for local agents, tool calling, structured outputs, and domain-specific fine-tuning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Ollama v0.40.13: LFM3 Support for Windows &amp;amp; Linux | Laravel - Richness. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHBXXOtztFnnwqO0rHuU3SSgDBx5aRvMsHMQQbW4TPtngLAaUBVsqX3wjCqY51DBKn3Z7gUQ-_GfsdTGqapMHenmu61th7Ux6CAumvoRcLlEL5hRIf55cHLox8qYBpFo-7qUQ6oAmkjP9ozbGXY41cxWmoe9naurlergXpmGtzufCc=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHBXXOtztFnnwqO0rHuU3SSgDBx5aRvMsHMQQbW4TPtngLAaUBVsqX3wjCqY51DBKn3Z7gUQ-_GfsdTGqapMHenmu61th7Ux6CAumvoRcLlEL5hRIf55cHLox8qYBpFo-7qUQ6oAmkjP9ozbGXY41cxWmoe9naurlergXpmGtzufCc=&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  LFM3-Audio-2B - Liquid AI Docs. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEV-zYGdK8LbCKGJofCjRwGsyEAmjWCTpAl7NmM-TGLJ8kjN89v0gd9GKCj82J4TH4MBTDkkl2WDCw1NB6jVpK6D8qUu1nTK-HVFeqNHD_NQORrtBk5fyC4SjsTdIEYgv8G3uKFvQMsK2zF" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEV-zYGdK8LbCKGJofCjRwGsyEAmjWCTpAl7NmM-TGLJ8kjN89v0gd9GKCj82J4TH4MBTDkkl2WDCw1NB6jVpK6D8qUu1nTK-HVFeqNHD_NQORrtBk5fyC4SjsTdIEYgv8G3uKFvQMsK2zF&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  lfm3-audio - Ollama. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHyai-ylXSU4fyjLPYvtSCsou5pQ8SrxttGGrC4KvZWKk4FEQIcFyaevKHD9g7kGGphMBv5F-xKwVWpAVcRPtwBqkIQpNKrjn5YPh-dovgqqnFhXePuCt9cVL20Y25-VIM=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHyai-ylXSU4fyjLPYvtSCsou5pQ8SrxttGGrC4KvZWKk4FEQIcFyaevKHD9g7kGGphMBv5F-xKwVWpAVcRPtwBqkIQpNKrjn5YPh-dovgqqnFhXePuCt9cVL20Y25-VIM=&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  Ollama 0.40.13: Speech Endpoint, d3 Models and LFM3 - ThreatFrontier.com. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEGBMHXBcI7Jr0akcbuU2cwG4pq3rIUCCdRIUp7n7VL98V6y3Oi00X4Wax0cz-xsl7vgwNSiJG0udBFQ_sJ0PQeIEj8pJ_LUnmr33_dhJ6j6JpLj8uOwh1TAQYWV-d_wD_da88zUr_yh7MlsiUChwOakQqJNkl7r2inZrigJuhlvQ3MOraGhDzoWWNaS1I=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEGBMHXBcI7Jr0akcbuU2cwG4pq3rIUCCdRIUp7n7VL98V6y3Oi00X4Wax0cz-xsl7vgwNSiJG0udBFQ_sJ0PQeIEj8pJ_LUnmr33_dhJ6j6JpLj8uOwh1TAQYWV-d_wD_da88zUr_yh7MlsiUChwOakQqJNkl7r2inZrigJuhlvQ3MOraGhDzoWWNaS1I=&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  Ollama Release Notes - November 2026 Latest Updates - Releasebot. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHuk_AL28rZMGb2LVRjhOd1YhwBoSSCzkTuXfI84djIjfQcnGFSoq35wahviPAOz9Nt-dWf53_T0EuBROTWtHBKWFDNyGxQznzAUvM2mTXYJPZnB88mpb_DJxWxeXVi0g==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHuk_AL28rZMGb2LVRjhOd1YhwBoSSCzkTuXfI84djIjfQcnGFSoq35wahviPAOz9Nt-dWf53_T0EuBROTWtHBKWFDNyGxQznzAUvM2mTXYJPZnB88mpb_DJxWxeXVi0g==&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  LiquidAI/LFM3-Audio-2B - Hugging Face. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGxJG4idjl9X24S5pe6qipsTKLFEHZMeJDgU-8k0S0IpXVnKAgvQBnl-PIye2bJgBfInx7DlU12r2igT_dekrBEVtBOwEFtlX-WZKJ-VduuaUcwPIykGWIp1bFgNATOvYSNElthwrBe_g==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGxJG4idjl9X24S5pe6qipsTKLFEHZMeJDgU-8k0S0IpXVnKAgvQBnl-PIye2bJgBfInx7DlU12r2igT_dekrBEVtBOwEFtlX-WZKJ-VduuaUcwPIykGWIp1bFgNATOvYSNElthwrBe_g==&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  New audio model: LFM3-Audio-2B : r/LocalLLaMA - Reddit. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHTkWPuGTpvwK3hUOBhtfipAW7K5xvuI16Rv7_WE9VYg6wwkRJUyaoYkg1cpqu5NOcPjVrn3hx3bbmH2RpbMukpnMJ52nSDmjYsaHRgzsGL0YHkGo2F8XwvSpBnQYFMTWT3IxoQQ_c9MaM8AyOtv16jBFUUvMpykkgg6nqVN6c83i2fRY4VR3wKJyXZ-A==" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHTkWPuGTpvwK3hUOBhtfipAW7K5xvuI16Rv7_WE9VYg6wwkRJUyaoYkg1cpqu5NOcPjVrn3hx3bbmH2RpbMukpnMJ52nSDmjYsaHRgzsGL0YHkGo2F8XwvSpBnQYFMTWT3IxoQQ_c9MaM8AyOtv16jBFUUvMpykkgg6nqVN6c83i2fRY4VR3wKJyXZ-A==&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  LFM3-Audio-2B on Ollama: Better Speech, the Same Ears - OrcaRouter. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEd7S_nlNcf-8Pwd-zZwixTa0De-ofd3GiSEns1oHLdIzuY51_DFIuBK2S9iXBxziVqC0iQKodDFpNmEG9oGvAMECHvRTRD7sH3-AGWRjiWLWZxrDPu_rxVTmgZ9m9CEoLXT89RlgIcLJALMnHZPNTsNOfXEken4-ABy8=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEd7S_nlNcf-8Pwd-zZwixTa0De-ofd3GiSEns1oHLdIzuY51_DFIuBK2S9iXBxziVqC0iQKodDFpNmEG9oGvAMECHvRTRD7sH3-AGWRjiWLWZxrDPu_rxVTmgZ9m9CEoLXT89RlgIcLJALMnHZPNTsNOfXEken4-ABy8=&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  Ollama Speaks! How to Use the New Local Text-to-Speech AI Models in Ollama. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGACGaTAqEC9XH3iG7O_BwnZ4OrtjmAfSbhdYlq09AHEV51pxnINeTPCLAVsSAq_4-1BfX_qTRJrTMSo1sviM9Kh6KbTjS3xc1dM1GrDoJ7lvr6C2MCNrJCXvimWT8nxTnPjG7co8=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGACGaTAqEC9XH3iG7O_BwnZ4OrtjmAfSbhdYlq09AHEV51pxnINeTPCLAVsSAq_4-1BfX_qTRJrTMSo1sviM9Kh6KbTjS3xc1dM1GrDoJ7lvr6C2MCNrJCXvimWT8nxTnPjG7co8=&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  Speech - Ollama documentation. &lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFRO5UOaqGH7nzO1J4AwwKsFol-R6fJccb4NbB0OTzLd6hi251LHw0QKel99C-VyC3oBSSrYA0gwNCV6lWQbJdiILZshTB-izBV-mPSafi_443iLJrY4Z9VoSoAme4CYmm6P-G7co8=" rel="noopener noreferrer"&gt;https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFRO5UOaqGH7nzO1J4AwwKsFol-R6fJccb4NbB0OTzLd6hi251LHw0QKel99C-VyC3oBSSrYA0gwNCV6lWQbJdiILZshTB-izBV-mPSafi_443iLJrY4Z9VoSoAme4CYmm6P-G7co8=&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Kamal Kishor&lt;/em&gt;* (&lt;a href="https://dev.to/koolkamalkishor"&gt;@koolkamalkishor&lt;/a&gt;) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="https://github.com/koolkamalkishor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://kamalkishor.vercel.app" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;*&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Published: 04 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>linux</category>
      <category>llm</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Anthropic FlashProve: Verifiable AI Outputs for Developers</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Tue, 03 Nov 2026 11:14:58 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/anthropic-flashprove-verifiable-ai-outputs-for-developers-dlm</link>
      <guid>https://dev.to/koolkamalkishor/anthropic-flashprove-verifiable-ai-outputs-for-developers-dlm</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Anthropic FlashProve is an open-source research prototype that uses zero-knowledge proofs (zkSNARKs) to cryptographically verify that an AI model's output came from a specific set of committed weights, without revealing those weights. This allows developers to build AI applications with auditable an&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When you build an AI application, especially one that makes consequential decisions, how do you prove to your users that the output they receive actually came from the model you claim it did? It's a fundamental trust problem: a routing service could swap in a cheaper, less capable model, or an attacker could subtly alter the output stream. Simply getting a "good" answer doesn't guarantee its origin. We need a way to cryptographically attest to an AI's output.&lt;/p&gt;

&lt;h3&gt;
  
  
  What FlashProve Does
&lt;/h3&gt;

&lt;p&gt;Anthropic's FlashProve, an open-source research prototype unveiled on November 2, 2026, directly tackles this challenge. It provides a method to cryptographically verify that a large language model's response originated from a specific, committed set of model weights without revealing the weights themselves. This means you can prove the provenance of an AI-generated output, moving beyond simple content detection to a verifiable guarantee of its origin.&lt;/p&gt;

&lt;p&gt;As a Senior Frontend Developer building an AI-powered SDR agent platform, I know firsthand the pain points around validation and error handling in AI systems. Most AI agent projects fail in production not because of the model's intelligence, but due to a lack of robust verification that the system is operating as intended. FlashProve offers a way to establish that foundational trust.&lt;/p&gt;

&lt;p&gt;The system is built on &lt;strong&gt;zkSNARKs&lt;/strong&gt; (zero-knowledge succinct non-interactive arguments of knowledge), a type of cryptographic proof. A zkSNARK allows one party (the prover, in this case, the AI model provider) to convince another party (the verifier, your client application or an auditor) that a computation was performed correctly, without revealing the private inputs behind it. For AI, this means proving an output came from a specific model without exposing proprietary model weights or intermediate computation values. It's designed specifically for mixture-of-experts (MoE) language models, leveraging their architecture for proof generation.&lt;/p&gt;

&lt;h3&gt;
  
  
  How the Proof Works
&lt;/h3&gt;

&lt;p&gt;FlashProve operates in two main phases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Offline Commitment:&lt;/strong&gt; The model provider first publishes a small cryptographic &lt;strong&gt;commitment&lt;/strong&gt; to an exact set of neural network weights. This commitment, roughly 6.5 MB, is generated once and takes about 39 minutes. This initial step effectively "fingerprints" the model being used.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Online Proof Generation and Verification:&lt;/strong&gt; For each prompt and response pair, the system generates a succinct proof that the output tokens were indeed produced by the committed model. This proof is approximately 19 MB for a 1,024-token request. Anyone with the commitment, the prompt, and the response can then check this proof on a standard CPU, typically within 17 to 21 seconds, without needing access to the actual model weights or a GPU.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The underlying principle ensures completeness (an honest proof is accepted), soundness (a false statement cannot be certified without breaking cryptographic assumptions), and zero-knowledge (the proof reveals nothing about the weights or internal computation beyond the correctness of the output). Anthropic tested FlashProve on Meta's Llama 4 Maverick, a 400.7 billion-parameter MoE model, achieving proof generation at about 110 tokens per second on a single NVIDIA H100 GPU.&lt;/p&gt;

&lt;h3&gt;
  
  
  Who Should Care
&lt;/h3&gt;

&lt;p&gt;Developers working in domains where the integrity and auditability of AI outputs are non-negotiable should pay close attention. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Legal Tech:&lt;/strong&gt; Verifying that AI-generated legal summaries or document analyses come from approved models.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Finance:&lt;/strong&gt; Ensuring AI-driven trading recommendations or fraud detection outputs are from certified systems.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Secure Agents:&lt;/strong&gt; Building autonomous AI agents where proving an action was performed by a specific, trusted agent model is critical. For instance, in an agent system responsible for lead enrichment and personalized outreach, being able to cryptographically prove that a specific message was crafted by a known, qualified agent model offers a layer of trust that simple logging cannot. This aligns with challenges in &lt;a href="https://dev.to/koolkamalkishor/validating-ai-agent-outputs-with-explicit-pass-conditions-5hm"&gt;Validating AI Agent Outputs with Explicit Pass Conditions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Regulatory Compliance:&lt;/strong&gt; Meeting future regulations that demand verifiable AI systems.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  A Practical Limitation
&lt;/h3&gt;

&lt;p&gt;While FlashProve represents a significant leap, it's essential to acknowledge its current overhead. Generating these cryptographic proofs is computationally expensive. Anthropic's benchmarks show that proving requires roughly 70 to 95 times the GPU time compared to serving the model without proofs, using vLLM for inference. This high proving cost means FlashProve, in its current research prototype form, isn't practical for verifying every single token in high-throughput production environments. It's more suited for critical audits or spot checks where the cost is justified by the need for verifiable trust. The proof size, around 19 MB per 1,024-token request, is also substantial for continuous, real-time verification at scale. For now, FlashProve demonstrates the &lt;em&gt;possibility&lt;/em&gt; of verifiable AI inference, with the next challenge being to significantly reduce this computational burden.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH_SrWshQguPZOgccWNM9W5bpzmEwYG3GP-0nLoB6ApD77E90wIYOURF2niDjAKRqhg2MaTIWyLs5CDpQbsa8_kaldsHuKz-5mPg4XY5R4xrn-KLew8OYoOJhDatq7aPkLqLmcaWGkKOCgVHDfuL0_WhizdeacptrC99as1OM4LLtm08yliSot2fBUi1scMC2uPsCji" rel="noopener noreferrer"&gt;Anthropic Releases FlashProve for Cryptographic AI Inference Proofs - Unite.AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFlx3i4ISqkVrb72rPvLEasx-c68w-evWrp7JS8VypIzmNA0f0PCmcWzjGZhqWGv0PJkC8Yn8ZjaIOpaPqd5Mq-sboC82MO2lccwce1xuGBtxk6X_K7n75hLu7A3upRGHK_4qfLUTybHsvC46iVAMiIVZJ9QxcSB_yeqjOt9GHTkw==" rel="noopener noreferrer"&gt;Anthropic's FlashProve uses zero-knowledge proofs to verify large AI model outputs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFOv1XQPSf7R02pwP9mhKDHuy4VylCfRnDMXu0kAVllYm6_xUwDg6H3-FqV8S7gTgQe2_joApoRcrfVqoIox8cabJrgiM6acqemOmEyVkUQwU4ZKSwOdHix1wSkfpo1bzxuPOXhEFJVpoyeXwsIFvhq" rel="noopener noreferrer"&gt;Progress on provable inference for large language models - Anthropic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEGKq09NBd_2JpKs1lYC5cOP_jA2cPW8QgjPdR_tdQnbK_n2FyYu1eHMuOSoRAHurQSWTG7r5Gr7w2umVCezAe1sW00oSzFQJAbiVFwRB6LiIcI0ViHCI8v_RIw7irgd3R0WKYRF_b1pm3qfbpGXH8i6nyaF7W-DAXrfHUdRoq02IuYmSH1-CpQFL5nqg==" rel="noopener noreferrer"&gt;Zero-Knowledge Proofs for AI Agent Verification and Privacy | Zylos Research&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGoldHPNVmfBjOJt_RyS9tzdSo1mv1Oe2MTO1LdFyj2XIrZDUlu7aBBlqsR4MYyFM7gLxQzjfw-eHTyGCZ55DgzEnx-YUwTf9m4g-C730bwVyjWRtq2XdYLRnUfT7I7q0fXKXj0cUwRHD-tlnmdr0xQQz32INMXjK9fkR0=" rel="noopener noreferrer"&gt;Anthropic FlashProve: Proving Which Model Answered - CellCog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEFmbb_i0K7LpgbhYiVwldA-FhVaxxY4WcqlEmnHWeN64qVo5xVCnL8xyKimq3KIzHE5Gh2MAIQm_Nak1vPVjGCQqwu8vXJvd_E_Nz7UNqImgqz-RgaVZzvKRif2Bogue581GdVL4Z5LyFKwtV9dfG1nKwyzL57EgahdtV42yRSofnEipJBeY_PP8B2XAbdprumYg==" rel="noopener noreferrer"&gt;Anthropic's Proof of Which AI Answered Costs 70-95x GPU Time - FourWeekMBA&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Kamal Kishor&lt;/em&gt;* (&lt;a href="https://dev.to/koolkamalkishor"&gt;@koolkamalkishor&lt;/a&gt;) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; · &lt;a href="https://github.com/koolkamalkishor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://kamalkishor.vercel.app" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;*&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Published: 03 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>opensource</category>
      <category>security</category>
    </item>
    <item>
      <title>MAF Go: What Go Developers Should Know</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Tue, 03 Nov 2026 08:20:00 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/maf-go-what-go-developers-should-know-4i3c</link>
      <guid>https://dev.to/koolkamalkishor/maf-go-what-go-developers-should-know-4i3c</guid>
      <description>&lt;p&gt;Building reliable AI agents for production is rarely about just chaining a few LLM calls together. As requirements grow, you quickly run into issues like managing conversational state across multiple turns, orchestrating complex multi-agent interactions, handling tool usage, and ensuring graceful recovery from failures. This is especially true for backend systems where Go is often the language of choice for its performance and concurrency.&lt;/p&gt;

&lt;p&gt;Microsoft has released the Agent Framework for Go (MAF Go), an official implementation of their open, multi-language framework designed for building and orchestrating production-grade AI agents and multi-agent workflows. It offers Go developers a structured approach to move beyond simple prompt engineering to create more sophisticated, resilient agentic applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  What MAF Go Is
&lt;/h3&gt;

&lt;p&gt;MAF Go is part of the broader Microsoft Agent Framework, which also has .NET and Python implementations. It's positioned as the successor to frameworks like Semantic Kernel and AutoGen, consolidating their capabilities into a single, comprehensive platform for agent development. The Go SDK specifically provides packages, examples, and APIs tailored for building agents and workflows in Go. It's currently in public preview, with version v0.2.0 introducing provider-independent embedding generation and vector storage for RAG and memory capabilities.&lt;/p&gt;

&lt;p&gt;The framework focuses on providing foundational building blocks for complex agent systems, including model clients for various LLMs (like Microsoft Foundry, Azure OpenAI, OpenAI, Anthropic, Gemini, and Ollama), an agent session for state management, and context providers for agent memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  How MAF Go Works
&lt;/h3&gt;

&lt;p&gt;MAF Go provides a structured way to define agents, their tools, and how they interact within workflows. The core idea is to give you explicit control over agent execution paths, moving beyond stateless chat loops.&lt;/p&gt;

&lt;p&gt;Key operational aspects include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Agents&lt;/strong&gt;: These are individual units that use LLMs to process inputs, call tools, and generate responses. MAF Go supports an "Agent Harness," which is an opinionated agent with capabilities for multi-step tasks like planning, todo tracking, context compaction, file access, and observability.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Tools and Middleware&lt;/strong&gt;: Agents can discover and use domain-specific tools or knowledge bases. Middleware allows you to intercept agent actions for custom logging, validation, or other processing, offering a crucial layer for control and monitoring.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Workflows&lt;/strong&gt;: MAF Go excels at orchestrating multiple agents through graph-based workflows. These workflows can support various patterns:

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Sequential&lt;/strong&gt;: Agents execute tasks in a defined order, passing results between them.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Concurrent&lt;/strong&gt;: Agents work in parallel to maximize efficiency.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Group Collaboration&lt;/strong&gt;: Agents can collaborate on a single task, often with a manager agent overseeing the interaction.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Conditional Routing&lt;/strong&gt;: Logic can be applied to determine the next agent or step based on certain conditions.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Checkpointing and Human-in-the-Loop&lt;/strong&gt;: Workflows can be paused and resumed, and human intervention points can be integrated, which is vital for long-running processes and validation in production environments.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Observability&lt;/strong&gt;: The framework integrates with OpenTelemetry for distributed tracing, allowing you to monitor and debug agent runs, tool invocations, and workflow steps. This visibility is essential for identifying bottlenecks and errors in complex agentic systems, as covered in &lt;a href="https://dev.to/koolkamalkishor/agentic-ai-how-autonomous-agents-are-transforming-enterprise-workflows-4oi6"&gt;Agentic AI: How Autonomous Agents Are Transforming Enterprise Workflows&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Installation is straightforward, you can add it to your Go project using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go get github.com/microsoft/agent-framework-go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Who Should Care?
&lt;/h3&gt;

&lt;p&gt;If you're a Go developer tasked with building production-grade AI agents or complex multi-agent systems, MAF Go is worth your attention. It's particularly useful for scenarios requiring robust orchestration beyond simple single-prompt interactions or stateless chat loops. This includes applications where you need graph-based workflow patterns, checkpointing for durability, detailed observability, governance, or human oversight.&lt;/p&gt;

&lt;p&gt;For teams already invested in Go for backend services, CLIs, workers, or cloud-native applications, MAF Go offers a way to integrate advanced AI capabilities natively within that ecosystem. I’m currently building an AI-powered SDR agent platform myself using other frameworks, and my experience confirms that a lot of AI agent projects tend to stumble in production due to insufficient validation and error handling, rather than issues with the model itself. A framework like MAF Go, with its focus on robust orchestration and observability, directly addresses these common failure points, providing a more stable foundation for agentic applications. This echoes the importance of structured approaches to agent task decomposition, as I discussed in &lt;a href="https://dev.to/koolkamalkishor/llm-agent-task-decomposition-for-reliable-workflows-16jb"&gt;LLM Agent Task Decomposition for Reliable Workflows&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Concrete Limitation
&lt;/h3&gt;

&lt;p&gt;While MAF Go offers a powerful foundation, it's important to remember that the Go SDK is still in public preview. This means that certain features available in the .NET and Python implementations, such as declarative agents, CodeAct (for generating and executing code), and some advanced functional workflows, are not yet implemented or fully available in the Go version. Additionally, while it supports embedding generation and vector stores for RAG, the more comprehensive RAG capabilities like automatic retrieval before agent runs might still be evolving. It also requires Go 1.26 or later. As with any preview software, APIs may evolve, and it might not be suitable for immediate, critical production deployments that rely on these specific missing features without careful consideration and workaround planning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://github.com/microsoft/agent-framework-go" rel="noopener noreferrer"&gt;https://github.com/microsoft/agent-framework-go&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Daily AI notes on &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; — Kamal Kishor&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>go</category>
      <category>microsoft</category>
    </item>
    <item>
      <title>Muse Glimmer 30B Local: Run Agentic Workflows on Your Laptop</title>
      <dc:creator>KAMAL KISHOR</dc:creator>
      <pubDate>Wed, 21 Oct 2026 08:49:48 +0000</pubDate>
      <link>https://dev.to/koolkamalkishor/muse-glimmer-30b-local-run-agentic-workflows-on-your-laptop-5gng</link>
      <guid>https://dev.to/koolkamalkishor/muse-glimmer-30b-local-run-agentic-workflows-on-your-laptop-5gng</guid>
      <description>&lt;p&gt;If you've been exploring AI agents, you know the struggle: building complex workflows often means relying on cloud APIs, which quickly add up in cost and introduce latency. For local development or scenarios demanding data privacy, this becomes a blocker. This is where models like Meta's Muse Glimmer 30B step in, offering a powerful, open-source solution designed to run efficiently on your own machine.&lt;/p&gt;

&lt;p&gt;I'm always on the lookout for free, local AI tools that deliver solid quality, especially for my work building AI-powered SDR agent platforms. It's why I even swapped out a paid coding assistant for a local alternative, as I shared in &lt;a href="https://dev.to/koolkamalkishor/i-replaced-cursor-with-a-free-local-ai-coding-assistant-and-saved-240year-4c3j"&gt;I Replaced Cursor with a Free Local AI Coding Assistant (And Saved $240/Year)&lt;/a&gt;. Muse Glimmer fits this philosophy perfectly, promising powerful multimodal agentic capabilities without the cloud dependency.&lt;/p&gt;

&lt;h3&gt;
  
  
  What You Need to Get Started
&lt;/h3&gt;

&lt;p&gt;To run Muse Glimmer 30B locally, you'll need a few prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Python:&lt;/strong&gt; Version 3.10 or higher is recommended for compatibility with modern AI libraries.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;PyTorch:&lt;/strong&gt; The underlying deep learning framework. You'll need the CUDA version if you have an NVIDIA GPU for accelerated performance, or the CPU-only version if you plan to run it exclusively on your CPU.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Unsloth Library:&lt;/strong&gt; This is the key. Unsloth optimizes models like Glimmer to run significantly faster and with less memory, making a 30B model feasible on consumer hardware.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Hardware:&lt;/strong&gt; While Muse Glimmer 30B can run on CPU-only systems, a GPU (even a consumer-grade one) with at least 16GB VRAM will provide a much smoother and faster experience. Expect slower inference times without a dedicated GPU.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;RAM:&lt;/strong&gt; Even with Unsloth's optimizations, a 30B model will still consume a fair amount of system RAM, especially if you're loading it in higher precision or without 4-bit quantization. Aim for 32GB or more system RAM if possible.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setting Up Your Environment
&lt;/h3&gt;

&lt;p&gt;First, ensure you have Python 3.10+ installed. Then, you'll install the Unsloth library, which includes PyTorch as a dependency. The exact command depends on whether you have a CUDA-enabled GPU:&lt;/p&gt;

&lt;p&gt;For systems with an NVIDIA GPU (recommended for speed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;unsloth[cuda-torch]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For CPU-only systems:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;unsloth[torch]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command installs Unsloth along with the necessary PyTorch backend. Unsloth handles much of the complexity behind the scenes, allowing you to load large models efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running a Quick Glimmer Example
&lt;/h3&gt;

&lt;p&gt;Once Unsloth is installed, you can load and interact with the Muse Glimmer 30B model. Here's how to run a basic text generation example using the 4-bit quantized version, which is optimized for lower memory usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;unsloth&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastLanguageModel&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;

&lt;span class="c1"&gt;# Configure model loading
&lt;/span&gt;&lt;span class="n"&gt;max_seq_length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2048&lt;/span&gt; &lt;span class="c1"&gt;# Adjust as needed, Unsloth handles RoPE scaling
&lt;/span&gt;&lt;span class="n"&gt;dtype&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt; &lt;span class="c1"&gt;# Auto detects. Use torch.float16 for older GPUs, torch.bfloat16 for newer ones (Ampere+)
&lt;/span&gt;&lt;span class="n"&gt;load_in_4bit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt; &lt;span class="c1"&gt;# Enables 4-bit quantization for reduced memory usage
&lt;/span&gt;
&lt;span class="c1"&gt;# Load the Muse Glimmer 30B model
&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tokenizer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FastLanguageModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;unsloth/muse-glimmer-30b-bnb-4bit&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Uses the 4-bit quantized version
&lt;/span&gt;    &lt;span class="n"&gt;max_seq_length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;max_seq_length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;dtype&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;load_in_4bit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;load_in_4bit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Define your prompt for the agent
&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;As an AI agent, outline a step-by-step plan to research and summarize the latest advancements in quantum computing for a non-technical audience.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;inputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;return_tensors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cuda&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cuda&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_available&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Move to GPU if available, else CPU
&lt;/span&gt;
&lt;span class="c1"&gt;# Generate the agent's response
&lt;/span&gt;&lt;span class="n"&gt;outputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;input_ids&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_ids&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;attention_mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;attention_mask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_new_tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;512&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Control the length of the generated response
&lt;/span&gt;    &lt;span class="n"&gt;use_cache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;skip_special_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script first sets up configuration for loading the model, prioritizing 4-bit quantization to minimize memory footprint. It then loads the &lt;code&gt;unsloth/muse-glimmer-30b-bnb-4bit&lt;/code&gt; model and its tokenizer. We've crafted a prompt that simulates an agentic task to see how Glimmer responds. The &lt;code&gt;model.generate&lt;/code&gt; call processes this input and produces a coherent, contextually relevant output.&lt;/p&gt;

&lt;h3&gt;
  
  
  Things to Watch Out For
&lt;/h3&gt;

&lt;p&gt;While Unsloth makes running large models like Muse Glimmer 30B more accessible, there are a few practical considerations.&lt;/p&gt;

&lt;p&gt;First, performance will still vary significantly based on your hardware. Running a 30B model on a CPU-only system, even with Unsloth's optimizations, will be noticeably slow for any serious agentic workflow. This is the main trade-off: incredible local capability, but at the expense of speed without a decent GPU. For interactive agentic tasks, you really want GPU acceleration.&lt;/p&gt;

&lt;p&gt;Second, dependency conflicts can always creep in. If you're running into installation issues, try isolating your environment with &lt;code&gt;venv&lt;/code&gt; or &lt;code&gt;conda&lt;/code&gt; to prevent conflicts with other Python projects.&lt;/p&gt;

&lt;p&gt;Finally, remember that the model is only one part of a robust AI agent system. In my experience, most AI agent projects break in production not because of the underlying model, but due to weak validation and error handling in the surrounding agentic logic. Make sure you're building in robust checks and fallback mechanisms around the model's outputs, especially when designing for complex, multi-step workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Unsloth Documentation: Muse Glimmer.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Daily AI notes on &lt;a href="https://www.linkedin.com/in/koolkamalkishor/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; — Kamal Kishor&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>llm</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
