Spaces:
Sleeping
Sleeping
"""Abstract generator interface.""" | |
from abc import ABC, abstractmethod | |
from typing import List, Mapping, Any | |
class Generator(ABC): | |
"""Base class for text generators.""" | |
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 | |
def __repr__(self) -> str: # noqa: D401 | |
return "Generator()" | |