Closed Carlos133386 closed 4 months ago
reason: the error is occurred since your 'input_msg' is created by 'role_play_session.init_chat()', which is a (assistant msg, user msg) set with type (BaseMessage, List[BaseMessage]). But 'role_play_session.step' only accepts one assistant msg with type BaseMessage.
solution: In role_playing.py, try replacing the line of code "input_msg = role_play_session.init_chat()" to "inputmsg, = role_play_session.init_chat()"
Thanks @WuJunde help to answer this!
Required prerequisites
What version of camel are you using?
0.1.1
System information
python: 3.10.14
camel :0.1.1
Problem description
Traceback (most recent call last): File ".\camel-master\examples\ai_society\role_playing.py", line 75, in
main()
File ".\camel-master\examples\ai_society\role_playing.py", line 50, in main
assistant_response, user_response = role_play_session.step(input_msg)
File "C:\Users\Carlos\miniconda3\envs\LLM\lib\site-packages\camel\societies\role_playing.py", line 435, in step
user_response = self.user_agent.step(assistant_msg)
File "C:\Users\Carlos\miniconda3\envs\LLM\lib\site-packages\camel\agents\chat_agent.py", line 278, in step
self.update_memory(input_message, OpenAIBackendRole.USER)
File "C:\Users\Carlos\miniconda3\envs\LLM\lib\site-packages\camel\agents\chat_agent.py", line 192, in update_memory
self.memory.write_record(MemoryRecord(message, role))
File "C:\Users\Carlos\miniconda3\envs\LLM\lib\site-packages\camel\memories\base.py", line 69, in write_record
self.write_records([record])
File "C:\Users\Carlos\miniconda3\envs\LLM\lib\site-packages\camel\memories\chat_history_memory.py", line 105, in write_records
stored_records.append(record.to_dict())
File "C:\Users\Carlos\miniconda3\envs\LLM\lib\site-packages\camel\memories\records.py", line 76, in to_dict
**asdict(self.message)
File "C:\Users\Carlos\miniconda3\envs\LLM\lib\dataclasses.py", line 1237, in asdict
raise TypeError("asdict() should be called on dataclass instances")
TypeError: asdict() should be called on dataclass instances
Reproducible example code
The Python snippets:
Command lines:
Extra dependencies:
Steps to reproduce:
1. 2. 3.
Traceback
Expected behavior
No response
Additional context
No response