param-bharat
commited on
Upload NLIScorer
Browse files- pipeline.py +4 -5
pipeline.py
CHANGED
@@ -20,10 +20,7 @@ class NLIInstruction(BaseModel):
|
|
20 |
|
21 |
def format_chat_history(self, chat_history: list[dict[str, str]]) -> str:
|
22 |
return "\n".join(
|
23 |
-
[
|
24 |
-
f"### Background\n{message['role']}: {message['content']}"
|
25 |
-
for message in chat_history
|
26 |
-
]
|
27 |
)
|
28 |
|
29 |
@property
|
@@ -32,7 +29,9 @@ class NLIInstruction(BaseModel):
|
|
32 |
if self.Context:
|
33 |
base_template += f"### Context\n{self.Context}\n"
|
34 |
if self.ChatHistory:
|
35 |
-
base_template +=
|
|
|
|
|
36 |
if self.Prompt:
|
37 |
base_template += f"### Prompt\n{self.Prompt}\n"
|
38 |
if self.Completion:
|
|
|
20 |
|
21 |
def format_chat_history(self, chat_history: list[dict[str, str]]) -> str:
|
22 |
return "\n".join(
|
23 |
+
[f"{message['role']}: {message['content']}" for message in chat_history]
|
|
|
|
|
|
|
24 |
)
|
25 |
|
26 |
@property
|
|
|
29 |
if self.Context:
|
30 |
base_template += f"### Context\n{self.Context}\n"
|
31 |
if self.ChatHistory:
|
32 |
+
base_template += (
|
33 |
+
f"### Background\n{self.format_chat_history(self.ChatHistory)}\n"
|
34 |
+
)
|
35 |
if self.Prompt:
|
36 |
base_template += f"### Prompt\n{self.Prompt}\n"
|
37 |
if self.Completion:
|