Files
fund-tracer/backend/app/services/llm/base.py

22 lines
681 B
Python
Raw Normal View History

2026-03-09 14:46:56 +08:00
"""Base LLM provider - abstract interface for vision extraction."""
from abc import ABC, abstractmethod
from app.schemas.transaction import TransactionExtractItem
class BaseLLMProvider(ABC):
2026-03-10 14:25:21 +08:00
"""Abstract base for LLM providers. Supports optional model override."""
def __init__(self, model_override: str | None = None):
self._model_override = model_override
2026-03-09 14:46:56 +08:00
@abstractmethod
async def extract_from_image(self, image_bytes: bytes) -> list[TransactionExtractItem]:
2026-03-10 14:25:21 +08:00
pass
@abstractmethod
async def chat(self, system: str, user: str) -> str:
"""Plain text chat (for inference/reasoning tasks like report generation)."""
2026-03-09 14:46:56 +08:00
pass