From c1cfbfa02d197ee9cda2862c1b43db19d6398938 Mon Sep 17 00:00:00 2001 From: T-BENZIN Date: Sun, 16 Mar 2025 16:26:22 +0500 Subject: [PATCH] ~ Fixed the lack of tool calls in assistant message --- reginaldCog/reginald.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reginaldCog/reginald.py b/reginaldCog/reginald.py index b168b11..63468a6 100644 --- a/reginaldCog/reginald.py +++ b/reginaldCog/reginald.py @@ -194,13 +194,14 @@ class ReginaldCog(PermissionsMixin, BlacklistMixin, MemoryMixin, commands.Cog): 'tool_choice': 'auto', } response = await client.chat.completions.create(**completion_args) + # Checking for function calls + tool_calls = response.choices[0].message.tool_calls # Appending response with tool calls messages.append({ 'role': 'assistant', 'content': response.choices[0].message.content, + 'tool_calls': tool_calls }) - # Checking for function calls - tool_calls = response.choices[0].message.tool_calls if tool_calls: for i_call in tool_calls: # Calling for necessary functions