Update chat.py
Browse files
chat.py
CHANGED
@@ -98,8 +98,14 @@ def make_completion(input:str, history: List[Message]) -> Optional[str]:
|
|
98 |
)
|
99 |
}]
|
100 |
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
try:
|
104 |
|
105 |
response = client.chat.completions.create(
|
|
|
98 |
)
|
99 |
}]
|
100 |
|
101 |
+
# We hold up to 10 messages at most in the context window. After this point
|
102 |
+
# conversations are stateless
|
103 |
+
|
104 |
+
if len(history) < 10:
|
105 |
+
prompt = [{'role':'system', 'content': qna_system_message}] + history + user_message
|
106 |
+
else:
|
107 |
+
prompt = [{'role':'system', 'content': qna_system_message}] + user_message
|
108 |
+
|
109 |
try:
|
110 |
|
111 |
response = client.chat.completions.create(
|