-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathabstracts.py
More file actions
39 lines (30 loc) · 1.07 KB
/
abstracts.py
File metadata and controls
39 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from abc import ABC, abstractmethod
from typing import Union, Any, Iterable
from swagger_client.models import State, Action, AlignmentTarget
class ActionBasedADM(ABC):
@abstractmethod
def choose_action(self,
scenario_state: State,
available_actions: list[Action],
alignment_target: Union[type[AlignmentTarget], None],
**kwargs) -> Union[Action, tuple[Action, dict]]:
pass
class StructuredInferenceEngine(ABC):
@abstractmethod
def dialog_to_prompt(self, dialog: list[dict]) -> str:
pass
@abstractmethod
def run_inference(self, prompts: Union[str, list[str]],
schema: str) -> Union[dict, list[dict]]:
pass
class ADMComponent(ABC):
@abstractmethod
def run(self, *args, **kwargs) -> Any:
pass
@abstractmethod
def run_returns(self) -> Union[str, Iterable[str]]:
'''
This method should return string identifiers for each of the
returns expect from the `run` method
'''
pass