25 lines
485 B
Python
25 lines
485 B
Python
from typing import Protocol
|
|
|
|
|
|
class AIClientError(RuntimeError):
|
|
"""Raised when the configured AI provider cannot complete a request."""
|
|
|
|
|
|
class AIClient(Protocol):
|
|
provider: str
|
|
display_name: str
|
|
|
|
async def list_models(self) -> list[str]:
|
|
...
|
|
|
|
def normalize_model(self, model: str) -> str:
|
|
...
|
|
|
|
async def chat(
|
|
self,
|
|
model: str,
|
|
messages: list[dict[str, str]],
|
|
json_mode: bool = False,
|
|
) -> str:
|
|
...
|