File size: 1,262 Bytes
d69447e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Base provider interface for AI providers
"""

from abc import ABC, abstractmethod
from typing import Tuple, List, Dict


class AIProvider(ABC):
    """Abstract base class for AI providers"""

    @abstractmethod
    def is_available(self) -> bool:
        """Check if the provider is available (API key configured)"""
        pass

    @abstractmethod
    def get_status(self) -> str:
        """Get status message for UI"""
        pass

    @abstractmethod
    def get_provider_name(self) -> str:
        """Get provider name (e.g., 'Claude', 'Gemini')"""
        pass

    @abstractmethod
    def get_model_name(self) -> str:
        """Get model name (e.g., 'claude-3-5-sonnet-20241022')"""
        pass

    @abstractmethod
    def process_message(
        self,
        user_message: str,
        conversation
    ) -> Tuple[str, List[Dict]]:
        """
        Process user message and return AI response

        Args:
            user_message: User's message
            conversation: ConversationManager instance

        Returns:
            Tuple of (assistant_response, tool_calls_made)
        """
        pass

    @abstractmethod
    def get_welcome_message(self) -> str:
        """Get welcome message for new conversations"""
        pass