configuration: started to implement new format

This commit is contained in:
2023-09-06 22:52:03 +02:00
parent be028d7a00
commit 13c4127827
2 changed files with 53 additions and 21 deletions
+4 -4
View File
@@ -17,8 +17,9 @@ class OpenAI(AI):
The OpenAI AI client.
"""
def __init__(self, name: str, config: OpenAIConfig) -> None:
self.name = name
def __init__(self, config: OpenAIConfig) -> None:
self.ai_type = config.ai_type
self.name = config.name
self.config = config
def request(self,
@@ -31,8 +32,7 @@ class OpenAI(AI):
chat history. The nr. of requested answers corresponds to the
nr. of messages in the 'AIResponse'.
"""
# FIXME: use real 'system' message (store in OpenAIConfig)
oai_chat = self.openai_chat(chat, "system", question)
oai_chat = self.openai_chat(chat, self.config.system, question)
response = openai.ChatCompletion.create(
model=self.config.model,
messages=oai_chat,