Regression: setting a parameter empty class breaks certain models in LiteLLM
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3572765. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !1179 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>[One-line status update for stakeholders]<br> <strong>Short Description: </strong>[One-line issue summary for stakeholders]<br> <strong>Check-in Date: </strong>MM/DD/YYYY<br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>In <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/ai/issues/3567784" title="Status: Closed (fixed)">#3567784: Tools Function Input should give back an empty json schema skeleton</a></span> we introduced and fixed a bug where the default parameters where not following proper standards. This caused issues in the Mistral client, Mistral on LiteLLM and Ollama for certain models. Even if there was thourough testing, we did not see that different models in LiteLLM doesn't work the same.</p> <p>This fix seems to have caused regression on Claude Bedrock models when using LiteLLM. It gives a validation error.</p> <p>The idea was to move parameter less functions from:</p> <pre>{<br>&nbsp; "name": "reindex_content",<br>&nbsp; "description": "Rebuilds the site search index.",<br>&nbsp; "parameters": {<br>&nbsp;&nbsp;&nbsp; "type": "object",<br>&nbsp;&nbsp;&nbsp; "additionalProperties": false<br>&nbsp; }<br>}</pre><p>to</p> <pre>{<br>&nbsp; "name": "reindex_content",<br>&nbsp; "description": "Rebuilds the site search index.",<br>&nbsp; "parameters": {<br>&nbsp;&nbsp;&nbsp; "type": "object",<br>&nbsp;&nbsp;&nbsp; "properties": {},<br>&nbsp;&nbsp;&nbsp; "additionalProperties": false<br>&nbsp; }<br>}</pre><p>This was introduced in 1.2.6 and caused this regression. Its actually not following correct <a href="https://community.openai.com/t/on-the-function-calling-what-about-if-i-have-no-parameter-to-call/516876/4">standards</a>, but instead the solution should be</p> <pre>{<br>&nbsp; "name": "reindex_content",<br>&nbsp; "description": "Rebuilds the site search index.",<br>&nbsp; "parameters": {<br>&nbsp;&nbsp;&nbsp; "type": "object",<br>&nbsp;&nbsp;&nbsp; "properties": {},<br>&nbsp;&nbsp;&nbsp; "required": []<br>&nbsp; }<br>}</pre><p>However this breaks certain models (Mistral) from the happy path, when there are parameters.</p> <p>@narendrar suggested this:</p> <pre>{<br>&nbsp; "name": "reindex_content",<br>&nbsp; "description": "Rebuilds the site search index.",<br>&nbsp; "parameters": null<br>}</pre><p>We have tested that so far with LiteLLM (mistral, claude), OpenAI, Anthropic, Ollama (llama3.1) and Mistral (mistral-medium) and it seems to work well in both parameter function and parameter less function.</p> <h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4> <p>Setup LiteLLM with Claude (you can use Amazee)<br> In the AI Test module there is a parameter less trigger function.<br> Try to use that, it will give back an exception.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Change to null instead of stdClass.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3>Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)</h3> <h3 id="summary-ai-usage">AI usage (if applicable)</h3> <p>[ ] AI Assisted Issue<br> This issue was generated with AI assistance, but was reviewed and refined by the creator.</p> <p>[ ] AI Assisted Code<br> This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.</p> <p>[ ] AI Generated Code<br> This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.</p> <p>[ ] Vibe Coded<br> This code was generated by an AI and has only been functionally tested.</p>
issue