Instructions to use deepcode-ai/Prompt-Injection-LLM01 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Adapters
How to use deepcode-ai/Prompt-Injection-LLM01 with Adapters:
from adapters import AutoAdapterModel model = AutoAdapterModel.from_pretrained("undefined") model.load_adapter("deepcode-ai/Prompt-Injection-LLM01", set_active=True) - Notebooks
- Google Colab
- Kaggle
Create base.py
Browse files
prompt_injection/mutators/base.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python program showing
|
| 2 |
+
# abstract base class work
|
| 3 |
+
from abc import ABC, abstractmethod
|
| 4 |
+
from typing import List
|
| 5 |
+
|
| 6 |
+
class PromptMutator(ABC):
|
| 7 |
+
|
| 8 |
+
@abstractmethod
|
| 9 |
+
def mutate(self,sample:str)->str:
|
| 10 |
+
raise NotImplementedError
|
| 11 |
+
|
| 12 |
+
@abstractmethod
|
| 13 |
+
def get_name(self):
|
| 14 |
+
raise NotImplementedError
|
| 15 |
+
|
| 16 |
+
def mutate_batch(self,sample_list:List):
|
| 17 |
+
for sample in sample_list:
|
| 18 |
+
self.mutate_sample(sample)
|