LiKenun commited on
Commit
de6924a
·
1 Parent(s): a60b3fc

Re-enable language model for answering questions; remove mock answer

Browse files
src/ctp_slack_bot/services/language_model_service.py CHANGED
@@ -45,12 +45,11 @@ class LanguageModelService(BaseModel):
45
 
46
  Please answer the Student Question based on the Context from class materials and transcripts. If the context doesn’t contain relevant information, acknowledge that and suggest asking the professor."""}
47
  ]
48
- # response: ChatCompletion = self._open_ai_client.chat.completions.create(
49
- # model=self.settings.CHAT_MODEL,
50
- # messages=messages,
51
- # max_tokens=self.settings.MAX_TOKENS,
52
- # temperature=self.settings.TEMPERATURE
53
- # )
54
 
55
- # return response.choices[0].message.content
56
- return f"A mock response to “{question}”"
 
45
 
46
  Please answer the Student Question based on the Context from class materials and transcripts. If the context doesn’t contain relevant information, acknowledge that and suggest asking the professor."""}
47
  ]
48
+ response: ChatCompletion = self._open_ai_client.chat.completions.create(
49
+ model=self.settings.CHAT_MODEL,
50
+ messages=messages,
51
+ max_tokens=self.settings.MAX_TOKENS,
52
+ temperature=self.settings.TEMPERATURE
53
+ )
54
 
55
+ return response.choices[0].message.content