Skip to content

Fix config array default causing driver resolution failure#327

Draft
JoshSalway wants to merge 2 commits intolaravel:0.xfrom
JoshSalway:fix/issue-289
Draft

Fix config array default causing driver resolution failure#327
JoshSalway wants to merge 2 commits intolaravel:0.xfrom
JoshSalway:fix/issue-289

Conversation

@JoshSalway
Copy link
Copy Markdown

@JoshSalway JoshSalway commented Mar 29, 2026

When config('ai.default') is an array (e.g. ['text' => 'anthropic']), the manager and promptable layer both fail to resolve the provider name correctly, causing "Instance driver [text] is not supported".

Handles array configs by extracting the relevant key in both AiManager::getDefaultInstance() and Promptable::getProvidersAndModels().

Fixes #289

Test plan

  • Set config('ai.default') to an array like ['text' => 'anthropic'] and verify AiManager::getDefaultInstance() resolves the correct provider name instead of throwing "Instance driver [text] is not supported"
  • Set config('ai.default') to a plain string like 'anthropic' and verify existing behavior is unchanged
  • Verify Promptable::getProvidersAndModels() correctly extracts provider names from both string and array default configs
  • Confirm no regressions in the existing test suite with php artisan test

Josh Salway and others added 2 commits March 29, 2026 17:06
When ai.default is an array (e.g. ['text' => 'anthropic']), the manager
crashed because it expected a string. Now extracts the 'text' key from
array defaults, falls back to first value, and throws helpful errors
for invalid configurations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The AiManager fix only covered the Ai::textProvider() path. The
Promptable::getProvidersAndModels() path also reads config('ai.default')
directly and passes it to formatProviderAndModelList(), which would
interpret ['text' => 'anthropic'] as provider='text' model='anthropic'.

This normalizes the array config in Promptable before passing it to
formatProviderAndModelList. Also adds tests for Promptable path,
integer-indexed arrays, and multi-generation-type configs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

config('ai.default') array format causes "Instance driver [text] is not supported" when no provider is passed to prompt()

1 participant