Files
kupshop/bundles/KupShop/LLMBundle/LlmProviders/AbstractLlmProvider.php
2025-08-02 16:30:27 +02:00

32 lines
873 B
PHP

<?php
namespace KupShop\LLMBundle\LlmProviders;
use KupShop\LLMBundle\Dto\PromptResponseStats;
use KupShop\LLMBundle\Dto\TextPromptInput;
use Psr\Http\Message\StreamInterface;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
#[AutoconfigureTag('kupshop.llm.provider')]
abstract class AbstractLlmProvider
{
protected const LABEL = '_override';
protected ?PromptResponseStats $lastResponseStats = null;
abstract public function getResponse(TextPromptInput $prompt): string;
abstract public function getStreamedResponse(TextPromptInput $prompt): StreamInterface;
abstract public function setModel(string $model): void;
public static function getLabel(): string
{
return static::LABEL;
}
public function getLastResponseStats(): ?PromptResponseStats
{
return $this->lastResponseStats;
}
}