eagle0504 commited on
Commit
0db9e34
·
verified ·
1 Parent(s): 4e0ea16

Update utils/helper.py

Browse files
Files changed (1) hide show
  1. 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.history = [{"role": "system", "content": self.protocol}]
 
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})