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
26 lines
998 B
PHP
26 lines
998 B
PHP
<?php
|
|
|
|
use App\Enums\AiProvider;
|
|
use Laravel\Ai\Enums\Lab;
|
|
|
|
it('has the expected string value for every case', function () {
|
|
expect(AiProvider::OpenAI->value)->toBe('openai')
|
|
->and(AiProvider::Anthropic->value)->toBe('anthropic')
|
|
->and(AiProvider::Ollama->value)->toBe('ollama')
|
|
->and(AiProvider::Gemini->value)->toBe('gemini');
|
|
});
|
|
|
|
it('maps each provider to the matching SDK lab', function () {
|
|
expect(AiProvider::OpenAI->toLab())->toBe(Lab::OpenAI)
|
|
->and(AiProvider::Anthropic->toLab())->toBe(Lab::Anthropic)
|
|
->and(AiProvider::Ollama->toLab())->toBe(Lab::Ollama)
|
|
->and(AiProvider::Gemini->toLab())->toBe(Lab::Gemini);
|
|
});
|
|
|
|
it('exposes the config driver key for each provider', function () {
|
|
expect(AiProvider::OpenAI->driver())->toBe('openai')
|
|
->and(AiProvider::Anthropic->driver())->toBe('anthropic')
|
|
->and(AiProvider::Ollama->driver())->toBe('ollama')
|
|
->and(AiProvider::Gemini->driver())->toBe('gemini');
|
|
});
|