-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] chat_agent update message #298
Comments
I think the misunderstanding comes from the following. There are two AI agents:
And there are two orthogonal "roles at backend":
This is quite untrivial and the naming is not ideal, I agree. Please take this into account and update us if you think that the bug is still there. |
Anyway, @zhiyu-01 please create a PR for this ticket and put the test that you made earlier here. |
I have printed out the user's ChatRecord, it should be in sequence as ['system', 'assistant', 'user'], but we just get a chaos: The intersting thing is the agent didn't get confused in other role plyaing example, even the chatrecord is also out of order: Besides, the ChatRecord containts two properties, role_at_back_end and message, the message is also containts the role type and content properties, what openai api need is {'role': role, 'content': content}, here seems have a little redundant. Should we consider a chage in the ChatRecord class? |
@zhiyu-01 Please take the test
and put it into a new PR for this ticket. Make sure that the test checks for the following sequence:
|
Required prerequisites
What version of camel are you using?
0.1.0
System information
3.10.12 | packaged by Anaconda, Inc. | (main, Jul 5 2023, 19:01:18) [MSC v.1916 64 bit (AMD64)] win32
0.1.0
Problem description
I have added a function web_search into camel recently, but it didn't work correctly:
The user can't provide instructions, but the assistant can, which is against the prompt.
In chat_agent.py , there are these codes:
When agent update message, it always named 'user' even it's an assistant agent. And the same as submit_message function:
The message comes from assistant have been updated to user's, I guess this is the reason why agent got confused, but it
didn't confuse agents in other conversation types.
In role_playing.py init_chat function, there is also a strange code:
The assistant message given to user, and user message given to assistant. But here the assistant_response = self.assistant_agent.step(user_msg) haven't been used, it's just update the message to assistant agent's stored_messages list, in most example files, the init_chat just used in this way:
The response from the agent.step have been throwed away. More important, it generates a message with user role type and assistant content:
The init_chat can work correctly in this way:
I have created a test with two steps of role_playing to output the agent's stored_messages:
here I only printed the role type,
This is the original code result:
This is the modified code result:
The conversation runs alternate in two agents, shouldn't the messages store in the same way?
After these modify, the agent back to normal:
Reproducible example code
python role_playing_with_function.py
Traceback
No response
Expected behavior
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: