Spaces:
Runtime error
Runtime error
Akilesh
commited on
Commit
•
c6d2ec1
1
Parent(s):
d5fdaa0
system prompt
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import os
|
2 |
import logging
|
3 |
from dotenv import load_dotenv
|
@@ -22,11 +23,16 @@ I am Akilesh, your assistant for question-answering tasks! I'll respond as if yo
|
|
22 |
"""
|
23 |
|
24 |
# Create a PromptTemplate with the custom system prompt
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
)
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
|
32 |
# Initialize the ChatOpenAI model
|
|
|
1 |
+
from langchain.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate
|
2 |
import os
|
3 |
import logging
|
4 |
from dotenv import load_dotenv
|
|
|
23 |
"""
|
24 |
|
25 |
# Create a PromptTemplate with the custom system prompt
|
26 |
+
|
27 |
+
system_template = SystemMessagePromptTemplate.from_template(
|
28 |
+
CUSTOM_SYSTEM_PROMPT)
|
29 |
+
human_template = HumanMessagePromptTemplate.from_template(
|
30 |
+
"Context: {context}\n\nQuestion: {question}")
|
31 |
+
|
32 |
+
prompt_template = ChatPromptTemplate.from_messages([
|
33 |
+
system_template,
|
34 |
+
human_template
|
35 |
+
])
|
36 |
|
37 |
|
38 |
# Initialize the ChatOpenAI model
|