laravel/ai

Add Per-provider model configuration for failover

Fermée

#182 ouverte le 18 févr. 2026

 (2 commentaires) (6 réactions) (0 personne assignée)PHP (261 forks)github user discovery
enhancementhelp wanted

Métriques du dépôt

Stars
 (978 étoiles)
Métriques de merge PR
 (Merge moyen 6j 11h) (49 PRs mergées en 30 j)

Description

Problem

When using multiple providers as failover, there's no way to specify a different model per provider. Each provider typically requires its own model identifier (e.g. gpt-5-mini for OpenAI, mistral-large-latest for Mistral), but the current API only accepts a single model value.

Current behavior

Via attributes:

#[Provider([Lab::OpenAI, Lab::Mistral])]
#[Model('gpt-5-mini')]
class WorkoutProgrammerAgent implements Agent, Conversational, HasTools

#[Model] only accepts one value — there's no way to map a model to each provider.

Via prompt method:

(new WorkoutProgrammerAgent($workoutPlan))
    ->prompt((string) $prompt, provider: [Lab::OpenAI, Lab::Mistral], model: 'gpt-5-mini');

Same limitation — model is a single string with no per-provider mapping.

Expected behavior

Something like:

#[Provider([Lab::OpenAI, Lab::Mistral])]
#[Model(['gpt-5-mini', 'mistral-large-latest'])]

or:

->prompt($prompt, provider: [
    Lab::OpenAI => 'gpt-5-mini',
    Lab::Mistral => 'mistral-large-latest',
]);

Guide contributeur