PHP AI Breniapp

Tenant-Specific AI Models: Removing the Guesswork

The Breniapp platform now offers per-tenant AI model assignments, providing more control and predictability in generation flows.

Previously, the system relied on a fallback mechanism to select an AI model. This could lead to inconsistent results and required users to manually pick a model for each generation. The new approach eliminates this ambiguity by allowing administrators to explicitly assign models to tenants.

The Problem with Fallbacks

The old logic followed a chain: try the first active model, then the global default, then the configuration. This 'first active model' approach, while seemingly convenient, had drawbacks:

  • Unpredictability: The "first" model could change, leading to unexpected variations in output.
  • Limited Control: Administrators lacked fine-grained control over which models were used for specific tenants.
  • User Burden: Users were sometimes prompted to select a model, disrupting the generation flow.

Tenant-Specific Model Assignments

The solution involves assigning text, image, and video models directly to tenants via the TenantResource admin panel. This ensures that each tenant consistently uses the assigned models, leading to more predictable and controlled AI generation.

The model resolution logic now follows a clear hierarchy:

  1. Tenant Override: The model explicitly assigned to the tenant.
  2. Global Default: A default model set at the global level.
  3. Configuration: A fallback specified in the application's configuration.

The "first active model" fallback has been removed, streamlining the process.

Code Illustration

Consider a simplified example of how model selection might work:

class ModelResolver
{
    public function getModelForTenant(Tenant $tenant, string $type):
    string
    {
        if ($tenant->hasModelOverride($type)) {
            return $tenant->getModelOverride($type);
        }

        if (config('app.default_model')) {
            return config('app.default_model');
        }

        return 'fallback_model';
    }
}

Benefits

  • Increased Predictability: Consistent model usage for each tenant.
  • Improved Control: Administrators can precisely manage model assignments.
  • Simplified User Experience: No more manual model selection for users.

The per-tenant AI model assignment feature enhances the Breniapp platform by providing greater control, predictability, and a more streamlined user experience for AI generation.

Tenant-Specific AI Models: Removing the Guesswork
GERARDO RUIZ

GERARDO RUIZ

Author

Share: