Rom89823974978's picture
Drafting some parts
8521f60
raw
history blame contribute delete
574 Bytes
"""Abstract generator interface."""
from abc import ABC, abstractmethod
from typing import List, Mapping, Any
class Generator(ABC):
"""Base class for text generators."""
@abstractmethod
def generate(
self,
question: str,
contexts: List[str],
*,
max_new_tokens: int = 256,
temperature: float = 0.0,
) -> str:
"""Generate an answer conditioned on question + contexts."""
raise NotImplementedError
@abstractmethod
def __repr__(self) -> str: # noqa: D401
return "Generator()"