Normalize Structured responses
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3492869. -->
Reported by: [marcus_johansson](https://www.drupal.org/user/385947)
Related to !457
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>We have an initial version of function calling, we should perhaps also build structured responses while we are at it since they share a lot of features - a function call in the end is just another way of getting JSON back.</p>
<p>For more reading:<br>
<a href="https://ollama.com/blog/structured-outputs">https://ollama.com/blog/structured-outputs</a><br>
<a href="https://platform.openai.com/docs/guides/structured-outputs">https://platform.openai.com/docs/guides/structured-outputs</a><br>
<a href="https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency">https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency</a><br>
<a href="https://docs.fireworks.ai/structured-responses/structured-response-formatting">https://docs.fireworks.ai/structured-responses/structured-response-formatting</a></p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Add a normalization layer for this.<br>
Add a validation layer for this.<br>
See how much it can work as function calling</p>
<h3 id="summary-problem-motivation">Why this matters? (Written by Claude)</h3>
<p>This enhancement will make AI features in Drupal more reliable and easier to use for everyone. Currently, when AI performs tasks on a Drupal site (like creating content or organizing information), it sometimes responds in unpredictable ways that require technical expertise to handle. By adding structured responses:</p>
<ol>
<li>Content creators and site managers can trust that AI-powered features will work consistently. For example, when asking an AI to create a new blog post type, you'll get exactly the fields and settings you need, not a mix of formats that might break.</li>
<li>Developers can spend less time fixing AI response formats and more time building useful features. It's like establishing a common language between Drupal and AI systems, making integration smoother.</li>
<li>The Drupal community can build more sophisticated AI tools that work together reliably. This means better content creation, smarter search capabilities, and more automated site management tasks that actually work as expected.</li>
</ol>
<p>This improvement will help Drupal stay competitive in the CMS space by making AI features more accessible to non-technical users while giving developers a solid foundation to build upon. It's a crucial step in making AI practical and dependable for everyday Drupal use, rather than just an experimental feature.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue