File size: 886 Bytes
1e23279
 
 
6851411
 
 
1e23279
 
 
 
 
 
6851411
1e23279
 
 
 
 
6851411
1e23279
6851411
1e23279
 
 
 
 
 
 
 
 
6851411
 
 
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
"""Base protocol for LLM providers."""

from typing import Any, Dict, Protocol


class LLMProvider(Protocol):
    """Protocol defining the interface for LLM providers.
    
    Any class implementing this protocol must provide async methods
    for listing models and generating chat completions.
    """
    
    async def list_models(self) -> Dict[str, Any]:
        """List available models.
        
        Returns:
            Dictionary containing model information.
        """
        ...
    
    async def chat(self, payload: Dict[str, Any], stream: bool = False) -> Any:
        """Generate chat completion.
        
        Args:
            payload: Request payload containing messages and parameters
            stream: Whether to stream the response
            
        Returns:
            Chat completion response (varies by implementation)
        """
        ...