20 lines
538 B
Python
20 lines
538 B
Python
# services/llm/base.py
|
|
"""
|
|
Base class for LLM services
|
|
"""
|
|
from abc import ABC, abstractmethod
|
|
import json
|
|
from typing import List, Union, Dict, Any
|
|
|
|
class LLMService(ABC):
|
|
"""Abstract base class for LLM services"""
|
|
|
|
@abstractmethod
|
|
def generate_text(self, prompt: str) -> str:
|
|
"""Generate text based on a prompt"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_similarity_scores(self, texts_pairs: Dict[str, List[str]]) -> List[float]:
|
|
"""Calculate similarity scores for pairs of texts"""
|
|
pass |