mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-10 15:12:12 +00:00
Introduced subsystem to configure AI providers and allow services to select them dynamiclly
This commit is contained in:
parent
c0017d29a7
commit
2631ff4bee
10 changed files with 342 additions and 5 deletions
|
|
@ -25,6 +25,8 @@ declare(strict_types=1);
|
|||
namespace App\Services\InfoProviderSystem\Providers;
|
||||
|
||||
use App\Exceptions\ProviderIDNotSupportedException;
|
||||
use App\Services\AI\AIPlatformRegistry;
|
||||
use App\Services\AI\AIPlatforms;
|
||||
use App\Services\InfoProviderSystem\DTOJsonSchemaConverter;
|
||||
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
||||
use App\Settings\InfoProviderSystem\AIExtractorSettings;
|
||||
|
|
@ -45,8 +47,7 @@ final class AIInfoExtractor implements InfoProviderInterface
|
|||
public function __construct(
|
||||
HttpClientInterface $httpClient,
|
||||
private readonly AIExtractorSettings $settings,
|
||||
#[Autowire(service: "ai.traceable_platform.openrouter")]
|
||||
private readonly PlatformInterface $aiPlatform,
|
||||
private readonly AIPlatformRegistry $AIPlatformRegistry,
|
||||
private readonly DTOJsonSchemaConverter $jsonSchemaConverter,
|
||||
) {
|
||||
$this->httpClient = $httpClient->withOptions([
|
||||
|
|
@ -171,8 +172,10 @@ final class AIInfoExtractor implements InfoProviderInterface
|
|||
);
|
||||
|
||||
try {
|
||||
$aiPlatform = $this->AIPlatformRegistry->getPlatform(AIPlatforms::OPENROUTER);
|
||||
|
||||
//'openai/gpt-5-mini'
|
||||
$result = $this->aiPlatform->invoke('openrouter/auto', $input, [
|
||||
$result = $aiPlatform->invoke('openrouter/auto', $input, [
|
||||
'response_format' => 'json_schema',
|
||||
'json_schema' => $this->jsonSchemaConverter->getJSONSchema(),
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue