mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
Introduce the AI provider layer: laravel/ai SDK integration, AiService and AiExtractionService, the AiProvider enum (OpenAI, Gemini, Ollama) and supporting DTOs/agents. - Encrypt stored API keys; per-provider test-connection action - Ollama model dropdown with reachability-based connection test - Multi-provider settings UI with per-row test and auto-migration of the legacy single-provider shape into the multi-provider structure - Resolve active config through AiProviderConfigDto
35 lines
707 B
PHP
35 lines
707 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use Laravel\Ai\Enums\Lab;
|
|
|
|
enum AiProvider: string
|
|
{
|
|
case OpenAI = 'openai';
|
|
case Anthropic = 'anthropic';
|
|
case Ollama = 'ollama';
|
|
case Gemini = 'gemini';
|
|
|
|
/**
|
|
* Map this provider to the Laravel AI SDK provider enum.
|
|
*/
|
|
public function toLab(): Lab
|
|
{
|
|
return match ($this) {
|
|
self::OpenAI => Lab::OpenAI,
|
|
self::Anthropic => Lab::Anthropic,
|
|
self::Ollama => Lab::Ollama,
|
|
self::Gemini => Lab::Gemini,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The config key for this provider under `config('ai.providers.*')`.
|
|
*/
|
|
public function driver(): string
|
|
{
|
|
return $this->value;
|
|
}
|
|
}
|