pycityagent 2.0.0a92__cp311-cp311-macosx_11_0_arm64.whl → 2.0.0a93__cp311-cp311-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pycityagent/cityagent/blocks/needs_block.py +2 -2
- pycityagent/cityagent/blocks/plan_block.py +1 -1
- pycityagent/cityagent/blocks/social_block.py +2 -1
- pycityagent/cityagent/initial.py +4 -4
- pycityagent/cityagent/societyagent.py +1 -1
- pycityagent/simulation/simulation.py +1 -0
- pycityagent/workflow/block.py +2 -2
- {pycityagent-2.0.0a92.dist-info → pycityagent-2.0.0a93.dist-info}/METADATA +1 -1
- {pycityagent-2.0.0a92.dist-info → pycityagent-2.0.0a93.dist-info}/RECORD +13 -13
- {pycityagent-2.0.0a92.dist-info → pycityagent-2.0.0a93.dist-info}/LICENSE +0 -0
- {pycityagent-2.0.0a92.dist-info → pycityagent-2.0.0a93.dist-info}/WHEEL +0 -0
- {pycityagent-2.0.0a92.dist-info → pycityagent-2.0.0a93.dist-info}/entry_points.txt +0 -0
- {pycityagent-2.0.0a92.dist-info → pycityagent-2.0.0a93.dist-info}/top_level.txt +0 -0
@@ -99,10 +99,10 @@ class NeedsBlock(Block):
|
|
99
99
|
0.1,
|
100
100
|
) # Hunger decay rate, Energy decay rate, Safety decay rate, Social decay rate
|
101
101
|
self.T_H, self.T_D, self.T_P, self.T_C = (
|
102
|
-
0.
|
103
|
-
0.2,
|
102
|
+
0.1,
|
104
103
|
0.2,
|
105
104
|
0.2,
|
105
|
+
0.4,
|
106
106
|
) # Hunger threshold, Energy threshold, Safety threshold, Social threshold
|
107
107
|
|
108
108
|
async def initialize(self):
|
@@ -174,7 +174,7 @@ class PlanBlock(Block):
|
|
174
174
|
"hungry": ["Eat at home", "Eat outside"],
|
175
175
|
"tired": ["Sleep", "Take a nap"],
|
176
176
|
"safe": ["Go to work"],
|
177
|
-
"social": ["
|
177
|
+
"social": ["Contact with friends", "Shopping"],
|
178
178
|
"whatever": ["Contact with friends", "Hang out"],
|
179
179
|
}
|
180
180
|
|
@@ -151,7 +151,7 @@ class FindPersonBlock(Block):
|
|
151
151
|
|
152
152
|
if not friends:
|
153
153
|
node_id = await self.memory.stream.add_social(
|
154
|
-
description=f"I can't find any friends to
|
154
|
+
description=f"I can't find any friends to contact with."
|
155
155
|
)
|
156
156
|
return {
|
157
157
|
"success": False,
|
@@ -327,6 +327,7 @@ class MessageBlock(Block):
|
|
327
327
|
|
328
328
|
# Send message
|
329
329
|
serialized_message = self._serialize_message(message, 1)
|
330
|
+
await self.agent.send_message_to_agent(target, serialized_message)
|
330
331
|
node_id = await self.memory.stream.add_social(
|
331
332
|
description=f"I sent a message to {target}: {message}"
|
332
333
|
)
|
pycityagent/cityagent/initial.py
CHANGED
@@ -27,11 +27,11 @@ async def initialize_social_network(simulation):
|
|
27
27
|
relation_types = ["family", "colleague", "friend"]
|
28
28
|
|
29
29
|
# Get all agent IDs
|
30
|
-
|
31
|
-
for agent_id in
|
30
|
+
citizen_uuids = await simulation.filter(types=[SocietyAgent])
|
31
|
+
for agent_id in citizen_uuids:
|
32
32
|
# Randomly select 2-5 friends for each agent
|
33
33
|
num_friends = random.randint(2, 5)
|
34
|
-
possible_friends = [aid for aid in
|
34
|
+
possible_friends = [aid for aid in citizen_uuids if aid != agent_id]
|
35
35
|
friends = random.sample(
|
36
36
|
possible_friends, min(num_friends, len(possible_friends))
|
37
37
|
)
|
@@ -114,7 +114,7 @@ async def bind_agent_info(simulation):
|
|
114
114
|
- **Returns**:
|
115
115
|
- None
|
116
116
|
"""
|
117
|
-
logger.info("Binding
|
117
|
+
logger.info("Binding economy relationship...")
|
118
118
|
infos = await simulation.gather("id")
|
119
119
|
citizen_uuids = await simulation.filter(types=[SocietyAgent])
|
120
120
|
firm_uuids = await simulation.filter(types=[FirmAgent])
|
@@ -57,7 +57,7 @@ class PlanAndActionBlock(Block):
|
|
57
57
|
self.planBlock = PlanBlock(llm=llm, memory=memory, simulator=simulator)
|
58
58
|
self.mobilityBlock = MobilityBlock(llm=llm, memory=memory, simulator=simulator)
|
59
59
|
self.socialBlock = SocialBlock(
|
60
|
-
agent=
|
60
|
+
agent=agent, llm=llm, memory=memory, simulator=simulator
|
61
61
|
)
|
62
62
|
self.economyBlock = EconomyBlock(
|
63
63
|
llm=llm, memory=memory, simulator=simulator, economy_client=economy_client
|
@@ -779,6 +779,7 @@ class AgentSimulation:
|
|
779
779
|
self._groups[group_name] = group
|
780
780
|
group_agent_uuids = ray.get(group.get_agent_uuids.remote())
|
781
781
|
for agent_uuid in group_agent_uuids:
|
782
|
+
self._agent_uuids.append(agent_uuid)
|
782
783
|
self._agent_uuid2group[agent_uuid] = group
|
783
784
|
self._user_chat_topics[agent_uuid] = (
|
784
785
|
f"exps/{self.exp_id}/agents/{agent_uuid}/user-chat"
|
pycityagent/workflow/block.py
CHANGED
@@ -259,7 +259,7 @@ class Block:
|
|
259
259
|
setattr(self, field, config["config"][field])
|
260
260
|
|
261
261
|
def build_or_update_block(block_data: dict) -> Block:
|
262
|
-
block_name = block_data["name"]
|
262
|
+
block_name = block_data["name"] # type:ignore
|
263
263
|
existing_block = getattr(self, block_name, None)
|
264
264
|
|
265
265
|
if existing_block:
|
@@ -276,7 +276,7 @@ class Block:
|
|
276
276
|
return block_instance
|
277
277
|
|
278
278
|
# 递归遍历子Block配置
|
279
|
-
for block_data in config.get("
|
279
|
+
for block_data in config.get("children", []):
|
280
280
|
build_or_update_block(block_data)
|
281
281
|
|
282
282
|
async def forward(self):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: pycityagent
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.0a93
|
4
4
|
Summary: LLM-based city environment agent building library
|
5
5
|
Author-email: Yuwei Yan <pinkgranite86@gmail.com>, Junbo Yan <yanjb20thu@gmali.com>, Jun Zhang <zhangjun990222@gmali.com>
|
6
6
|
License: MIT License
|
@@ -21,7 +21,7 @@ pycityagent/memory/utils.py,sha256=oJWLdPeJy_jcdKcDTo9JAH9kDZhqjoQhhv_zT9qWC0w,8
|
|
21
21
|
pycityagent/memory/const.py,sha256=Wgsx0oztDrJDEpI9Dr6XeI6GXrABcP0UTOuEvMp1AD8,934
|
22
22
|
pycityagent/memory/faiss_query.py,sha256=KPeyzIjD0dzkxr-TlOeCiIlkdh1WAyyipCAXUEt97Lk,17350
|
23
23
|
pycityagent/memory/state.py,sha256=JFCBuK1AS-HqscvdGS9ATF9AUU8t29_2leDY_6iO2_4,5158
|
24
|
-
pycityagent/simulation/simulation.py,sha256=
|
24
|
+
pycityagent/simulation/simulation.py,sha256=AjN-cT-SqdPbuXJAIczWr17hNC8fBzSLG8MrRbYC-9g,49423
|
25
25
|
pycityagent/simulation/__init__.py,sha256=u1WpgwVxPboXWMxrUQKMXJNmTKQYAeCaqZv9HmSxESY,118
|
26
26
|
pycityagent/simulation/agentgroup.py,sha256=rPloocCwB6rfjWbIz3T052mYq2lEcBp97mblkMD2y0A,36955
|
27
27
|
pycityagent/simulation/storage/pg.py,sha256=xRshSOGttW-p0re0fNBOjOpb-nQ5msIE2LsdT79_E_Y,8425
|
@@ -43,7 +43,7 @@ pycityagent/agent/agent.py,sha256=TMusq6As7gfZAiFr2XB1H-4tlHrWFEOm7ytPjvxl6K4,19
|
|
43
43
|
pycityagent/cli/wrapper.py,sha256=bAwmfWTXbGld-uiMnIMhKp22IVRQjhLUToknyUDk9rQ,1147
|
44
44
|
pycityagent/workflow/__init__.py,sha256=H08Ko3eliZvuuCMajbEri-IP4-SeswYU6UjHBNA4Ze0,490
|
45
45
|
pycityagent/workflow/prompt.py,sha256=rzenP4EFGxbWE1aq-x2036b6umKvi5cQx2xtWULwgIk,3392
|
46
|
-
pycityagent/workflow/block.py,sha256=
|
46
|
+
pycityagent/workflow/block.py,sha256=zOoMgCvjrOXyAUQRCU7Qo_diRZaPGjgsfO0vraSJ9b0,12289
|
47
47
|
pycityagent/workflow/trigger.py,sha256=4nzAwywGQsFabgo6gzp-vD2EV4wII7Z0LHGEAsflSEY,7608
|
48
48
|
pycityagent/environment/__init__.py,sha256=fFIth2jxxgZ92cXm-aoM2igHgaSqsYGwtBhyb7opjzk,166
|
49
49
|
pycityagent/environment/simulator.py,sha256=4QVwi40I9AwJ9YIDK3-fqmlz2Q5ykkWBHpz78xAo22c,23299
|
@@ -72,26 +72,26 @@ pycityagent/cityagent/bankagent.py,sha256=I6MNG1fUbxKyWCLxCtvOjeVahong_LhHQKmJdR
|
|
72
72
|
pycityagent/cityagent/__init__.py,sha256=gcBQ-a50XegFtjigQ7xDXRBZrywBKqifiQFSRnEF8gM,572
|
73
73
|
pycityagent/cityagent/firmagent.py,sha256=vZr7kdjnxcCZ5qX7hmUIYuQQWd44GcRPbdi76WGSFy4,3760
|
74
74
|
pycityagent/cityagent/nbsagent.py,sha256=rrzL-Ep-gWB8kvoPA8nBokY1zoEZGpyQjP9oy7ZuVL4,4676
|
75
|
-
pycityagent/cityagent/initial.py,sha256=
|
76
|
-
pycityagent/cityagent/societyagent.py,sha256=
|
75
|
+
pycityagent/cityagent/initial.py,sha256=X558KNRfoyuztNjvbGIX6ahUPzqnW9XiBQ_WQ9bTztY,6308
|
76
|
+
pycityagent/cityagent/societyagent.py,sha256=i2Khr9LU-7XI5Mhaiu89yoBKYsN7U4RvgS2u4GXNz6M,20122
|
77
77
|
pycityagent/cityagent/message_intercept.py,sha256=dyT1G-nMxKb2prhgtyFFHFz593qBrkk5DnHsHvG1OIc,4418
|
78
78
|
pycityagent/cityagent/governmentagent.py,sha256=XIyggG83FWUTZdOuoqc6ClCP3hhfkxNmtYRu9TFo0dU,3063
|
79
79
|
pycityagent/cityagent/blocks/dispatcher.py,sha256=gd3lyggvtkCq9Ou_icgua60H0UjHTzwHoynLl_iZoes,2939
|
80
|
-
pycityagent/cityagent/blocks/needs_block.py,sha256=
|
80
|
+
pycityagent/cityagent/blocks/needs_block.py,sha256=YRJACcxZbbPrQWdArAakf_H7BKm24EbWaI8NTiXiDdE,15227
|
81
81
|
pycityagent/cityagent/blocks/cognition_block.py,sha256=yzjB0D_95vytpa5xiVdmTSpGp8H9HXcjWzzFN0OpP0k,15398
|
82
|
-
pycityagent/cityagent/blocks/social_block.py,sha256=
|
82
|
+
pycityagent/cityagent/blocks/social_block.py,sha256=pGQxumQ8FUpTqWRFcoDkNxnMtyToWXUnjIKYgUAA3vk,15218
|
83
83
|
pycityagent/cityagent/blocks/__init__.py,sha256=h6si6WBcVVuglIskKQKA8Cxtf_VKen1sNPqOFKI311Q,420
|
84
84
|
pycityagent/cityagent/blocks/economy_block.py,sha256=cQePU1kfJzmO9j_vnitQATsV-ztf8SHSWqRKiJVNlM0,19863
|
85
85
|
pycityagent/cityagent/blocks/utils.py,sha256=K--6odjUDUu9YrwrHPaiPIHryo7m_MBmcBqDAy3cV5M,1816
|
86
86
|
pycityagent/cityagent/blocks/other_block.py,sha256=LdtL6248xvMvvRQx6NvdlJrWWZFu8Xusjxb9yEh1M0k,4365
|
87
|
-
pycityagent/cityagent/blocks/plan_block.py,sha256=
|
87
|
+
pycityagent/cityagent/blocks/plan_block.py,sha256=sM6FII0ubFj5eOifSf422RV8ry7RUQZfeDylVh4n7Bo,11957
|
88
88
|
pycityagent/cityagent/blocks/mobility_block.py,sha256=OZoA-swFdX0Ezpzkyp8jJMNPQ533JpeeTCdLupoqRjI,15089
|
89
89
|
pycityagent/survey/models.py,sha256=g3xni4GcA1Py3vlGt6z4ltutjgQ4G0uINYAM8vKRJAw,5225
|
90
90
|
pycityagent/survey/__init__.py,sha256=rxwou8U9KeFSP7rMzXtmtp2fVFZxK4Trzi-psx9LPIs,153
|
91
91
|
pycityagent/survey/manager.py,sha256=tHkdeq4lTfAHwvgf4-udsXri0z2l6E00rEbvwl7SqRs,3439
|
92
|
-
pycityagent-2.0.
|
93
|
-
pycityagent-2.0.
|
94
|
-
pycityagent-2.0.
|
95
|
-
pycityagent-2.0.
|
96
|
-
pycityagent-2.0.
|
97
|
-
pycityagent-2.0.
|
92
|
+
pycityagent-2.0.0a93.dist-info/RECORD,,
|
93
|
+
pycityagent-2.0.0a93.dist-info/LICENSE,sha256=n2HPXiupinpyHMnIkbCf3OTYd3KMqbmldu1e7av0CAU,1084
|
94
|
+
pycityagent-2.0.0a93.dist-info/WHEEL,sha256=NW1RskY9zow1Y68W-gXg0oZyBRAugI1JHywIzAIai5o,109
|
95
|
+
pycityagent-2.0.0a93.dist-info/entry_points.txt,sha256=BZcne49AAIFv-hawxGnPbblea7X3MtAtoPyDX8L4OC4,132
|
96
|
+
pycityagent-2.0.0a93.dist-info/top_level.txt,sha256=yOmeu6cSXmiUtScu53a3s0p7BGtLMaV0aff83EHCTic,43
|
97
|
+
pycityagent-2.0.0a93.dist-info/METADATA,sha256=p5FYOWipjHs7S50Kd0R-kNN5NB-vWfLgDbyIzFLYW0Q,9110
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|