2026-02-26 15:16:06 -08:00
|
|
|
"""Abstract base class for AI providers."""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AIProvider(ABC):
|
|
|
|
|
"""Base interface for all AI providers."""
|
|
|
|
|
|
|
|
|
|
@abstractmethod
|
2026-02-26 16:25:10 -08:00
|
|
|
def chat(self, messages: list[dict[str, str]], **kwargs: Any) -> str:
|
|
|
|
|
"""Send a chat completion request and return the full response text."""
|
2026-02-26 15:16:06 -08:00
|
|
|
...
|
|
|
|
|
|
|
|
|
|
@abstractmethod
|
2026-02-26 16:25:10 -08:00
|
|
|
def is_available(self) -> bool:
|
|
|
|
|
"""Check if this provider is configured and available."""
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
@abstractmethod
|
|
|
|
|
def name(self) -> str:
|
|
|
|
|
"""Provider display name."""
|
2026-02-26 15:16:06 -08:00
|
|
|
...
|