You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
messages= [{"role": "system", "content": "You are a helpful assistant."}]
89
+
messages.extend(self.conversation_history) # Include past conversation history
90
+
91
+
# Prepare the context from the knowledge base
92
+
system_message= {
93
+
"role": "system",
94
+
"content": (
91
95
"You are a dedicated assistant designed to provide positive answers about Defang. "
92
-
"When the user says 'you', 'your', or any pronoun, interpret it as referring to Defang with context of Defang also. "
96
+
"When the user says 'you', 'your', or any pronoun, interpret it as referring to Defang with context of Defang. "
93
97
"If the user's question involves comparisons with or references to other services, you may use external knowledge. "
94
98
"However, if the question is strictly about Defang, you must ignore all external knowledge and only utilize the given context. "
95
-
"When generating the answer, please put the answer first and the justification later. "
96
-
"Any mentions of BYOD means BRING YOUR OWN DOMAIN and NOT BRING YOUR OWN DEVICE."
97
-
"Your objective is to remain strictly within the confines of the given context unless comparisons to other services are explicitly mentioned. "
98
-
"Although this rarely happens, if the prompt is not related to defang reply with prompt out of scope. If the prompt contains the word `defang` proceed with answering"
99
-
"\n\nContext:\n"+context+"\n\n"
100
-
"User Question: "+query+"\n\n"
101
-
"Answer:"
99
+
"Context: "+context
102
100
)
101
+
}
102
+
103
+
messages.append(system_message)
103
104
105
+
try:
104
106
response=openai.ChatCompletion.create(
105
107
model="gpt-4-turbo",
106
-
messages=[
107
-
{"role": "system", "content": "You are a helpful assistant."},
0 commit comments