Allow more complex provider setup in test
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3494192. --> Reported by: [andrewbelcher](https://www.drupal.org/user/655282) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/ai/issues/3493865" title="Status: Closed (fixed)">#3493865: Provide a framework for testing with real providers</a></span> introduces the ability to create tests that can be run against various providers. However, as highlighted in <a href="https://git.drupalcode.org/project/ai/-/merge_requests/338#note_428275">review</a>, some providers require more complex set up than just a module and API key.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Test with the Azure or AWS Bedrock providers.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Add a new, optional attribute for AI providers to use. <code>\Drupal\Tests\ai\AiLlm\AiProviderTestBase::getProvider</code> (between enabling the auth set/guessed modules and instantiating the provider) would then use this to perform additional set up. This attribute would have (all optional):</p> <ul> <li>Modules to enable</li> <li>Entity schema to install</li> <li>Config to install</li> <li>A callback to provide additional setup, which received the env set auth array, the desired provider/model, and the container.</li> </ul> <h3 id="summary-api-changes">API changes</h3> <p>A new, optional attribute and use of that in the test.</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>N/A</p> > Related issue: [Issue #3493865](https://www.drupal.org/node/3493865)
issue