from analogai.deepthink.infrastructure.gateways.llm.llm_factory import LlmGatewayFactory
from analogai.deepthink.infrastructure.prompts.builders.sentence_transformer_prompt_builder import (
    build_sentence_transformer_prompt,
)
from analogai.deepthink.presentation.preprocessing.previous_messages_stack import PreviousMessagesStack
from analogai.deepthink.presentation.preprocessing.preprocessors.llm.sentence_transformer_service import (
    SentenceTransformerService,
)


def get_sentence_transformer():
    return transform_sentence_with_llm


def _default_sentence_transformer_service() -> SentenceTransformerService:
    return SentenceTransformerService(
        gateway_factory=LlmGatewayFactory.create_sentence_decomposer_and_transformer,
        prompt_provider=build_sentence_transformer_prompt,
    )


def transform_sentence_with_llm(text: str, previous_messages_stack: PreviousMessagesStack) -> str:
    service = _default_sentence_transformer_service()
    return service.transform(text, previous_messages_stack)


if __name__ == "__main__":
    print(build_sentence_transformer_prompt())
