Initial upload: Local AI Commit Reviewer CLI with CI/CD workflow
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-02-05 06:34:39 +00:00
parent 8bcf6f0433
commit 117240b858

45
src/llm/provider.py Normal file
View File

@@ -0,0 +1,45 @@
from abc import ABC, abstractmethod
from collections.abc import AsyncIterator
from dataclasses import dataclass
@dataclass
class LLMResponse:
text: str
model: str
tokens_used: int
finish_reason: str
@dataclass
class ModelInfo:
name: str
size: str
modified: str
digest: str
class LLMProvider(ABC):
@abstractmethod
def is_available(self) -> bool:
pass
@abstractmethod
def generate(self, prompt: str, **kwargs) -> LLMResponse:
pass
@abstractmethod
async def agenerate(self, prompt: str, **kwargs) -> LLMResponse:
pass
@abstractmethod
def stream_generate(self, prompt: str, **kwargs) -> AsyncIterator[str]:
pass
@abstractmethod
def list_models(self) -> list[ModelInfo]:
pass
@abstractmethod
def health_check(self) -> bool:
pass