Skip to content

Commit

Permalink
🐛 Bug: Fix the bug where tools continue to be called when the tools j…
Browse files Browse the repository at this point in the history
…son returned by OpenAI is empty.

💻 Code: Upgrade ModelMerge version to 0.11.45
  • Loading branch information
yym68686 committed Sep 27, 2024
1 parent 1b1e685 commit 564e02c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="modelmerge",
version="0.11.44",
version="0.11.45",
description="modelmerge is a multi-large language model API aggregator.",
long_description=Path.open(Path("README.md"), encoding="utf-8").read(),
long_description_content_type="text/markdown",
Expand Down
4 changes: 2 additions & 2 deletions src/ModelMerge/models/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def ask_stream(
self.function_calls_counter[function_call_name] = 1
else:
self.function_calls_counter[function_call_name] += 1
if self.function_calls_counter[function_call_name] <= self.function_call_max_loop:
if self.function_calls_counter[function_call_name] <= self.function_call_max_loop and function_full_response != {}:
function_call_max_tokens = self.truncate_limit - message_token["total"] - 1000
if function_call_max_tokens <= 0:
function_call_max_tokens = int(self.truncate_limit / 2)
Expand Down Expand Up @@ -775,7 +775,7 @@ async def ask_stream_async(
self.function_calls_counter[function_call_name] = 1
else:
self.function_calls_counter[function_call_name] += 1
if self.function_calls_counter[function_call_name] <= self.function_call_max_loop:
if self.function_calls_counter[function_call_name] <= self.function_call_max_loop and function_full_response != {}:
function_call_max_tokens = self.truncate_limit - message_token["total"] - 1000
if function_call_max_tokens <= 0:
function_call_max_tokens = int(self.truncate_limit / 2)
Expand Down

0 comments on commit 564e02c

Please sign in to comment.