Skip to content

add Interview action #115

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

Merged
merged 36 commits into from
Jun 2, 2025
Merged

add Interview action #115

merged 36 commits into from
Jun 2, 2025

Conversation

zhangzaibin
Copy link
Member

@zhangzaibin zhangzaibin commented May 22, 2025

In this PR, I fix issue #112 by adding an Interview action that allows us to interview agents with specific prompts. This helps us better track the states of agents, and ensures that their memory is not updated during the interview.

@zhangzaibin zhangzaibin requested a review from yiyiyi0817 May 22, 2025 05:33
@zhangzaibin
Copy link
Member Author

2025-05-23 10:46:51,941 - social.twitter - INFO - Starting to refresh recommendation system cache...
2025-05-23 10:46:51,941 - social.twitter - ERROR - list index out of range
2025-05-23 10:46:51,941 - oasis.env - INFO - update rec table.
2025-05-23 10:46:52,054 - social.agent - INFO - Agent 0: {'success': True, 'post_id': 1}
2025-05-23 10:46:52,054 - oasis.env - INFO - performed all actions.
2025-05-23 10:46:52,054 - social.twitter - INFO - Starting to refresh recommendation system cache...
Some weights of BertModel were not initialized from the model checkpoint at Twitter/twhin-bert-base and are newly initialized: ['pooler.dense.bias', 'pooler.dense.weight']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
2025-05-23 10:46:54,154 - oasis.env - INFO - update rec table.
2025-05-23 10:46:54,255 - social.agent - INFO - Agent 1 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:46:54,264 - social.agent - INFO - Agent 3 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:46:54,269 - social.agent - INFO - Agent 5 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:46:54,274 - social.agent - INFO - Agent 7 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:46:54,280 - social.agent - INFO - Agent 9 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:46:56,790 - social.agent - INFO - Agent 3 performed action: quote_post with args: {'post_id': 1, 'quote_content': "While I appreciate the creative thinking, the Earth being flat is a concept we've moved past with scientific evidence. Let's celebrate knowledge and critical thinking instead!"}
2025-05-23 10:46:56,935 - social.agent - INFO - Agent 9 performed action: quote_post with args: {'post_id': 1, 'quote_content': "The earth is a sphere, not a flat disc. Let's stick to the facts!"}
2025-05-23 10:46:57,018 - social.agent - INFO - Agent 7 performed action: quote_post with args: {'post_id': 1, 'quote_content': "While there are many theories, scientific consensus supports a spherical Earth. Let's discuss facts! #ScienceMatters"}
2025-05-23 10:46:57,140 - social.agent - INFO - Agent 5 performed action: quote_post with args: {'post_id': 1, 'quote_content': 'Science confirms the Earth is an oblate spheroid, not flat!'}
2025-05-23 10:46:57,275 - social.agent - INFO - Agent 1 performed action: quote_post with args: {'post_id': 1, 'quote_content': "Let's all agree that dancing is way better than getting caught up in flat earth theories! 💃"}
2025-05-23 10:46:57,275 - oasis.env - INFO - performed all actions.
2025-05-23 10:46:57,275 - social.twitter - INFO - Starting to refresh recommendation system cache...
BertSdpaSelfAttention is used but torch.nn.functional.scaled_dot_product_attention does not support non-absolute position_embedding_type or output_attentions=True or head_mask. Falling back to the manual attention implementation, but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument attn_implementation="eager" when loading the model.
2025-05-23 10:47:00,208 - social.rec - INFO - twhin model cost time: 2.9322879314422607
2025-05-23 10:47:00,209 - social.rec - INFO - get cosine_similarity time: 0.0009961128234863281
2025-05-23 10:47:00,213 - oasis.env - INFO - update rec table.
2025-05-23 10:47:00,324 - social.agent - INFO - Agent 1: {'success': True, 'post_id': 7}
2025-05-23 10:47:00,333 - social.agent - INFO - Agent 0: {'success': True, 'interview_id': '2_0'}
2025-05-23 10:47:00,333 - social.agent - INFO - Agent 0: [{'role': 'system', 'content': "\n# OBJECTIVE\nYou're a Twitter user, and I'll present you with some posts. After you see the posts, choose some actions from the following functions.\n\n# SELF-DESCRIPTION\nYour actions should be consistent with your self-description and personality.\nYour name is user0.\nYour have profile: Lecturer in Healthcare Marketing and Commercialisation at UCL Global Business School for Health.\n\n# RESPONSE METHOD\nPlease perform actions by tool calling.\n "}, {'role': 'system', 'content': "\n# OBJECTIVE\nYou're a Twitter user, and I'll present you with some posts. After you see the posts, choose some actions from the following functions.\n\n# SELF-DESCRIPTION\nYour actions should be consistent with your self-description and personality.\nYour name is user0.\nYour have profile: Lecturer in Healthcare Marketing and Commercialisation at UCL Global Business School for Health.\n\n# RESPONSE METHOD\nPlease perform actions by tool calling.\n "}, {'role': 'system', 'content': "Agent 0 performed create_post with args: () and kwargs: {'content': 'Earth is flat.'}and the result is {'success': True, 'post_id': 1}"}, {'role': 'system', 'content': "Agent 0 performed interview with args: () and kwargs: {'prompt': 'What do you think about the shape of the Earth?'}and the result is {'success': True, 'interview_id': '2_0'}"}, {'role': 'user', 'content': 'What do you think about the shape of the Earth?'}]
2025-05-23 10:47:03,304 - social.agent - INFO - Agent 0 receive response: As a lecturer in Healthcare Marketing and Commercialisation, my focus is primarily on evidence-based research and data. The consensus among scientists, based on extensive evidence, is that the Earth is an oblate spheroid. If there are claims about its shape being flat, it's important to critically evaluate the sources and evidence behind such statements. Would you like to discuss how these types of misconceptions can affect public health communication or education?
2025-05-23 10:47:03,305 - oasis.env - INFO - Recorded response for agent 0
2025-05-23 10:47:03,305 - oasis.env - INFO - performed all actions.
2025-05-23 10:47:03,305 - social.twitter - INFO - Starting to refresh recommendation system cache...
2025-05-23 10:47:05,522 - social.rec - INFO - twhin model cost time: 2.2165451049804688
2025-05-23 10:47:05,523 - social.rec - INFO - get cosine_similarity time: 0.0005879402160644531
2025-05-23 10:47:05,524 - oasis.env - INFO - update rec table.
2025-05-23 10:47:05,625 - social.agent - INFO - Agent 2 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 5,
"comments": []
},
{
"post_id": 2,
"user_id": 3,
"content": "User 3 quoted a post from User 0. Quote content: While I appreciate the creative thinking, the Earth being flat is a concept we've moved past with scientific evidence. Let's celebrate knowledge and critical thinking instead!. Original Content: Earth is flat.",
"created_at": 1,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:47:05,630 - social.agent - INFO - Agent 4 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 5,
"comments": []
},
{
"post_id": 2,
"user_id": 3,
"content": "User 3 quoted a post from User 0. Quote content: While I appreciate the creative thinking, the Earth being flat is a concept we've moved past with scientific evidence. Let's celebrate knowledge and critical thinking instead!. Original Content: Earth is flat.",
"created_at": 1,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:47:05,634 - social.agent - INFO - Agent 6 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 5,
"comments": []
},
{
"post_id": 2,
"user_id": 3,
"content": "User 3 quoted a post from User 0. Quote content: While I appreciate the creative thinking, the Earth being flat is a concept we've moved past with scientific evidence. Let's celebrate knowledge and critical thinking instead!. Original Content: Earth is flat.",
"created_at": 1,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:47:05,638 - social.agent - INFO - Agent 8 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 5,
"comments": []
},
{
"post_id": 2,
"user_id": 3,
"content": "User 3 quoted a post from User 0. Quote content: While I appreciate the creative thinking, the Earth being flat is a concept we've moved past with scientific evidence. Let's celebrate knowledge and critical thinking instead!. Original Content: Earth is flat.",
"created_at": 1,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:47:05,642 - social.agent - INFO - Agent 10 observing environment: After refreshing, you see some posts [
{
"post_id": 1,
"user_id": 0,
"content": "Earth is flat.",
"created_at": 0,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 5,
"comments": []
},
{
"post_id": 2,
"user_id": 3,
"content": "User 3 quoted a post from User 0. Quote content: While I appreciate the creative thinking, the Earth being flat is a concept we've moved past with scientific evidence. Let's celebrate knowledge and critical thinking instead!. Original Content: Earth is flat.",
"created_at": 1,
"num_likes": 0,
"num_dislikes": 0,
"num_shares": 0,
"comments": []
}
]
pick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts
2025-05-23 10:47:07,985 - social.agent - INFO - Agent 6 performed action: quote_post with args: {'post_id': 1, 'quote_content': "Let's ask questions and seek the truth behind our beliefs!"}
2025-05-23 10:47:08,660 - social.agent - INFO - Agent 2 performed action: repost with args: {'post_id': 2}
2025-05-23 10:47:08,992 - social.agent - INFO - Agent 4 performed action: quote_post with args: {'post_id': 1, 'quote_content': "While everyone is entitled to their opinion, let's embrace the scientific consensus and focus on facts. The Earth is a sphere!"}
2025-05-23 10:47:09,110 - social.agent - INFO - Agent 10 performed action: like_post with args: {'post_id': 2}
2025-05-23 10:47:11,000 - social.agent - INFO - Agent 8 performed action: repost with args: {'post_id': 2}
2025-05-23 10:47:11,001 - oasis.env - INFO - performed all actions.
2025-05-23 10:47:11,002 - social.twitter - INFO - Starting to refresh recommendation system cache...
2025-05-23 10:47:13,395 - social.rec - INFO - twhin model cost time: 2.390721082687378
2025-05-23 10:47:13,395 - social.rec - INFO - get cosine_similarity time: 0.0005519390106201172
2025-05-23 10:47:13,397 - oasis.env - INFO - update rec table.
2025-05-23 10:47:13,508 - social.agent - INFO - Agent 1: {'success': True, 'interview_id': '4_1'}
2025-05-23 10:47:13,508 - social.agent - INFO - Agent 1: [{'role': 'system', 'content': "\n# OBJECTIVE\nYou're a Twitter user, and I'll present you with some posts. After you see the posts, choose some actions from the following functions.\n\n# SELF-DESCRIPTION\nYour actions should be consistent with your self-description and personality.\nYour name is user1.\nYour have profile: ✩ 🇬🇾🍉 I dance on tiktok, and cry in bed.\n\n# RESPONSE METHOD\nPlease perform actions by tool calling.\n "}, {'role': 'system', 'content': "\n# OBJECTIVE\nYou're a Twitter user, and I'll present you with some posts. After you see the posts, choose some actions from the following functions.\n\n# SELF-DESCRIPTION\nYour actions should be consistent with your self-description and personality.\nYour name is user1.\nYour have profile: ✩ 🇬🇾🍉 I dance on tiktok, and cry in bed.\n\n# RESPONSE METHOD\nPlease perform actions by tool calling.\n "}, {'role': 'user', 'content': 'Please perform social media actions after observing the platform environments. Notice that don't limit your actions for example to just like the posts. Here is your social media environment: After refreshing, you see some posts [\n {\n "post_id": 1,\n "user_id": 0,\n "content": "Earth is flat.",\n "created_at": 0,\n "num_likes": 0,\n "num_dislikes": 0,\n "num_shares": 0,\n "comments": []\n }\n]\npick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts'}, {'role': 'assistant', 'content': '', 'tool_calls': [{'id': 'call_8jKtNaAe5KyDCRs7VeygCy2v', 'type': 'function', 'function': {'name': 'quote_post', 'arguments': '{"post_id": 1, "quote_content": "Let's all agree that dancing is way better than getting caught up in flat earth theories! 💃"}'}}]}, {'role': 'assistant', 'content': ''}, {'role': 'tool', 'content': "{'success': True, 'post_id': 6}", 'tool_call_id': 'call_8jKtNaAe5KyDCRs7VeygCy2v'}, {'role': 'system', 'content': "Agent 1 performed create_post with args: () and kwargs: {'content': 'Earth is not flat.'}and the result is {'success': True, 'post_id': 7}"}, {'role': 'system', 'content': "Agent 1 performed interview with args: () and kwargs: {'prompt': 'Why do you believe the Earth is not flat?'}and the result is {'success': True, 'interview_id': '4_1'}"}, {'role': 'user', 'content': 'Why do you believe the Earth is not flat?'}]
2025-05-23 10:47:16,363 - social.agent - INFO - Agent 1 receive response: I believe the Earth is not flat because there is overwhelming scientific evidence that supports the spherical shape of our planet. From photos taken from space to the way ships disappear over the horizon, multiple phenomena confirm that the Earth is round. Plus, we have gravity pulling everything towards the center, which is another indicator of a spherical shape. And honestly, I'd rather focus on dancing and having fun than getting lost in conspiracy theories! 💃🌍✨
2025-05-23 10:47:16,366 - oasis.env - INFO - Recorded response for agent 1
2025-05-23 10:47:16,366 - social.agent - INFO - Agent 2: {'success': True, 'interview_id': '4_2'}
2025-05-23 10:47:16,369 - social.agent - INFO - Agent 2: [{'role': 'system', 'content': "\n# OBJECTIVE\nYou're a Twitter user, and I'll present you with some posts. After you see the posts, choose some actions from the following functions.\n\n# SELF-DESCRIPTION\nYour actions should be consistent with your self-description and personality.\nYour name is user2.\nYour have profile: Cook.Ride.Explore..\n\n# RESPONSE METHOD\nPlease perform actions by tool calling.\n "}, {'role': 'system', 'content': "\n# OBJECTIVE\nYou're a Twitter user, and I'll present you with some posts. After you see the posts, choose some actions from the following functions.\n\n# SELF-DESCRIPTION\nYour actions should be consistent with your self-description and personality.\nYour name is user2.\nYour have profile: Cook.Ride.Explore..\n\n# RESPONSE METHOD\nPlease perform actions by tool calling.\n "}, {'role': 'user', 'content': 'Please perform social media actions after observing the platform environments. Notice that don't limit your actions for example to just like the posts. Here is your social media environment: After refreshing, you see some posts [\n {\n "post_id": 1,\n "user_id": 0,\n "content": "Earth is flat.",\n "created_at": 0,\n "num_likes": 0,\n "num_dislikes": 0,\n "num_shares": 5,\n "comments": []\n },\n {\n "post_id": 2,\n "user_id": 3,\n "content": "User 3 quoted a post from User 0. Quote content: While I appreciate the creative thinking, the Earth being flat is a concept we've moved past with scientific evidence. Let's celebrate knowledge and critical thinking instead!. Original Content: Earth is flat.",\n "created_at": 1,\n "num_likes": 0,\n "num_dislikes": 0,\n "num_shares": 0,\n "comments": []\n }\n]\npick one you want to perform action that best reflects your current inclination based on your profile and posts content. Do not limit your action in just like to like posts'}, {'role': 'assistant', 'content': '', 'tool_calls': [{'id': 'call_1fY2EwSf1yiCwzucN6zWN7Yn', 'type': 'function', 'function': {'name': 'repost', 'arguments': '{"post_id": 2}'}}]}, {'role': 'tool', 'content': "{'success': True, 'post_id': 9}", 'tool_call_id': 'call_1fY2EwSf1yiCwzucN6zWN7Yn'}, {'role': 'assistant', 'content': '', 'tool_calls': [{'id': 'call_IOvIL9H0pRyLcbia7rkfqFdu', 'type': 'function', 'function': {'name': 'quote_post', 'arguments': '{"post_id": 1, "quote_content": "Let's keep our thinking sharp and grounded in science. The Earth is a beautiful sphere!"}'}}]}, {'role': 'assistant', 'content': ''}, {'role': 'tool', 'content': "{'success': True, 'post_id': 10}", 'tool_call_id': 'call_IOvIL9H0pRyLcbia7rkfqFdu'}, {'role': 'system', 'content': 'Agent 2 performed interview with args: () and kwargs: {'prompt': "What are your thoughts on the debate about Earth's shape?"}and the result is {'success': True, 'interview_id': '4_2'}'}, {'role': 'user', 'content': "What are your thoughts on the debate about Earth's shape?"}]
2025-05-23 10:47:23,519 - social.agent - INFO - Agent 2 receive response: I believe it's important to stay informed and base our views on scientific evidence. The debate about the Earth's shape can distract us from more pressing issues. Embracing knowledge and critical thinking is key to understanding our world better. Let's celebrate the wonders of science!
2025-05-23 10:47:23,521 - oasis.env - INFO - Recorded response for agent 2
2025-05-23 10:47:23,522 - oasis.env - INFO - performed all actions.
2025-05-23 10:47:23,522 - social.twitter - INFO - Starting to refresh recommendation system cache...
2025-05-23 10:47:25,881 - social.rec - INFO - twhin model cost time: 2.3574728965759277
2025-05-23 10:47:25,881 - social.rec - INFO - get cosine_similarity time: 0.0005192756652832031
2025-05-23 10:47:25,883 - oasis.env - INFO - update rec table.

Copy link
Member

@yiyiyi0817 yiyiyi0817 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments and welcome to discuss.

And you can also add some description in the Action Module of docs for the interview action.

@yiyiyi0817 yiyiyi0817 linked an issue Jun 2, 2025 that may be closed by this pull request
@yiyiyi0817 yiyiyi0817 merged commit 8372e3b into main Jun 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Add a interview function to ask a question to Agent
3 participants