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
{{ message }}
Repository navigation
Python: unhashable type 'list' exception in function_result_content __hash__ function #9977
Describe the bug
A TypeError: unhashable type: 'list' exception is raised when invoking the hash function of function_result_content.
To Reproduce
Steps to reproduce the behavior:
Create an agent group chat
Add an agent to the group chat with a kernel function that returns a list
Invoke the agent through the group chat and let the agent invoke the kernel function that returns a list
See error
Expected behavior
no exception if result of function_result_content is of an unhashable type
Platform
OS: [Windows]
IDE: [VS Code]
Language: [Python]
Source: [Python SDK 1.17.0]
Additional context
TypeError: unhashable type: 'list'
Traceback (most recent call last):
async for content in group_chat.invoke():
File "C:\Source\...\evaluation\.venv\Lib\site-packages\semantic_kernel\agents\group_chat\agent_group_chat.py", line 144, in invoke
async for message in super().invoke_agent(selected_agent):
File "C:\Source\....\evaluation\.venv\Lib\site-packages\semantic_kernel\agents\group_chat\agent_chat.py", line 144, in invoke_agent
async for is_visible, message in channel.invoke(agent):
File "C:\Source\....\evaluation\.venv\Lib\site-packages\semantic_kernel\agents\channels\chat_history_channel.py", line 75, in invoke
mutated_history.add(mutated_message)
File "C:\Source\....\evaluation\.venv\Lib\site-packages\semantic_kernel\contents\chat_message_content.py", line 318, in __hash__
return hash((self.tag, self.role, self.content, self.encoding, self.finish_reason, *self.items))
File "C:\Source\....\evaluation\.venv\Lib\site-packages\semantic_kernel\contents\function_result_content.py", line 190, in __hash__
return hash((self.tag, self.id, self.result, self.name, self.function_name, self.plugin_name, self.encoding))
TypeError: unhashable type: 'list'
Activity
moonbox3 commentedon Dec 16, 2024
Thanks for filing, Bernd Kullick (@berndku). A PR with a fix will be out shortly.
Python: FunctionResultContent hash fix to handle lists/sets (#9978)