<?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;
    }
}
