You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
This is an intermittent problem and hard to reproduce with exact steps.
To Reproduce
Steps to reproduce the behavior:
The "chat_completion.get_chat_message_contents" function call sometimes just returns with a tool_calls message but without calling the plugin's functions described in the tool_calls. The chat history indicates that the last message added is a "tool_calls" but no function result message is added afterwards.
Expected behavior
Since there's a tool calls, the expected behavior is that the function call workflow proceeds as expected with a function call and a function result, but then all I get is a tool_calls message from "chat_completion.get_chat_message_contents"
result = (await self.chat_completion.get_chat_message_contents(
chat_history=self.history,
settings=self.execution_settings,
kernel=self.kernel,
arguments=KernelArguments(),
temperature=0.2
))[0]
When inspecting the results above, the get_chat_message_contents is returning without calling the plugin's functions:
Screenshots
Screenshot below showing that the call to get_chat_message_contents just returned with an empty string, because the ChatMessageContent is a function call "tool_calls".
print("Assistant > " + str(result))
And that the call to the filter did not happen.
Platform
SK: semantic-kernel 1.8.3 python package
OS: Windows
IDE: VS Code
Language: Python
Update:
The following block of code is a temp fix of this problem:
counter = 0
while True:
print(f"-------------- Attempting response {counter}")
result = (await self.chat_completion.get_chat_message_contents(
chat_history=self.history,
settings=self.execution_settings,
kernel=self.kernel,
arguments=KernelArguments(),
temperature=0.2
))[0]
if result.finish_reason == 'tool_calls':
self.history.add_message(result)
function_results = []
foritemin result.items:
content = await self.kernel.plugins[item.plugin_name].functions[item.function_name].method(**json.loads(item.arguments))
print("Content from Function Call - ", content)
function_results.append(
FunctionResultContent(
id=item.id, name=item.name, result=str(content)
)
)
self.history.add_message(
ChatMessageContent(
role = AuthorRole.TOOL,
items = function_results
)
)
else:
break
counter += 1
if counter > 25: break# Add the message from the agent to the chat history
self.history.add_message(result)
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Bug: Python - The AUTO_FUNCTION_INVOCATION filter fails to be called (intermittently)
Python: Bug: Python - The AUTO_FUNCTION_INVOCATION filter fails to be called (intermittently)
Sep 13, 2024
samelhousseini
changed the title
Python: Bug: Python - The AUTO_FUNCTION_INVOCATION filter fails to be called (intermittently)
Python: Bug: The 'get_chat_message_contents' just returns an empty string without a a function call (intermittently)
Sep 16, 2024
samelhousseini
changed the title
Python: Bug: The 'get_chat_message_contents' just returns an empty string without a a function call (intermittently)
Python: Bug: The 'get_chat_message_contents' returns with a tool_calls message without calling the plugin's function(s) (intermittently)
Sep 16, 2024
Hi @eduard van ***@***.***>,
I believe you meant the execution settings? Please find below.
self.execution_settings = AzureChatPromptExecutionSettings(tool_choice="auto")
self.execution_settings.function_choice_behavior = FunctionChoiceBehavior.Auto()
Many thanks
Samer
Describe the bug
This is an intermittent problem and hard to reproduce with exact steps.
To Reproduce
Steps to reproduce the behavior:
The "chat_completion.get_chat_message_contents" function call sometimes just returns with a tool_calls message but without calling the plugin's functions described in the tool_calls. The chat history indicates that the last message added is a "tool_calls" but no function result message is added afterwards.
Expected behavior
Since there's a tool calls, the expected behavior is that the function call workflow proceeds as expected with a function call and a function result, but then all I get is a tool_calls message from "chat_completion.get_chat_message_contents"
When inspecting the results above, the get_chat_message_contents is returning without calling the plugin's functions:
Screenshots
Screenshot below showing that the call to get_chat_message_contents just returned with an empty string, because the ChatMessageContent is a function call "tool_calls".
print("Assistant > " + str(result))
And that the call to the filter did not happen.
Platform
Update:
The following block of code is a temp fix of this problem:
The text was updated successfully, but these errors were encountered: