Spaces:
Running
Running
Synced repo using 'sync_with_huggingface' Github Action
Browse files
custom_prompt_template.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from typing import List
|
2 |
-
import langchain
|
3 |
-
|
|
|
4 |
"""A custom prompt template for generating instructions."""
|
5 |
|
6 |
input_variables: List[str] = ["num_questions", "context", "instruction_format", "lang", "additional_rules"]
|
@@ -40,4 +41,4 @@ class AnswerGenerationTemplate(langchain.prompts.PromptTemplate):
|
|
40 |
template_format = "f-string"
|
41 |
def format(self, **kwargs):
|
42 |
"""Format the prompt."""
|
43 |
-
return self.template.format(**kwargs)
|
|
|
1 |
from typing import List
|
2 |
+
# import langchain
|
3 |
+
from langchain.prompts import PromptTemplate
|
4 |
+
class InstructionGenerationTemplate(PromptTemplate):
|
5 |
"""A custom prompt template for generating instructions."""
|
6 |
|
7 |
input_variables: List[str] = ["num_questions", "context", "instruction_format", "lang", "additional_rules"]
|
|
|
41 |
template_format = "f-string"
|
42 |
def format(self, **kwargs):
|
43 |
"""Format the prompt."""
|
44 |
+
return self.template.format(**kwargs)
|