Update utils/helper.py
Browse files- utils/helper.py +3 -2
utils/helper.py
CHANGED
@@ -3,10 +3,11 @@ from openai import OpenAI
|
|
3 |
|
4 |
|
5 |
class ChatBot:
|
6 |
-
def __init__(self, protocol: str = "You are a helpful assistant."):
|
7 |
self.client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
8 |
self.protocol = protocol
|
9 |
-
self.
|
|
|
10 |
|
11 |
def generate_response(self, prompt: str) -> str:
|
12 |
self.history.append({"role": "user", "content": prompt})
|
|
|
3 |
|
4 |
|
5 |
class ChatBot:
|
6 |
+
def __init__(self, protocol: str = "You are a helpful assistant.", conversation: list[dict]):
|
7 |
self.client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
8 |
self.protocol = protocol
|
9 |
+
self.conversation = conversation
|
10 |
+
self.history = [{"role": "system", "content": self.protocol}] + self.conversation
|
11 |
|
12 |
def generate_response(self, prompt: str) -> str:
|
13 |
self.history.append({"role": "user", "content": prompt})
|