fixed openai
This commit is contained in:
@@ -16,7 +16,8 @@ class ChatGPTTelegramInferenceBot(BaseTelegramInferenceBot):
|
|||||||
response = self.client.chat.completions.create(
|
response = self.client.chat.completions.create(
|
||||||
model=self.model,
|
model=self.model,
|
||||||
messages=[{"role": "system", "content": self.system_prompt}] + messages,
|
messages=[{"role": "system", "content": self.system_prompt}] + messages,
|
||||||
tools=self.functions,
|
functions=self.functions,
|
||||||
|
function_call="auto",
|
||||||
max_tokens=self.max_tokens
|
max_tokens=self.max_tokens
|
||||||
)
|
)
|
||||||
return response
|
return response
|
||||||
@@ -32,7 +33,7 @@ class ChatGPTTelegramInferenceBot(BaseTelegramInferenceBot):
|
|||||||
|
|
||||||
tool_calls = []
|
tool_calls = []
|
||||||
assistant_message = {}
|
assistant_message = {}
|
||||||
|
|
||||||
for message_part in response.choices:
|
for message_part in response.choices:
|
||||||
if message_part.finish_reason == "function_call":
|
if message_part.finish_reason == "function_call":
|
||||||
tool_calls.append(message_part.message.function_call)
|
tool_calls.append(message_part.message.function_call)
|
||||||
|
|||||||
Reference in New Issue
Block a user