File size: 785 Bytes
5009cb8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Translation service interface."""

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from ..models.translation_request import TranslationRequest
    from ..models.text_content import TextContent


class ITranslationService(ABC):
    """Interface for translation services."""
    
    @abstractmethod
    def translate(self, request: 'TranslationRequest') -> 'TextContent':
        """
        Translate text from source language to target language.
        
        Args:
            request: The translation request containing text and language info
            
        Returns:
            TextContent: The translated text
            
        Raises:
            TranslationFailedException: If translation fails
        """
        pass