15 lines
430 B
Python
15 lines
430 B
Python
from typing import Callable, Iterator
|
|
from abc import ABC, abstractmethod
|
|
|
|
class LlmEngine(ABC):
|
|
@abstractmethod
|
|
def infer(self, system_prompt: str, main_context: str, should_stop: Callable[[], bool] = lambda: False) -> Iterator[str]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def token_count(self, system_prompt: str, main_context: str) -> int:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def token_limit(self) -> int:
|
|
pass |