Create base.py
Browse files
prompt_injection/evaluators/base.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from abc import ABC, abstractmethod
|
| 3 |
+
from ast import List
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class PromptEvaluator(ABC):
|
| 7 |
+
@abstractmethod
|
| 8 |
+
def eval_sample(self,sample):
|
| 9 |
+
pass
|
| 10 |
+
@abstractmethod
|
| 11 |
+
def get_name(self):
|
| 12 |
+
pass
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def eval_batch(self,sample_list:List):
|
| 16 |
+
for sample in sample_list:
|
| 17 |
+
self.eval_sample(sample)
|