Allow stopping of inference
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
from typing import Iterator
|
||||
from typing import Callable, Iterator
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class LlmEngine(ABC):
|
||||
@abstractmethod
|
||||
def infer(self, system_prompt: str, main_context: str) -> Iterator[str]:
|
||||
def infer(self, system_prompt: str, main_context: str, should_stop: Callable[[], bool] = lambda: False) -> Iterator[str]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user